From a9935f76579bdfcd355307bd32b64209ff6f4a00 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 6 Dec 2018 04:53:01 -1100 Subject: [PATCH 1/2] Fix inconsistent CC data --- src/cc/CCtx.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cc/CCtx.cpp b/src/cc/CCtx.cpp index b683a7f51..35cce315e 100644 --- a/src/cc/CCtx.cpp +++ b/src/cc/CCtx.cpp @@ -96,8 +96,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran } if ( opret.size() > 0 ) mtx.vout.push_back(CTxOut(0,opret)); - PrecomputedTransactionData txdata(mtx); - n = mtx.vin.size(); + n = mtx.vin.size(); //Reorder vins so that for multiple normal vins all other except vin0 goes to the end //This is a must to avoid hardfork change of validation in every CC, because there could be maximum one normal vin at the begining with current validation. if (normalvins>1) @@ -108,6 +107,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran mtx.vin.erase(mtx.vin.begin() + 1); } } + PrecomputedTransactionData txdata(mtx); for (i=0; i Date: Thu, 6 Dec 2018 17:30:17 +0100 Subject: [PATCH 2/2] Fix reorder of vins in FinalizeCCTx --- src/cc/CCtx.cpp | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/cc/CCtx.cpp b/src/cc/CCtx.cpp index 35cce315e..9315faa9a 100644 --- a/src/cc/CCtx.cpp +++ b/src/cc/CCtx.cpp @@ -62,8 +62,26 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran GetCCaddress(cp,myaddr,mypk); mycond = MakeCCcond1(cp->evalcode,mypk); GetCCaddress(cp,unspendable,unspendablepk); - othercond = MakeCCcond1(cp->evalcode,unspendablepk); - //fprintf(stderr,"myCCaddr.(%s) %p vs unspendable.(%s) %p\n",myaddr,mycond,unspendable,othercond); + othercond = MakeCCcond1(cp->evalcode,unspendablepk); + //Reorder vins so that for multiple normal vins all other except vin0 goes to the end + //This is a must to avoid hardfork change of validation in every CC, because there could be maximum one normal vin at the begining with current validation. + for (i=0; i1 && ccvins) + { + for(i=1;i 0 ) mtx.vout.push_back(CTxOut(0,opret)); - n = mtx.vin.size(); - //Reorder vins so that for multiple normal vins all other except vin0 goes to the end - //This is a must to avoid hardfork change of validation in every CC, because there could be maximum one normal vin at the begining with current validation. - if (normalvins>1) - { - for(i=1;i