mock up DisputePayout

This commit is contained in:
Scott Sadler
2018-03-30 17:20:02 -03:00
parent 2c8d8268dd
commit 9ef101bc21
5 changed files with 179 additions and 32 deletions

View File

@@ -18,6 +18,39 @@ bool EvalConditionValidity(const CC *cond, const CTransaction *txTo, int nIn)
return CheckImportPayout(cond, txTo, nIn);
}
/* Example of how you might call DisputePayout
if (strcmp(ASSETCHAINS_SYMBOL, "PANGEA") == 0) {
if (strcmp(cond->method, "DisputePoker") == 0) {
return DisputePayout(PokerVM(), cond, txTo, nIn);
}
}
*/
fprintf(stderr, "no defined behaviour for method: %s\n", cond->method);
return 0;
}
bool GetPushData(const CScript &sig, std::vector<unsigned char> &data)
{
opcodetype opcode;
auto pc = sig.begin();
if (sig.GetOp(pc, opcode, data)) return opcode > OP_0 && opcode <= OP_PUSHDATA4;
return false;
}
bool GetOpReturnData(const CScript &sig, std::vector<unsigned char> &data)
{
auto pc = sig.begin();
opcodetype opcode;
if (sig.GetOp2(pc, opcode, NULL))
if (opcode == OP_RETURN)
if (sig.GetOp(pc, opcode, data))
return opcode > OP_0 && opcode <= OP_PUSHDATA4;
return false;
}