All latest updates, smart contracts, including oracle from KMD/jl777
This commit is contained in:
@@ -952,7 +952,7 @@ bool EvalScript(
|
||||
|
||||
if (stack.size() < 2)
|
||||
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
|
||||
|
||||
//fprintf(stderr,"check cryptocondition\n");
|
||||
int fResult = checker.CheckCryptoCondition(stacktop(-1), stacktop(-2), script, consensusBranchId);
|
||||
if (fResult == -1) {
|
||||
return set_error(serror, SCRIPT_ERR_CRYPTOCONDITION_INVALID_FULFILLMENT);
|
||||
@@ -1313,19 +1313,20 @@ int TransactionSignatureChecker::CheckCryptoCondition(
|
||||
} catch (logic_error ex) {
|
||||
return 0;
|
||||
}
|
||||
//int32_t z; uint8_t *ptr;
|
||||
//ptr = (uint8_t *)scriptCode.data();
|
||||
//for (z=0; z<scriptCode.size(); z++)
|
||||
// fprintf(stderr,"%02x",ptr[z]);
|
||||
//fprintf(stderr," <- CScript\n");
|
||||
//for (z=0; z<32; z++)
|
||||
// fprintf(stderr,"%02x",((uint8_t *)&sighash)[z]);
|
||||
//fprintf(stderr," sighash nIn.%d nHashType.%d %.8f id.%d\n",(int32_t)nIn,(int32_t)nHashType,(double)amount/COIN,(int32_t)consensusBranchId);
|
||||
|
||||
/*int32_t z; uint8_t *ptr;
|
||||
ptr = (uint8_t *)scriptCode.data();
|
||||
for (z=0; z<scriptCode.size(); z++)
|
||||
fprintf(stderr,"%02x",ptr[z]);
|
||||
fprintf(stderr," <- CScript\n");
|
||||
for (z=0; z<32; z++)
|
||||
fprintf(stderr,"%02x",((uint8_t *)&sighash)[z]);
|
||||
fprintf(stderr," sighash nIn.%d nHashType.%d %.8f id.%d\n",(int32_t)nIn,(int32_t)nHashType,(double)amount/COIN,(int32_t)consensusBranchId);
|
||||
*/
|
||||
VerifyEval eval = [] (CC *cond, void *checker) {
|
||||
//fprintf(stderr,"checker.%p\n",(TransactionSignatureChecker*)checker);
|
||||
return ((TransactionSignatureChecker*)checker)->CheckEvalCondition(cond);
|
||||
};
|
||||
|
||||
//fprintf(stderr,"non-checker path\n");
|
||||
int out = cc_verify(cond, (const unsigned char*)&sighash, 32, 0,
|
||||
condBin.data(), condBin.size(), eval, (void*)this);
|
||||
//fprintf(stderr,"out.%d from cc_verify\n",(int32_t)out);
|
||||
|
||||
@@ -103,5 +103,6 @@ bool ServerTransactionSignatureChecker::VerifySignature(const std::vector<unsign
|
||||
*/
|
||||
int ServerTransactionSignatureChecker::CheckEvalCondition(const CC *cond) const
|
||||
{
|
||||
//fprintf(stderr,"call RunCCeval from ServerTransactionSignatureChecker::CheckEvalCondition\n");
|
||||
return RunCCEval(cond, *txTo, nIn);
|
||||
}
|
||||
|
||||
@@ -73,8 +73,10 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
|
||||
|
||||
if (IsCryptoConditionsEnabled()) {
|
||||
// Shortcut for pay-to-crypto-condition
|
||||
if (scriptPubKey.IsPayToCryptoCondition()) {
|
||||
if (scriptPubKey.MayAcceptCryptoCondition()) {
|
||||
if (scriptPubKey.IsPayToCryptoCondition())
|
||||
{
|
||||
if (scriptPubKey.MayAcceptCryptoCondition())
|
||||
{
|
||||
typeRet = TX_CRYPTOCONDITION;
|
||||
vector<unsigned char> hashBytes; uint160 x; int32_t i; uint8_t hash20[20],*ptr;;
|
||||
x = Hash160(scriptPubKey);
|
||||
@@ -167,7 +169,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
|
||||
// small pushdata, <= nMaxDatacarrierBytes
|
||||
if (vch1.size() > nMaxDatacarrierBytes)
|
||||
{
|
||||
fprintf(stderr,"size.%d > nMaxDatacarrier.%d\n",(int32_t)vch1.size(),(int32_t)nMaxDatacarrierBytes);
|
||||
//fprintf(stderr,"size.%d > nMaxDatacarrier.%d\n",(int32_t)vch1.size(),(int32_t)nMaxDatacarrierBytes);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -212,10 +214,10 @@ bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType)
|
||||
vector<valtype> vSolutions;
|
||||
if (!Solver(scriptPubKey, whichType, vSolutions))
|
||||
{
|
||||
int32_t i; uint8_t *ptr = (uint8_t *)scriptPubKey.data();
|
||||
for (i=0; i<scriptPubKey.size(); i++)
|
||||
fprintf(stderr,"%02x",ptr[i]);
|
||||
fprintf(stderr," non-standard scriptPubKey\n");
|
||||
//int32_t i; uint8_t *ptr = (uint8_t *)scriptPubKey.data();
|
||||
//for (i=0; i<scriptPubKey.size(); i++)
|
||||
// fprintf(stderr,"%02x",ptr[i]);
|
||||
//fprintf(stderr," non-standard scriptPubKey\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user