From fec1d8206984d53a0e82b202b71dd3dd45f43ccd Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 31 Dec 2018 23:35:35 -1100 Subject: [PATCH] Fixes --- src/cc/import.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cc/import.cpp b/src/cc/import.cpp index 2395791a8..5129354ff 100644 --- a/src/cc/import.cpp +++ b/src/cc/import.cpp @@ -34,10 +34,12 @@ extern uint16_t ASSETCHAINS_CODAPORT,ASSETCHAINS_BEAMPORT; int32_t komodo_nextheight(); bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock); uint8_t ASSETCHAINS_OVERRIDE_PUBKEY33[33]; +CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Params& consensusParams, int nHeight); +bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey); int32_t GetSelfimportProof(CMutableTransaction &mtx,CScript &scriptPubKey,TxProof &proof,uint64_t burnAmount,std::vector rawtx,uint256 txid,std::vector rawproof) // find burnTx with hash from "other" daemon { - MerkleBranch newBranch; CMutableTransaction &tmpmtx; CTransaction tx,vintx; uint256 blockHash; char destaddr[64],pkaddr[64]; + MerkleBranch newBranch; CMutableTransaction tmpmtx; CTransaction tx,vintx; uint256 blockHash; char destaddr[64],pkaddr[64]; tmpmtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(),komodo_nextheight()); if ( ASSETCHAINS_SELFIMPORT == "BEAM" ) { @@ -70,7 +72,7 @@ int32_t GetSelfimportProof(CMutableTransaction &mtx,CScript &scriptPubKey,TxProo // make sure vin0 is signed by ASSETCHAINS_OVERRIDE_PUBKEY33 if ( myGetTransaction(tx.vin[0].prevout,vintx,blockHash) == 0 ) return(-1); - if ( tx.vin[0].n < vintx.vout.size() && Getscriptaddress(destaddr,vintx.vout[tx.vin[0].n].scriptPubKey) != 0 ) + if ( tx.vin[0].prevout < vintx.vout.size() && Getscriptaddress(destaddr,vintx.vout[tx.vin[0].prevout].scriptPubKey) != 0 ) { pubkey2addr(pkaddr,ASSETCHAINS_OVERRIDE_PUBKEY33.data()); if ( strcmp(pkaddr,destaddr) == 0 ) @@ -78,7 +80,7 @@ int32_t GetSelfimportProof(CMutableTransaction &mtx,CScript &scriptPubKey,TxProo proof = std::make_pair(txid,newBranch); return(0); } - fprintf(stderr,"vin0[%d] -> %s vs %s\n",tx.vin[0].n,destaddr,pkaddr); + fprintf(stderr,"vin0[%d] -> %s vs %s\n",tx.vin[0].prevout,destaddr,pkaddr); } return(-1); }