Merge remote-tracking branch 'jl777/FSM' into duke
Conflicts: src/hushd src/komodo_bitcoind.h
This commit is contained in:
@@ -109,6 +109,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
|
||||
{ "lockunspent", 1 },
|
||||
{ "importprivkey", 2 },
|
||||
{ "importprivkey", 3 },
|
||||
{ "importprivkey", 4 },
|
||||
{ "importaddress", 2 },
|
||||
{ "verifychain", 0 },
|
||||
{ "verifychain", 1 },
|
||||
|
||||
@@ -430,7 +430,7 @@ void CheckBurnTxSource(uint256 burntxid, UniValue &info) {
|
||||
CTransaction burnTx;
|
||||
uint256 blockHash;
|
||||
|
||||
if (!GetTransaction(burntxid, burnTx, blockHash, true))
|
||||
if (!myGetTransaction(burntxid, burnTx, blockHash))
|
||||
throw std::runtime_error("Cannot find burn transaction");
|
||||
|
||||
if (blockHash.IsNull())
|
||||
@@ -854,6 +854,7 @@ UniValue importgatewayinfo(const UniValue& params, bool fHelp)
|
||||
return(ImportGatewayInfo(txid));
|
||||
}
|
||||
|
||||
|
||||
UniValue importgatewaybind(const UniValue& params, bool fHelp)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
@@ -866,7 +867,7 @@ UniValue importgatewaybind(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 8)
|
||||
throw runtime_error("use \'importgatewaybind coin orcletxid M N pubkeys pubtype p2shtype wiftype [taddr]\' to bind an import gateway\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
CCerror = "";
|
||||
coin = params[0].get_str();
|
||||
oracletxid = Parseuint256(params[1].get_str().c_str());
|
||||
@@ -919,7 +920,7 @@ UniValue importgatewaydeposit(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 9)
|
||||
throw runtime_error("use \'importgatewaydeposit bindtxid height coin burntxid nvout rawburntx rawproof destpub amount\' to import deposited coins\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
CCerror = "";
|
||||
bindtxid = Parseuint256(params[0].get_str().c_str());
|
||||
height = atoi(params[1].get_str().c_str());
|
||||
@@ -962,7 +963,7 @@ UniValue importgatewaywithdraw(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 4)
|
||||
throw runtime_error("use \'importgatewaywithdraw bindtxid coin withdrawpub amount\' to burn imported coins and withdraw them on external chain\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
CCerror = "";
|
||||
bindtxid = Parseuint256(params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
@@ -997,7 +998,7 @@ UniValue importgatewaypartialsign(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("importgatewayspartialsign txidaddr refcoin hex\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
parthex = params[2].get_str();
|
||||
@@ -1020,7 +1021,7 @@ UniValue importgatewaycompletesigning(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("importgatewaycompletesigning withdrawtxid coin hex\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
withdrawtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
txhex = params[2].get_str();
|
||||
@@ -1040,7 +1041,7 @@ UniValue importgatewaymarkdone(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("importgatewaymarkdone completesigningtx coin\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
completetxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
hex = ImportGatewayMarkDone(0,completetxid,coin);
|
||||
@@ -1059,7 +1060,7 @@ UniValue importgatewaypendingdeposits(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("importgatewaypendingdeposits bindtxid coin\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
return(ImportGatewayPendingDeposits(bindtxid,coin));
|
||||
@@ -1071,7 +1072,7 @@ UniValue importgatewaypendingwithdraws(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("importgatewaypendingwithdraws bindtxid coin\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
return(ImportGatewayPendingWithdraws(bindtxid,coin));
|
||||
@@ -1083,7 +1084,7 @@ UniValue importgatewayprocessed(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("importgatewayprocessed bindtxid coin\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
return(ImportGatewayProcessedWithdraws(bindtxid,coin));
|
||||
@@ -1096,7 +1097,7 @@ UniValue importgatewayexternaladdress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2)
|
||||
throw runtime_error("importgatewayexternaladdress bindtxid pubkey\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
pubkey = ParseHex(params[1].get_str().c_str());
|
||||
return(ImportGatewayExternalAddress(bindtxid,pubkey));
|
||||
@@ -1109,7 +1110,7 @@ UniValue importgatewaydumpprivkey(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2)
|
||||
throw runtime_error("importgatewaydumpprivkey bindtxid address\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
std::string strAddress = params[1].get_str();
|
||||
CTxDestination dest = DecodeDestination(strAddress);
|
||||
@@ -1156,7 +1157,7 @@ UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp)
|
||||
{
|
||||
UniValue item(UniValue::VOBJ); UniValue notaryarr(UniValue::VARR); std::vector<int8_t> NotarisationNotaries;
|
||||
uint256 hash; CTransaction tx;
|
||||
if ( GetTransaction(n.first,tx,hash,false) )
|
||||
if ( myGetTransaction(n.first,tx,hash) )
|
||||
{
|
||||
if ( is_STAKED(n.second.symbol) != 0 )
|
||||
{
|
||||
|
||||
@@ -222,17 +222,17 @@ UniValue getinfo(const UniValue& params, bool fHelp)
|
||||
+ HelpExampleCli("getinfo", "")
|
||||
+ HelpExampleRpc("getinfo", "")
|
||||
);
|
||||
//#ifdef ENABLE_WALLET
|
||||
// LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL);
|
||||
//#else
|
||||
//#ifdef ENABLE_WALLET
|
||||
// LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL);
|
||||
//#else
|
||||
LOCK(cs_main);
|
||||
//#endif
|
||||
|
||||
//#endif
|
||||
|
||||
proxyType proxy;
|
||||
GetProxy(NET_IPV4, proxy);
|
||||
notarized_height = komodo_notarized_height(&prevMoMheight,¬arized_hash,¬arized_desttxid);
|
||||
//fprintf(stderr,"after notarized_height %u\n",(uint32_t)time(NULL));
|
||||
|
||||
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("version", CLIENT_VERSION));
|
||||
obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));
|
||||
@@ -243,50 +243,54 @@ UniValue getinfo(const UniValue& params, bool fHelp)
|
||||
obj.push_back(Pair("prevMoMheight", prevMoMheight));
|
||||
obj.push_back(Pair("notarizedhash", notarized_hash.ToString()));
|
||||
obj.push_back(Pair("notarizedtxid", notarized_desttxid.ToString()));
|
||||
txid_height = notarizedtxid_height(ASSETCHAINS_SYMBOL[0] != 0 ? (char *)"KMD" : (char *)"BTC",(char *)notarized_desttxid.ToString().c_str(),&kmdnotarized_height);
|
||||
if ( txid_height > 0 )
|
||||
obj.push_back(Pair("notarizedtxid_height", txid_height));
|
||||
else obj.push_back(Pair("notarizedtxid_height", "mempool"));
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
obj.push_back(Pair("KMDnotarized_height", kmdnotarized_height));
|
||||
obj.push_back(Pair("notarized_confirms", txid_height < kmdnotarized_height ? (kmdnotarized_height - txid_height + 1) : 0));
|
||||
//fprintf(stderr,"after notarized_confirms %u\n",(uint32_t)time(NULL));
|
||||
if ( KOMODO_NSPV == 0 )
|
||||
{
|
||||
txid_height = notarizedtxid_height(ASSETCHAINS_SYMBOL[0] != 0 ? (char *)"KMD" : (char *)"BTC",(char *)notarized_desttxid.ToString().c_str(),&kmdnotarized_height);
|
||||
if ( txid_height > 0 )
|
||||
obj.push_back(Pair("notarizedtxid_height", txid_height));
|
||||
else obj.push_back(Pair("notarizedtxid_height", "mempool"));
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
obj.push_back(Pair("KMDnotarized_height", kmdnotarized_height));
|
||||
obj.push_back(Pair("notarized_confirms", txid_height < kmdnotarized_height ? (kmdnotarized_height - txid_height + 1) : 0));
|
||||
//fprintf(stderr,"after notarized_confirms %u\n",(uint32_t)time(NULL));
|
||||
#ifdef ENABLE_WALLET
|
||||
if (pwalletMain) {
|
||||
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||
{
|
||||
obj.push_back(Pair("interest", ValueFromAmount(KOMODO_INTERESTSUM)));
|
||||
obj.push_back(Pair("balance", ValueFromAmount(KOMODO_WALLETBALANCE))); //pwalletMain->GetBalance()
|
||||
if (pwalletMain) {
|
||||
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||
{
|
||||
obj.push_back(Pair("interest", ValueFromAmount(KOMODO_INTERESTSUM)));
|
||||
obj.push_back(Pair("balance", ValueFromAmount(KOMODO_WALLETBALANCE))); //pwalletMain->GetBalance()
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); //
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); //
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//fprintf(stderr,"after wallet %u\n",(uint32_t)time(NULL));
|
||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
||||
if ( (longestchain= KOMODO_LONGESTCHAIN) != 0 && chainActive.Height() > longestchain )
|
||||
longestchain = chainActive.Height();
|
||||
//fprintf(stderr,"after longestchain %u\n",(uint32_t)time(NULL));
|
||||
obj.push_back(Pair("longestchain", longestchain));
|
||||
//fprintf(stderr,"after wallet %u\n",(uint32_t)time(NULL));
|
||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
||||
if ( (longestchain= KOMODO_LONGESTCHAIN) != 0 && chainActive.Height() > longestchain )
|
||||
longestchain = chainActive.Height();
|
||||
//fprintf(stderr,"after longestchain %u\n",(uint32_t)time(NULL));
|
||||
obj.push_back(Pair("longestchain", longestchain));
|
||||
if ( chainActive.LastTip() != 0 )
|
||||
obj.push_back(Pair("tiptime", (int)chainActive.LastTip()->nTime));
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
#ifdef ENABLE_WALLET
|
||||
if (pwalletMain) {
|
||||
obj.push_back(Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime()));
|
||||
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
|
||||
}
|
||||
if (pwalletMain && pwalletMain->IsCrypted())
|
||||
obj.push_back(Pair("unlocked_until", nWalletUnlockTime));
|
||||
obj.push_back(Pair("paytxfee", ValueFromAmount(payTxFee.GetFeePerK())));
|
||||
#endif
|
||||
obj.push_back(Pair("sapling", ASSETCHAINS_SAPLING));
|
||||
}
|
||||
obj.push_back(Pair("timeoffset", GetTimeOffset()));
|
||||
if ( chainActive.LastTip() != 0 )
|
||||
obj.push_back(Pair("tiptime", (int)chainActive.LastTip()->nTime));
|
||||
obj.push_back(Pair("connections", (int)vNodes.size()));
|
||||
obj.push_back(Pair("proxy", (proxy.IsValid() ? proxy.proxy.ToStringIPPort() : string())));
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
obj.push_back(Pair("testnet", Params().TestnetToBeDeprecatedFieldRPC()));
|
||||
#ifdef ENABLE_WALLET
|
||||
if (pwalletMain) {
|
||||
obj.push_back(Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime()));
|
||||
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
|
||||
}
|
||||
if (pwalletMain && pwalletMain->IsCrypted())
|
||||
obj.push_back(Pair("unlocked_until", nWalletUnlockTime));
|
||||
obj.push_back(Pair("paytxfee", ValueFromAmount(payTxFee.GetFeePerK())));
|
||||
#endif
|
||||
obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK())));
|
||||
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
||||
if ( NOTARY_PUBKEY33[0] != 0 ) {
|
||||
@@ -304,7 +308,6 @@ UniValue getinfo(const UniValue& params, bool fHelp)
|
||||
if ( ASSETCHAINS_CC != 0 )
|
||||
obj.push_back(Pair("CCid", (int)ASSETCHAINS_CC));
|
||||
obj.push_back(Pair("name", ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL));
|
||||
obj.push_back(Pair("sapling", ASSETCHAINS_SAPLING));
|
||||
|
||||
obj.push_back(Pair("p2pport", ASSETCHAINS_P2PPORT));
|
||||
obj.push_back(Pair("rpcport", ASSETCHAINS_RPCPORT));
|
||||
|
||||
@@ -206,7 +206,7 @@ void TxToJSONExpanded(const CTransaction& tx, const uint256 hashBlock, UniValue&
|
||||
UniValue in(UniValue::VOBJ);
|
||||
if (tx.IsCoinBase())
|
||||
in.push_back(Pair("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())));
|
||||
else if (tx.IsCoinImport()) {
|
||||
else if (tx.IsCoinImport() && txin.prevout.n==10e8) {
|
||||
in.push_back(Pair("is_import", "1"));
|
||||
ImportProof proof; CTransaction burnTx; std::vector<CTxOut> payouts; CTxDestination importaddress;
|
||||
if (UnmarshalImportTx(tx, proof, burnTx, payouts))
|
||||
@@ -368,13 +368,13 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
|
||||
entry.push_back(Pair("vin", vin));
|
||||
UniValue vout(UniValue::VARR);
|
||||
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||
CBlockIndex *tipindex,*pindex = it->second;
|
||||
CBlockIndex *tipindex;//,*pindex = it->second;
|
||||
uint64_t interest;
|
||||
for (unsigned int i = 0; i < tx.vout.size(); i++) {
|
||||
const CTxOut& txout = tx.vout[i];
|
||||
UniValue out(UniValue::VOBJ);
|
||||
out.push_back(Pair("value", ValueFromAmount(txout.nValue)));
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 && pindex != 0 && tx.nLockTime >= 500000000 && (tipindex= chainActive.LastTip()) != 0 )
|
||||
if ( KOMODO_NSPV == 0 && ASSETCHAINS_SYMBOL[0] == 0 && tx.nLockTime >= 500000000 && (tipindex= chainActive.LastTip()) != 0 )
|
||||
{
|
||||
int64_t interest; int32_t txheight; uint32_t locktime;
|
||||
interest = komodo_accrued_interest(&txheight,&locktime,tx.GetHash(),i,0,txout.nValue,(int32_t)tipindex->GetHeight());
|
||||
@@ -757,7 +757,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
|
||||
|
||||
"\nExamples\n"
|
||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"address\\\":0.01}\"")
|
||||
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\"")
|
||||
+ HelpExampleRpc("createrawtransaction", "[{\"txid\":\"myid\",\"vout\":0}], {\"address\":0.01}")
|
||||
);
|
||||
|
||||
LOCK(cs_main);
|
||||
@@ -1282,6 +1282,8 @@ UniValue signrawtransaction(const UniValue& params, bool fHelp)
|
||||
return result;
|
||||
}
|
||||
|
||||
extern UniValue NSPV_broadcast(char *hex);
|
||||
|
||||
UniValue sendrawtransaction(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||
@@ -1317,30 +1319,35 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp)
|
||||
bool fOverrideFees = false;
|
||||
if (params.size() > 1)
|
||||
fOverrideFees = params[1].get_bool();
|
||||
|
||||
CCoinsViewCache &view = *pcoinsTip;
|
||||
const CCoins* existingCoins = view.AccessCoins(hashTx);
|
||||
bool fHaveMempool = mempool.exists(hashTx);
|
||||
bool fHaveChain = existingCoins && existingCoins->nHeight < 1000000000;
|
||||
if (!fHaveMempool && !fHaveChain) {
|
||||
// push to local node and sync with wallets
|
||||
CValidationState state;
|
||||
bool fMissingInputs;
|
||||
if (!AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees)) {
|
||||
if (state.IsInvalid()) {
|
||||
throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason()));
|
||||
} else {
|
||||
if (fMissingInputs) {
|
||||
throw JSONRPCError(RPC_TRANSACTION_ERROR, "Missing inputs");
|
||||
if ( KOMODO_NSPV == 0 )
|
||||
{
|
||||
CCoinsViewCache &view = *pcoinsTip;
|
||||
const CCoins* existingCoins = view.AccessCoins(hashTx);
|
||||
bool fHaveMempool = mempool.exists(hashTx);
|
||||
bool fHaveChain = existingCoins && existingCoins->nHeight < 1000000000;
|
||||
if (!fHaveMempool && !fHaveChain) {
|
||||
// push to local node and sync with wallets
|
||||
CValidationState state;
|
||||
bool fMissingInputs;
|
||||
if (!AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees)) {
|
||||
if (state.IsInvalid()) {
|
||||
throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason()));
|
||||
} else {
|
||||
if (fMissingInputs) {
|
||||
throw JSONRPCError(RPC_TRANSACTION_ERROR, "Missing inputs");
|
||||
}
|
||||
throw JSONRPCError(RPC_TRANSACTION_ERROR, state.GetRejectReason());
|
||||
}
|
||||
throw JSONRPCError(RPC_TRANSACTION_ERROR, state.GetRejectReason());
|
||||
}
|
||||
} else if (fHaveChain) {
|
||||
throw JSONRPCError(RPC_TRANSACTION_ALREADY_IN_CHAIN, "transaction already in block chain");
|
||||
}
|
||||
} else if (fHaveChain) {
|
||||
throw JSONRPCError(RPC_TRANSACTION_ALREADY_IN_CHAIN, "transaction already in block chain");
|
||||
RelayTransaction(tx);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSPV_broadcast((char *)params[0].get_str().c_str());
|
||||
}
|
||||
RelayTransaction(tx);
|
||||
|
||||
return hashTx.GetHex();
|
||||
}
|
||||
|
||||
|
||||
@@ -416,6 +416,18 @@ static const CRPCCommand vRPCCommands[] =
|
||||
{ "FSM", "FSMlist", &FSMlist, true },
|
||||
{ "FSM", "FSMinfo", &FSMinfo, true },
|
||||
|
||||
// fsm
|
||||
{ "nSPV", "nspv_getinfo", &nspv_getinfo, true },
|
||||
{ "nSPV", "nspv_login", &nspv_login, true },
|
||||
{ "nSPV", "nspv_listunspent", &nspv_listunspent, true },
|
||||
{ "nSPV", "nspv_spentinfo", &nspv_spentinfo, true },
|
||||
{ "nSPV", "nspv_notarizations", &nspv_notarizations, true },
|
||||
{ "nSPV", "nspv_hdrsproof", &nspv_hdrsproof, true },
|
||||
{ "nSPV", "nspv_txproof", &nspv_txproof, true },
|
||||
{ "nSPV", "nspv_spend", &nspv_spend, true },
|
||||
{ "nSPV", "nspv_broadcast", &nspv_broadcast, true },
|
||||
{ "nSPV", "nspv_logout", &nspv_logout, true },
|
||||
|
||||
// rewards
|
||||
{ "rewards", "rewardslist", &rewardslist, true },
|
||||
{ "rewards", "rewardsinfo", &rewardsinfo, true },
|
||||
@@ -554,6 +566,18 @@ static const CRPCCommand vRPCCommands[] =
|
||||
//{ "tokens", "tokenfillswap", &tokenfillswap, true },
|
||||
{ "tokens", "tokenconvert", &tokenconvert, true },
|
||||
|
||||
// pegs
|
||||
{ "pegs", "pegscreate", &pegscreate, true },
|
||||
{ "pegs", "pegsfund", &pegsfund, true },
|
||||
{ "pegs", "pegsget", &pegsget, true },
|
||||
{ "pegs", "pegsredeem", &pegsredeem, true },
|
||||
{ "pegs", "pegsliquidate", &pegsliquidate, true },
|
||||
{ "pegs", "pegsexchange", &pegsexchange, true },
|
||||
{ "pegs", "pegsaccounthistory", &pegsaccounthistory, true },
|
||||
{ "pegs", "pegsaccountinfo", &pegsaccountinfo, true },
|
||||
{ "pegs", "pegsworstaccounts", &pegsworstaccounts, true },
|
||||
{ "pegs", "pegsinfo", &pegsinfo, true },
|
||||
|
||||
/* Address index */
|
||||
{ "addressindex", "getaddressmempool", &getaddressmempool, true },
|
||||
{ "addressindex", "getaddressutxos", &getaddressutxos, false },
|
||||
|
||||
@@ -349,6 +349,16 @@ extern UniValue FSMcreate(const UniValue& params, bool fHelp);
|
||||
extern UniValue FSMlist(const UniValue& params, bool fHelp);
|
||||
extern UniValue FSMinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue auctionaddress(const UniValue& params, bool fHelp);
|
||||
extern UniValue pegscreate(const UniValue& params, bool fHelp);
|
||||
extern UniValue pegsfund(const UniValue& params, bool fHelp);
|
||||
extern UniValue pegsget(const UniValue& params, bool fHelp);
|
||||
extern UniValue pegsredeem(const UniValue& params, bool fHelp);
|
||||
extern UniValue pegsliquidate(const UniValue& params, bool fHelp);
|
||||
extern UniValue pegsexchange(const UniValue& params, bool fHelp);
|
||||
extern UniValue pegsaccounthistory(const UniValue& params, bool fHelp);
|
||||
extern UniValue pegsaccountinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue pegsworstaccounts(const UniValue& params, bool fHelp);
|
||||
extern UniValue pegsinfo(const UniValue& params, bool fHelp);
|
||||
|
||||
extern UniValue getnewaddress(const UniValue& params, bool fHelp); // in rpcwallet.cpp
|
||||
//extern UniValue getnewaddress64(const UniValue& params, bool fHelp); // in rpcwallet.cpp
|
||||
@@ -455,6 +465,17 @@ extern UniValue importgatewaypendingdeposits(const UniValue& params, bool fHelp)
|
||||
extern UniValue importgatewaypendingwithdraws(const UniValue& params, bool fHelp);
|
||||
extern UniValue importgatewayprocessed(const UniValue& params, bool fHelp);
|
||||
|
||||
extern UniValue nspv_getinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue nspv_login(const UniValue& params, bool fHelp);
|
||||
extern UniValue nspv_listunspent(const UniValue& params, bool fHelp);
|
||||
extern UniValue nspv_spentinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue nspv_notarizations(const UniValue& params, bool fHelp);
|
||||
extern UniValue nspv_hdrsproof(const UniValue& params, bool fHelp);
|
||||
extern UniValue nspv_txproof(const UniValue& params, bool fHelp);
|
||||
extern UniValue nspv_spend(const UniValue& params, bool fHelp);
|
||||
extern UniValue nspv_broadcast(const UniValue& params, bool fHelp);
|
||||
extern UniValue nspv_logout(const UniValue& params, bool fHelp);
|
||||
|
||||
extern UniValue getblocksubsidy(const UniValue& params, bool fHelp);
|
||||
|
||||
extern UniValue z_exportkey(const UniValue& params, bool fHelp); // in rpcdump.cpp
|
||||
|
||||
@@ -61,7 +61,7 @@ UniValue test_ac(const UniValue& params, bool fHelp)
|
||||
if (fHelp || (params.size() != 4))
|
||||
throw runtime_error("incorrect params\n");
|
||||
if (ensure_CCrequirements(EVAL_HEIR) < 0)
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
|
||||
std::vector<unsigned char> pubkey1;
|
||||
std::vector<unsigned char> pubkey2;
|
||||
@@ -106,7 +106,7 @@ UniValue test_heirmarker(const UniValue& params, bool fHelp)
|
||||
if (fHelp || (params.size() != 1))
|
||||
throw runtime_error("incorrect params\n");
|
||||
if (ensure_CCrequirements(EVAL_HEIR) < 0)
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
|
||||
uint256 fundingtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
|
||||
@@ -137,7 +137,7 @@ UniValue test_burntx(const UniValue& params, bool fHelp)
|
||||
if (fHelp || (params.size() != 1))
|
||||
throw runtime_error("incorrect params\n");
|
||||
if (ensure_CCrequirements(EVAL_TOKENS) < 0)
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
|
||||
uint256 tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
|
||||
@@ -230,7 +230,7 @@ UniValue test_pricesmarker(const UniValue& params, bool fHelp)
|
||||
if (fHelp || (params.size() != 1))
|
||||
throw runtime_error("incorrect params\n");
|
||||
if (ensure_CCrequirements(EVAL_PRICES) < 0)
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
throw runtime_error(CC_REQUIREMENTS_MSG);
|
||||
|
||||
uint256 bettxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
|
||||
@@ -265,4 +265,4 @@ void RegisterTesttransactionsRPCCommands(CRPCTable &tableRPC)
|
||||
{
|
||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
||||
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user