mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
UPSTREAM MERGE BROKEN: Merge commit 'f617e05c38' into master
This commit is contained in:
commit
7f894ae00b
393 changed files with 7992 additions and 3340 deletions
|
|
@ -12,8 +12,8 @@
|
|||
#include <checkpoints.h>
|
||||
#include <coins.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <validation.h>
|
||||
#include <core_io.h>
|
||||
#include <hash.h>
|
||||
#include <index/txindex.h>
|
||||
#include <key_io.h>
|
||||
#include <policy/feerate.h>
|
||||
|
|
@ -21,14 +21,15 @@
|
|||
#include <policy/rbf.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <rpc/server.h>
|
||||
#include <rpc/util.h>
|
||||
#include <script/descriptor.h>
|
||||
#include <streams.h>
|
||||
#include <sync.h>
|
||||
#include <txdb.h>
|
||||
#include <txmempool.h>
|
||||
#include <util.h>
|
||||
#include <utilstrencodings.h>
|
||||
#include <hash.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/system.h>
|
||||
#include <validation.h>
|
||||
#include <validationinterface.h>
|
||||
#include <versionbitsinfo.h>
|
||||
#include <warnings.h>
|
||||
|
|
@ -192,7 +193,7 @@ static UniValue getbestblockhash(const JSONRPCRequest& request)
|
|||
"getbestblockhash\n"
|
||||
"\nReturns the hash of the best (tip) block in the longest blockchain.\n"
|
||||
"\nResult:\n"
|
||||
"\"hex\" (string) the block hash hex encoded\n"
|
||||
"\"hex\" (string) the block hash, hex-encoded\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("getbestblockhash", "")
|
||||
+ HelpExampleRpc("getbestblockhash", "")
|
||||
|
|
@ -271,7 +272,7 @@ static UniValue waitforblock(const JSONRPCRequest& request)
|
|||
);
|
||||
int timeout = 0;
|
||||
|
||||
uint256 hash = uint256S(request.params[0].get_str());
|
||||
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
||||
|
||||
if (!request.params[1].isNull())
|
||||
timeout = request.params[1].get_int();
|
||||
|
|
@ -519,17 +520,17 @@ static UniValue getmempoolancestors(const JSONRPCRequest& request)
|
|||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
|
||||
throw std::runtime_error(
|
||||
"getmempoolancestors txid (verbose)\n"
|
||||
"getmempoolancestors txid ( verbose )\n"
|
||||
"\nIf txid is in the mempool, returns all in-mempool ancestors.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"txid\" (string, required) The transaction id (must be in mempool)\n"
|
||||
"2. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n"
|
||||
"\nResult (for verbose=false):\n"
|
||||
"\nResult (for verbose = false):\n"
|
||||
"[ (json array of strings)\n"
|
||||
" \"transactionid\" (string) The transaction id of an in-mempool ancestor transaction\n"
|
||||
" ,...\n"
|
||||
"]\n"
|
||||
"\nResult (for verbose=true):\n"
|
||||
"\nResult (for verbose = true):\n"
|
||||
"{ (json object)\n"
|
||||
" \"transactionid\" : { (json object)\n"
|
||||
+ EntryDescriptionString()
|
||||
|
|
@ -583,17 +584,17 @@ static UniValue getmempooldescendants(const JSONRPCRequest& request)
|
|||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
|
||||
throw std::runtime_error(
|
||||
"getmempooldescendants txid (verbose)\n"
|
||||
"getmempooldescendants txid ( verbose )\n"
|
||||
"\nIf txid is in the mempool, returns all in-mempool descendants.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"txid\" (string, required) The transaction id (must be in mempool)\n"
|
||||
"2. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n"
|
||||
"\nResult (for verbose=false):\n"
|
||||
"\nResult (for verbose = false):\n"
|
||||
"[ (json array of strings)\n"
|
||||
" \"transactionid\" (string) The transaction id of an in-mempool descendant transaction\n"
|
||||
" ,...\n"
|
||||
"]\n"
|
||||
"\nResult (for verbose=true):\n"
|
||||
"\nResult (for verbose = true):\n"
|
||||
"{ (json object)\n"
|
||||
" \"transactionid\" : { (json object)\n"
|
||||
+ EntryDescriptionString()
|
||||
|
|
@ -710,7 +711,7 @@ static UniValue getblockheader(const JSONRPCRequest& request)
|
|||
"If verbose is true, returns an Object with information about blockheader <hash>.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"hash\" (string, required) The block hash\n"
|
||||
"2. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data\n"
|
||||
"2. verbose (boolean, optional, default=true) true for a json object, false for the hex-encoded data\n"
|
||||
"\nResult (for verbose = true):\n"
|
||||
"{\n"
|
||||
" \"hash\" : \"hash\", (string) the block hash (same as provided)\n"
|
||||
|
|
@ -740,8 +741,7 @@ static UniValue getblockheader(const JSONRPCRequest& request)
|
|||
|
||||
LOCK(cs_main);
|
||||
|
||||
std::string strHash = request.params[0].get_str();
|
||||
uint256 hash(uint256S(strHash));
|
||||
uint256 hash(ParseHashV(request.params[0], "hash"));
|
||||
|
||||
bool fVerbose = true;
|
||||
if (!request.params[1].isNull())
|
||||
|
|
@ -792,7 +792,7 @@ static UniValue getblock(const JSONRPCRequest& request)
|
|||
"If verbosity is 2, returns an Object with information about block <hash> and information about each transaction. \n"
|
||||
"\nArguments:\n"
|
||||
"1. \"blockhash\" (string, required) The block hash\n"
|
||||
"2. verbosity (numeric, optional, default=1) 0 for hex encoded data, 1 for a json object, and 2 for json object with transaction data\n"
|
||||
"2. verbosity (numeric, optional, default=1) 0 for hex-encoded data, 1 for a json object, and 2 for json object with transaction data\n"
|
||||
"\nResult (for verbosity = 0):\n"
|
||||
"\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n"
|
||||
"\nResult (for verbosity = 1):\n"
|
||||
|
|
@ -837,8 +837,7 @@ static UniValue getblock(const JSONRPCRequest& request)
|
|||
|
||||
LOCK(cs_main);
|
||||
|
||||
std::string strHash = request.params[0].get_str();
|
||||
uint256 hash(uint256S(strHash));
|
||||
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
||||
|
||||
int verbosity = 1;
|
||||
if (!request.params[1].isNull()) {
|
||||
|
|
@ -1066,7 +1065,7 @@ UniValue gettxout(const JSONRPCRequest& request)
|
|||
+ HelpExampleCli("listunspent", "") +
|
||||
"\nView the details\n"
|
||||
+ HelpExampleCli("gettxout", "\"txid\" 1") +
|
||||
"\nAs a json rpc call\n"
|
||||
"\nAs a JSON-RPC call\n"
|
||||
+ HelpExampleRpc("gettxout", "\"txid\", 1")
|
||||
);
|
||||
|
||||
|
|
@ -1074,8 +1073,7 @@ UniValue gettxout(const JSONRPCRequest& request)
|
|||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
|
||||
std::string strHash = request.params[0].get_str();
|
||||
uint256 hash(uint256S(strHash));
|
||||
uint256 hash(ParseHashV(request.params[0], "txid"));
|
||||
int n = request.params[1].get_int();
|
||||
COutPoint out(hash, n);
|
||||
bool fMempool = true;
|
||||
|
|
@ -1510,8 +1508,7 @@ static UniValue preciousblock(const JSONRPCRequest& request)
|
|||
+ HelpExampleRpc("preciousblock", "\"blockhash\"")
|
||||
);
|
||||
|
||||
std::string strHash = request.params[0].get_str();
|
||||
uint256 hash(uint256S(strHash));
|
||||
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
||||
CBlockIndex* pblockindex;
|
||||
|
||||
{
|
||||
|
|
@ -1546,8 +1543,7 @@ static UniValue invalidateblock(const JSONRPCRequest& request)
|
|||
+ HelpExampleRpc("invalidateblock", "\"blockhash\"")
|
||||
);
|
||||
|
||||
std::string strHash = request.params[0].get_str();
|
||||
uint256 hash(uint256S(strHash));
|
||||
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
||||
CValidationState state;
|
||||
|
||||
{
|
||||
|
|
@ -1586,8 +1582,7 @@ static UniValue reconsiderblock(const JSONRPCRequest& request)
|
|||
+ HelpExampleRpc("reconsiderblock", "\"blockhash\"")
|
||||
);
|
||||
|
||||
std::string strHash = request.params[0].get_str();
|
||||
uint256 hash(uint256S(strHash));
|
||||
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
||||
|
||||
{
|
||||
LOCK(cs_main);
|
||||
|
|
@ -1640,7 +1635,7 @@ static UniValue getchaintxstats(const JSONRPCRequest& request)
|
|||
LOCK(cs_main);
|
||||
pindex = chainActive.Tip();
|
||||
} else {
|
||||
uint256 hash = uint256S(request.params[1].get_str());
|
||||
uint256 hash(ParseHashV(request.params[1], "blockhash"));
|
||||
LOCK(cs_main);
|
||||
pindex = LookupBlockIndex(hash);
|
||||
if (!pindex) {
|
||||
|
|
@ -1814,8 +1809,7 @@ static UniValue getblockstats(const JSONRPCRequest& request)
|
|||
|
||||
pindex = chainActive[height];
|
||||
} else {
|
||||
const std::string strHash = request.params[0].get_str();
|
||||
const uint256 hash(uint256S(strHash));
|
||||
const uint256 hash(ParseHashV(request.params[0], "hash_or_height"));
|
||||
pindex = LookupBlockIndex(hash);
|
||||
if (!pindex) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
|
||||
|
|
@ -1853,6 +1847,10 @@ static UniValue getblockstats(const JSONRPCRequest& request)
|
|||
const bool do_calculate_weight = do_all || SetHasKeys(stats, "total_weight", "avgfeerate", "swtotal_weight", "avgfeerate", "feerate_percentiles", "minfeerate", "maxfeerate");
|
||||
const bool do_calculate_sw = do_all || SetHasKeys(stats, "swtxs", "swtotal_size", "swtotal_weight");
|
||||
|
||||
if (loop_inputs && !g_txindex) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "One or more of the selected stats requires -txindex enabled");
|
||||
}
|
||||
|
||||
CAmount maxfee = 0;
|
||||
CAmount maxfeerate = 0;
|
||||
CAmount minfee = MAX_MONEY;
|
||||
|
|
@ -1931,11 +1929,7 @@ static UniValue getblockstats(const JSONRPCRequest& request)
|
|||
}
|
||||
|
||||
if (loop_inputs) {
|
||||
|
||||
if (!g_txindex) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "One or more of the selected stats requires -txindex enabled");
|
||||
}
|
||||
CAmount tx_total_in = 0; // Only needed for bitcoin serialization
|
||||
CAmount tx_total_in = 0;
|
||||
for (const CTxIn& in : tx->vin) {
|
||||
if (in.m_is_pegin) {
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue