corr test code for spending marker F

This commit is contained in:
dimxy
2019-01-22 20:37:41 +05:00
parent 3865cae643
commit 098ba877fb
2 changed files with 9 additions and 4 deletions

View File

@@ -635,10 +635,11 @@ public:
// get funcId for prev tx: // get funcId for prev tx:
uint8_t funcId = DecodeHeirEitherOpRet(prevVout[prevVout.size()-1].scriptPubKey, tokenid, fundingTxidInOpret, dummyIsHeirSpendingBegan, true); uint8_t funcId = DecodeHeirEitherOpRet(prevVout[prevVout.size()-1].scriptPubKey, tokenid, fundingTxidInOpret, dummyIsHeirSpendingBegan, true);
if (funcId == 'F' && prevN == 1) // do not allow to spend 'F' marker's vout if (funcId == 'F' && prevN == 1) { // do not allow to spend 'F' marker's vout
message = std::string("spending marker not allowed");
return false; return false;
}
} }
return true; return true;
} }
}; };

View File

@@ -7648,16 +7648,20 @@ UniValue test_heirmarker(const UniValue& params, bool fHelp)
// make fake token tx: // make fake token tx:
struct CCcontract_info *cp, C; struct CCcontract_info *cp, C;
if (fHelp || (params.size() != 4)) if (fHelp || (params.size() != 1))
throw runtime_error("incorrect params\n"); throw runtime_error("incorrect params\n");
if (ensure_CCrequirements() < 0) if (ensure_CCrequirements() < 0)
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n"); throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
uint256 fundingtxid = Parseuint256((char *)params[3].get_str().c_str()); uint256 fundingtxid = Parseuint256((char *)params[0].get_str().c_str());
CPubKey myPubkey = pubkey2pk(Mypubkey()); CPubKey myPubkey = pubkey2pk(Mypubkey());
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
int64_t normalInputs = AddNormalinputs(mtx, myPubkey, 10000, 60);
if (normalInputs < 10000)
throw runtime_error("not enough normals\n");
mtx.vin.push_back(CTxIn(fundingtxid, 1)); mtx.vin.push_back(CTxIn(fundingtxid, 1));
mtx.vout.push_back(MakeCC1vout(EVAL_HEIR, 10000, myPubkey)); mtx.vout.push_back(MakeCC1vout(EVAL_HEIR, 10000, myPubkey));