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

@@ -14,5 +14,36 @@ bool EvalConditionValidity(const CC *cond, const CTransaction *tx, int nIn);
*/
bool CheckImportPayout(const CC *cond, const CTransaction *payoutTx, int nIn);
/*
* Virtual machine to use in the case of on-chain app evaluation
*/
class AppVM
{
public:
/*
* in: header - paramters agreed upon by all players
* in: body - gamestate
* out: length - length of game (longest wins)
* out: payments - vector of CTxOut, always deterministically sorted.
*/
virtual std::pair<int,std::vector<CTxOut>>
evaluate(std::vector<unsigned char> header, std::vector<unsigned char> body) = 0;
};
/*
* Test a DisputePayout CC Eval condition, using a provided AppVM
*/
bool DisputePayout(AppVM &vm, const CC *cond, const CTransaction *disputeTx, int nIn);
/*
* Get PUSHDATA from a script
*/
bool GetPushData(const CScript &sig, std::vector<unsigned char> &data);
/*
* Get OP_RETURN data from a script
*/
bool GetOpReturnData(const CScript &sig, std::vector<unsigned char> &data);
#endif /* CC_EVAL_H */