From a4aad9e05b720209dad0c7d41f764f7cb454b98d Mon Sep 17 00:00:00 2001 From: dimxy Date: Tue, 23 Apr 2019 00:09:51 +0500 Subject: [PATCH] corr check vout0 validation in ValidateFinalTX --- src/cc/prices.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cc/prices.cpp b/src/cc/prices.cpp index 03af42d90..a22127fe9 100644 --- a/src/cc/prices.cpp +++ b/src/cc/prices.cpp @@ -262,7 +262,7 @@ static bool ValidateFinalTx(struct CCcontract_info *cp, Eval *eval, const CTrans pricespk = GetUnspendable(cp, 0); - if (MakeCC1vout(cp->evalcode, finaltx.vout[0].nValue, pk) != finaltx.vout[0]) + if (CTxOut(finaltx.vout[0].nValue, CScript() << ParseHex(HexStr(pk)) << OP_CHECKSIG) != finaltx.vout[0]) return eval->Invalid("cannot validate vout0 in final tx with pk from opreturn"); if( finaltx.vout.size() == 3 && MakeCC1vout(cp->evalcode, finaltx.vout[1].nValue, pricespk) != finaltx.vout[1] ) @@ -272,6 +272,17 @@ static bool ValidateFinalTx(struct CCcontract_info *cp, Eval *eval, const CTrans } // validate prices tx function +// important checks: +// tx structure +// reference to the bet tx vout +// referenced bet tx structure +// referrenced bet txid in opret +// disable marker spending +// TODO: +// opret params (firstprice,positionsize...) +// cashout balance (PricesExactAmounts) +// costbasis calculation (?) +// use the special addr for fees bool PricesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn) { vscript_t vopret;