change Eval data structure to single code blob

This commit is contained in:
Scott Sadler
2018-04-07 18:07:52 -03:00
parent 4729632250
commit 39c9911e9c
37 changed files with 239 additions and 768 deletions

View File

@@ -18,7 +18,9 @@ std::vector<CC*> BetProtocol::PlayerConditions()
CC* BetProtocol::MakeDisputeCond()
{
CC *disputePoker = CCNewEval(disputeFunc, CheckSerialize(disputeHeader));
CC *disputePoker = CCNewEval(E_MARSHAL(
ss << disputeCode << VARINT(waitBlocks) << vmParams;
));
CC *anySig = CCNewThreshold(1, PlayerConditions());
@@ -79,8 +81,9 @@ CC* BetProtocol::MakePayoutCond(uint256 signedSessionTxHash)
CC *import;
{
std::vector<unsigned char> vHash(signedSessionTxHash.begin(), signedSessionTxHash.end());
CC *importEval = CCNewEval("ImportPayout", vHash);
CC *importEval = CCNewEval(E_MARSHAL(
ss << EVAL_IMPORTPAYOUT << signedSessionTxHash;
));
CC *oneof = CCNewThreshold(1, PlayerConditions());
@@ -120,7 +123,7 @@ CMutableTransaction BetProtocol::MakeImportPayoutTx(std::vector<CTxOut> payouts,
mtx.vin.push_back(CTxIn(signedStakeTxHash, 0, CScript()));
mtx.vout = payouts;
CScript proofData;
proofData << OP_RETURN << CheckSerialize(std::make_pair(momProof, signedDisputeTx));
proofData << OP_RETURN << E_MARSHAL(ss << momProof << signedDisputeTx);
mtx.vout.insert(mtx.vout.begin(), CTxOut(0, proofData));
return mtx;
}