Selfimport
This commit is contained in:
@@ -263,7 +263,6 @@ UniValue migrate_completeimporttransaction(const UniValue& params, bool fHelp)
|
|||||||
return HexStr(E_MARSHAL(ss << importTx));
|
return HexStr(E_MARSHAL(ss << importTx));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef selfimport
|
|
||||||
UniValue selfimport(const UniValue& params, bool fHelp)
|
UniValue selfimport(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
TxProof proof; CTransaction importTx,burnTx; CTxOut burnOut; uint64_t burnAmount; uint256 blockHash;
|
TxProof proof; CTransaction importTx,burnTx; CTxOut burnOut; uint64_t burnAmount; uint256 blockHash;
|
||||||
@@ -272,10 +271,10 @@ UniValue selfimport(const UniValue& params, bool fHelp)
|
|||||||
if (fHelp || params.size() != 2)
|
if (fHelp || params.size() != 2)
|
||||||
throw runtime_error("selfimport txid burnamount\n\n"
|
throw runtime_error("selfimport txid burnamount\n\n"
|
||||||
"creates signed selfimport transaction from txid");
|
"creates signed selfimport transaction from txid");
|
||||||
//txid =
|
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||||
//burnAmount =
|
burnAmount = atof(params[1].get_str().c_str()) * COIN + 0.00000000499999;
|
||||||
|
|
||||||
if ( GetTransaction(txid,burnTx,hashBlock,false) == 0 )
|
if ( GetTransaction(txid,burnTx,blockHash,false) == 0 )
|
||||||
throw runtime_error("selfimport couldnt find txid");
|
throw runtime_error("selfimport couldnt find txid");
|
||||||
if ( GetSelfimportProof(proof,burnTx,txid) < 0 )
|
if ( GetSelfimportProof(proof,burnTx,txid) < 0 )
|
||||||
throw std::runtime_error("Failed validating selfimport");
|
throw std::runtime_error("Failed validating selfimport");
|
||||||
@@ -284,8 +283,8 @@ UniValue selfimport(const UniValue& params, bool fHelp)
|
|||||||
importTx = MakeImportCoinTransaction(proof,burnTx,payouts);
|
importTx = MakeImportCoinTransaction(proof,burnTx,payouts);
|
||||||
importTx.vout.clear();
|
importTx.vout.clear();
|
||||||
importTx.vout.push_back(burnOut);
|
importTx.vout.push_back(burnOut);
|
||||||
|
return HexStr(E_MARSHAL(ss << importTx));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp)
|
UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -334,6 +334,7 @@ static const CRPCCommand vRPCCommands[] =
|
|||||||
{ "crosschain", "migrate_converttoexport", &migrate_converttoexport, true },
|
{ "crosschain", "migrate_converttoexport", &migrate_converttoexport, true },
|
||||||
{ "crosschain", "migrate_createimporttransaction", &migrate_createimporttransaction, true },
|
{ "crosschain", "migrate_createimporttransaction", &migrate_createimporttransaction, true },
|
||||||
{ "crosschain", "migrate_completeimporttransaction", &migrate_completeimporttransaction, true },
|
{ "crosschain", "migrate_completeimporttransaction", &migrate_completeimporttransaction, true },
|
||||||
|
{ "crosschain", "selfimport", &selfimport, true },
|
||||||
|
|
||||||
/* Mining */
|
/* Mining */
|
||||||
{ "mining", "getblocktemplate", &getblocktemplate, true },
|
{ "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 invalidateblock(const UniValue& params, bool fHelp);
|
||||||
extern UniValue reconsiderblock(const UniValue& params, bool fHelp);
|
extern UniValue reconsiderblock(const UniValue& params, bool fHelp);
|
||||||
extern UniValue getspentinfo(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);
|
extern UniValue getblocksubsidy(const UniValue& params, bool fHelp);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user