burnv
This commit is contained in:
@@ -270,7 +270,7 @@ UniValue migrate_completeimporttransaction(const UniValue& params, bool fHelp)
|
|||||||
UniValue selfimport(const UniValue& params, bool fHelp)
|
UniValue selfimport(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
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 )
|
if ( ASSETCHAINS_SELFIMPORT.size() == 0 )
|
||||||
throw runtime_error("selfimport only works on -ac_import chains");
|
throw runtime_error("selfimport only works on -ac_import chains");
|
||||||
if (fHelp || params.size() != 2)
|
if (fHelp || params.size() != 2)
|
||||||
@@ -282,6 +282,7 @@ UniValue selfimport(const UniValue& params, bool fHelp)
|
|||||||
if ( GetTransaction(txid,burnTx,blockHash,false) == 0 )
|
if ( GetTransaction(txid,burnTx,blockHash,false) == 0 )
|
||||||
throw runtime_error("selfimport couldnt find txid");
|
throw runtime_error("selfimport couldnt find txid");
|
||||||
burnOut = MakeBurnOutput(burnAmount,0xffffffff,ASSETCHAINS_SELFIMPORT,burnTx.vout);
|
burnOut = MakeBurnOutput(burnAmount,0xffffffff,ASSETCHAINS_SELFIMPORT,burnTx.vout);
|
||||||
|
savevout = burnTx.vout[0];
|
||||||
mtx = burnTx;
|
mtx = burnTx;
|
||||||
mtx.vout.clear();
|
mtx.vout.clear();
|
||||||
mtx.vout.push_back(burnOut);
|
mtx.vout.push_back(burnOut);
|
||||||
@@ -290,7 +291,7 @@ UniValue selfimport(const UniValue& params, bool fHelp)
|
|||||||
throw std::runtime_error("Failed validating selfimport");
|
throw std::runtime_error("Failed validating selfimport");
|
||||||
burnOut = MakeBurnOutput(burnAmount,0xffffffff,ASSETCHAINS_SELFIMPORT,burnTx.vout);
|
burnOut = MakeBurnOutput(burnAmount,0xffffffff,ASSETCHAINS_SELFIMPORT,burnTx.vout);
|
||||||
mtx = MakeImportCoinTransaction(proof,burnTx,burnTx.vout);
|
mtx = MakeImportCoinTransaction(proof,burnTx,burnTx.vout);
|
||||||
mtx.vout[1] = burnTx.vout[0];
|
mtx.vout[1] = savevout;
|
||||||
mtx.vout[1].nValue = burnAmount;
|
mtx.vout[1].nValue = burnAmount;
|
||||||
return HexStr(E_MARSHAL(ss << mtx));
|
return HexStr(E_MARSHAL(ss << mtx));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user