This commit is contained in:
jl777
2018-12-29 03:37:00 -11:00
parent 504af0a755
commit c182e9a480

View File

@@ -270,7 +270,7 @@ UniValue migrate_completeimporttransaction(const UniValue& params, bool fHelp)
UniValue selfimport(const UniValue& params, bool fHelp)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
TxProof proof; CTransaction burnTx; CTxOut burnOut; uint64_t burnAmount; uint256 txid,blockHash;
TxProof proof; CTransaction burnTx; CTxOut burnOut,savevout; uint64_t burnAmount; uint256 txid,blockHash;
if ( ASSETCHAINS_SELFIMPORT.size() == 0 )
throw runtime_error("selfimport only works on -ac_import chains");
if (fHelp || params.size() != 2)
@@ -282,6 +282,7 @@ UniValue selfimport(const UniValue& params, bool fHelp)
if ( GetTransaction(txid,burnTx,blockHash,false) == 0 )
throw runtime_error("selfimport couldnt find txid");
burnOut = MakeBurnOutput(burnAmount,0xffffffff,ASSETCHAINS_SELFIMPORT,burnTx.vout);
savevout = burnTx.vout[0];
mtx = burnTx;
mtx.vout.clear();
mtx.vout.push_back(burnOut);
@@ -290,7 +291,7 @@ UniValue selfimport(const UniValue& params, bool fHelp)
throw std::runtime_error("Failed validating selfimport");
burnOut = MakeBurnOutput(burnAmount,0xffffffff,ASSETCHAINS_SELFIMPORT,burnTx.vout);
mtx = MakeImportCoinTransaction(proof,burnTx,burnTx.vout);
mtx.vout[1] = burnTx.vout[0];
mtx.vout[1] = savevout;
mtx.vout[1].nValue = burnAmount;
return HexStr(E_MARSHAL(ss << mtx));
}