Merge pull request #1582 from Mixa84/FSM

Fixes for KOMDO_EARLYTXID and Tokens test vouts
This commit is contained in:
jl777
2019-07-04 22:32:37 -11:00
committed by GitHub
3 changed files with 7 additions and 6 deletions

View File

@@ -397,19 +397,19 @@ int64_t IsTokensvout(bool goDeeper, bool checkPubkeys /*<--not used, always true
}
}
//special check for 3 pubkey tx when spending from 1of2 CC address with on of pubkeys is global CC pubkey
//special check for tx when spending from 1of2 CC address and one of pubkeys is global CC pubkey
struct CCcontract_info *cpEvalCode1,CEvalCode1;
cpEvalCode1 = CCinit(&CEvalCode1,evalCode1);
CPubKey pk=GetUnspendable(cpEvalCode1,0);
testVouts.push_back( std::make_pair(MakeTokensCC1of2vout(evalCode1, tx.vout[v].nValue, voutPubkeys[0], pk), std::string("dual-eval1 pegscc cc1of2 pk[0] globalccpk")) );
testVouts.push_back( std::make_pair(MakeTokensCC1of2vout(evalCode1, tx.vout[v].nValue, voutPubkeys[1], pk), std::string("dual-eval1 pegscc cc1of2 pk[1] globalccpk")) );
if (voutPubkeys.size() == 2) testVouts.push_back( std::make_pair(MakeTokensCC1of2vout(evalCode1, tx.vout[v].nValue, voutPubkeys[1], pk), std::string("dual-eval1 pegscc cc1of2 pk[1] globalccpk")) );
if (evalCode2!=0)
{
struct CCcontract_info *cpEvalCode2,CEvalCode2;
cpEvalCode2 = CCinit(&CEvalCode2,evalCode2);
CPubKey pk=GetUnspendable(cpEvalCode2,0);
testVouts.push_back( std::make_pair(MakeTokensCC1of2vout(evalCode2, tx.vout[v].nValue, voutPubkeys[0], pk), std::string("dual-eval2 pegscc cc1of2 pk[0] globalccpk")) );
testVouts.push_back( std::make_pair(MakeTokensCC1of2vout(evalCode2, tx.vout[v].nValue, voutPubkeys[1], pk), std::string("dual-eval2 pegscc cc1of2 pk[1] globalccpk")) );
if (voutPubkeys.size() == 2) testVouts.push_back( std::make_pair(MakeTokensCC1of2vout(evalCode2, tx.vout[v].nValue, voutPubkeys[1], pk), std::string("dual-eval2 pegscc cc1of2 pk[1] globalccpk")) );
}
// maybe it is single-eval or dual/three-eval token change?

View File

@@ -675,7 +675,7 @@ std::string PegsCreate(uint64_t txfee,int64_t amount, std::vector<uint256> bindt
}
if ( AddNormalinputs(mtx,mypk,amount,64) >= amount )
{
for (int i=0; i<(amount-txfee)/CC_MARKER_VALUE; i++) mtx.vout.push_back(MakeCC1vout(EVAL_PEGS,CC_MARKER_VALUE,pegspk));
for (int i=0; i<100; i++) mtx.vout.push_back(MakeCC1vout(EVAL_PEGS,(amount-txfee)/100,pegspk));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodePegsCreateOpRet(bindtxids)));
}
CCerror = strprintf("error adding normal inputs");

View File

@@ -1787,9 +1787,10 @@ void komodo_args(char *argv0)
printf("KOMODO_REWIND %d\n",KOMODO_REWIND);
}
KOMODO_EARLYTXID = Parseuint256(GetArg("-earlytxid","0").c_str());
if (KOMODO_EARLYTXID!=zeroid && (tx_height(KOMODO_EARLYTXID)==0 || tx_height(KOMODO_EARLYTXID)>100))
CTransaction tx; uint256 blockhash;
if (KOMODO_EARLYTXID!=zeroid && myGetTransaction(KOMODO_EARLYTXID,tx,blockhash) && (mapBlockIndex[blockhash]->GetHeight() == 0 || mapBlockIndex[blockhash]->GetHeight() > 100))
{
fprintf(stderr,"earlytx can be only in first 100 blocks or does not exist\n");
fprintf(stderr,"error: earlytx can be only in first 100 blocks or tx does not exist\n");
StartShutdown();
}
ASSETCHAINS_EARLYTXIDCONTRACT = GetArg("-ac_earlytxidcontract",0);