@@ -106,7 +106,7 @@ void AddImportTombstone(const CTransaction &importTx, CCoinsViewCache &inputs, i
|
||||
uint256 burnHash = importTx.vin[0].prevout.hash;
|
||||
CCoinsModifier modifier = inputs.ModifyCoins(burnHash);
|
||||
modifier->nHeight = nHeight;
|
||||
modifier->nVersion = 1;
|
||||
modifier->nVersion = 4;//1;
|
||||
modifier->vout.push_back(CTxOut(0, CScript() << OP_0));
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,10 @@ int32_t komodo_MoMoMdata(char *hexstr,int32_t hexsize,struct komodo_ccdataMoMoM
|
||||
struct komodo_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmdstarti,int32_t kmdendi);
|
||||
uint256 komodo_calcMoM(int32_t height,int32_t MoMdepth);
|
||||
extern std::string ASSETCHAINS_SELFIMPORT;
|
||||
int komodo_nextheight();
|
||||
uint256 Parseuint256(char *hexstr);
|
||||
int32_t GetSelfimportProof(TxProof &proof,CTransaction burnTx,uint256 hash);
|
||||
|
||||
|
||||
UniValue assetchainproof(const UniValue& params, bool fHelp)
|
||||
{
|
||||
@@ -263,29 +267,29 @@ UniValue migrate_completeimporttransaction(const UniValue& params, bool fHelp)
|
||||
return HexStr(E_MARSHAL(ss << importTx));
|
||||
}
|
||||
|
||||
#ifdef selfimport
|
||||
UniValue selfimport(const UniValue& params, bool fHelp)
|
||||
{
|
||||
TxProof proof; CTransaction importTx,burnTx; CTxOut burnOut; uint64_t burnAmount; uint256 blockHash;
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
TxProof proof; CTransaction burnTx; CTxOut burnOut; 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)
|
||||
throw runtime_error("selfimport txid burnamount\n\n"
|
||||
"creates signed selfimport transaction from txid");
|
||||
//txid =
|
||||
//burnAmount =
|
||||
|
||||
if ( GetTransaction(txid,burnTx,hashBlock,false) == 0 )
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
burnAmount = atof(params[1].get_str().c_str()) * COIN + 0.00000000499999;
|
||||
|
||||
if ( GetTransaction(txid,burnTx,blockHash,false) == 0 )
|
||||
throw runtime_error("selfimport couldnt find txid");
|
||||
if ( GetSelfimportProof(proof,burnTx,txid) < 0 )
|
||||
throw std::runtime_error("Failed validating selfimport");
|
||||
|
||||
burnOut = MakeBurnOutput(burnAmount,0xffffffff,ASSETCHAINS_SELFIMPORT,burnTx.vout);
|
||||
importTx = MakeImportCoinTransaction(proof,burnTx,payouts);
|
||||
importTx.vout.clear();
|
||||
importTx.vout.push_back(burnOut);
|
||||
mtx = MakeImportCoinTransaction(proof,burnTx,burnTx.vout);
|
||||
mtx.vout.clear();
|
||||
mtx.vout.push_back(burnOut);
|
||||
return HexStr(E_MARSHAL(ss << mtx));
|
||||
}
|
||||
#endif
|
||||
|
||||
UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp)
|
||||
{
|
||||
|
||||
@@ -334,6 +334,7 @@ static const CRPCCommand vRPCCommands[] =
|
||||
{ "crosschain", "migrate_converttoexport", &migrate_converttoexport, true },
|
||||
{ "crosschain", "migrate_createimporttransaction", &migrate_createimporttransaction, true },
|
||||
{ "crosschain", "migrate_completeimporttransaction", &migrate_completeimporttransaction, true },
|
||||
{ "crosschain", "selfimport", &selfimport, true },
|
||||
|
||||
/* Mining */
|
||||
{ "mining", "getblocktemplate", &getblocktemplate, true },
|
||||
|
||||
@@ -392,6 +392,7 @@ extern UniValue getchaintips(const UniValue& params, bool fHelp);
|
||||
extern UniValue invalidateblock(const UniValue& params, bool fHelp);
|
||||
extern UniValue reconsiderblock(const UniValue& params, bool fHelp);
|
||||
extern UniValue getspentinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue selfimport(const UniValue& params, bool fHelp);
|
||||
|
||||
extern UniValue getblocksubsidy(const UniValue& params, bool fHelp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user