41 if (target < 1 || (
unsigned int)target > max_target) {
44 return (
unsigned int)target;
58 if (pb ==
nullptr || !pb->
nHeight)
71 int64_t maxTime = minTime;
72 for (
int i = 0; i < lookup; i++) {
75 minTime = std::min(time, minTime);
76 maxTime = std::max(time, maxTime);
80 if (minTime == maxTime)
84 int64_t timeDiff = maxTime - minTime;
92 throw std::runtime_error(
93 "getnetworkhashps ( nblocks height )\n" 94 "\nReturns the estimated network hashes per second based on the last n blocks.\n" 95 "Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n" 96 "Pass in [height] to estimate the network speed at the time when a certain block was found.\n" 98 "1. nblocks (numeric, optional, default=120) The number of blocks, or -1 for blocks since last difficulty change.\n" 99 "2. height (numeric, optional, default=-1) To estimate at the time of the given height.\n" 101 "x (numeric) Hashes per second estimated\n" 111 UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript,
int nGenerate, uint64_t nMaxTries,
bool keepScript)
113 static const int nInnerLoopCount = 0x10000;
120 nHeightEnd = nHeight+nGenerate;
122 unsigned int nExtraNonce = 0;
124 while (nHeight < nHeightEnd)
126 std::unique_ptr<CBlockTemplate> pblocktemplate(
BlockAssembler(
Params()).CreateNewBlock(coinbaseScript->reserveScript));
127 if (!pblocktemplate.get())
129 CBlock *pblock = &pblocktemplate->block;
138 if (nMaxTries == 0) {
141 if (pblock->
nNonce == nInnerLoopCount) {
144 std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(*pblock);
148 blockHashes.
push_back(pblock->GetHash().GetHex());
153 coinbaseScript->KeepScript();
162 throw std::runtime_error(
163 "generatetoaddress nblocks address (maxtries)\n" 164 "\nMine blocks immediately to a specified address (before the RPC call returns)\n" 166 "1. nblocks (numeric, required) How many blocks are generated immediately.\n" 167 "2. address (string, required) The address to send the newly generated raven to.\n" 168 "3. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n" 170 "[ blockhashes ] (array) hashes of blocks generated\n" 172 "\nGenerate 11 blocks to myaddress\n" 177 uint64_t nMaxTries = 1000000;
187 std::shared_ptr<CReserveScript> coinbaseScript = std::make_shared<CReserveScript>();
190 return generateBlocks(coinbaseScript, nGenerate, nMaxTries,
false);
196 throw std::runtime_error(
198 "\nReturns a json object containing mining-related information." 201 " \"blocks\": nnn, (numeric) The current block\n" 202 " \"currentblockweight\": nnn, (numeric) The last block weight\n" 203 " \"currentblocktx\": nnn, (numeric) The last block transaction\n" 204 " \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n" 205 " \"networkhashps\": nnn, (numeric) The network hashes per second\n" 206 " \"hashespersec\": nnn, (numeric) The hashes per second of built-in miner\n" 207 " \"pooledtx\": n (numeric) The size of the mempool\n" 208 " \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n" 209 " \"warnings\": \"...\" (string) any network and blockchain warnings\n" 210 " \"errors\": \"...\" (string) DEPRECATED. Same as warnings. Only shown when ravend is started with -deprecatedrpc=getmininginfo\n" 242 throw std::runtime_error(
243 "prioritisetransaction <txid> <dummy value> <fee delta>\n" 244 "Accepts the transaction into mined blocks at a higher (or lower) priority\n" 246 "1. \"txid\" (string, required) The transaction id.\n" 247 "2. dummy (numeric, optional) API-Compatibility for previous API. Must be zero or null.\n" 248 " DEPRECATED. For forward compatibility use named arguments and omit this parameter.\n" 249 "3. fee_delta (numeric, required) The fee value (in satoshis) to add (or subtract, if negative).\n" 250 " The fee is not actually paid, only the algorithm for selecting transactions into a block\n" 251 " considers the transaction as it would have paid a higher (or lower) fee.\n" 253 "true (boolean) Returns true\n" 284 if (strRejectReason.empty())
286 return strRejectReason;
294 std::string s = vbinfo.
name;
296 s.insert(s.begin(),
'!');
304 throw std::runtime_error(
305 "getblocktemplate ( TemplateRequest )\n" 306 "\nIf the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n" 307 "It returns data needed to construct a block to work on.\n" 308 "For full specification, see BIPs 22, 23, 9, and 145:\n" 309 " https://github.com/raven/bips/blob/master/bip-0022.mediawiki\n" 310 " https://github.com/raven/bips/blob/master/bip-0023.mediawiki\n" 311 " https://github.com/raven/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n" 312 " https://github.com/raven/bips/blob/master/bip-0145.mediawiki\n" 315 "1. template_request (json object, optional) A json object in the following spec\n" 317 " \"mode\":\"template\" (string, optional) This must be set to \"template\", \"proposal\" (see BIP 23), or omitted\n" 318 " \"capabilities\":[ (array, optional) A list of strings\n" 319 " \"support\" (string) client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'\n" 322 " \"rules\":[ (array, optional) A list of strings\n" 323 " \"support\" (string) client side supported softfork deployment\n" 331 " \"version\" : n, (numeric) The preferred block version\n" 332 " \"rules\" : [ \"rulename\", ... ], (array of strings) specific block rules that are to be enforced\n" 333 " \"vbavailable\" : { (json object) set of pending, supported versionbit (BIP 9) softfork deployments\n" 334 " \"rulename\" : bitnumber (numeric) identifies the bit number as indicating acceptance and readiness for the named softfork rule\n" 337 " \"vbrequired\" : n, (numeric) bit mask of versionbits the server requires set in submissions\n" 338 " \"previousblockhash\" : \"xxxx\", (string) The hash of current highest block\n" 339 " \"transactions\" : [ (array) contents of non-coinbase transactions that should be included in the next block\n" 341 " \"data\" : \"xxxx\", (string) transaction data encoded in hexadecimal (byte-for-byte)\n" 342 " \"txid\" : \"xxxx\", (string) transaction id encoded in little-endian hexadecimal\n" 343 " \"hash\" : \"xxxx\", (string) hash encoded in little-endian hexadecimal (including witness data)\n" 344 " \"depends\" : [ (array) array of numbers \n" 345 " n (numeric) transactions before this one (by 1-based index in 'transactions' list) that must be present in the final block if this one is\n" 348 " \"fee\": n, (numeric) difference in value between transaction inputs and outputs (in satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one\n" 349 " \"sigops\" : n, (numeric) total SigOps cost, as counted for purposes of block limits; if key is not present, sigop cost is unknown and clients MUST NOT assume it is zero\n" 350 " \"weight\" : n, (numeric) total transaction weight, as counted for purposes of block limits\n" 351 " \"required\" : true|false (boolean) if provided and true, this transaction must be in the final block\n" 355 " \"coinbaseaux\" : { (json object) data that should be included in the coinbase's scriptSig content\n" 356 " \"flags\" : \"xx\" (string) key name is to be ignored, and value included in scriptSig\n" 358 " \"coinbasevalue\" : n, (numeric) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in satoshis)\n" 359 " \"coinbasetxn\" : { ... }, (json object) information for coinbase transaction\n" 360 " \"target\" : \"xxxx\", (string) The hash target\n" 361 " \"mintime\" : xxx, (numeric) The minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT)\n" 362 " \"mutable\" : [ (array of string) list of ways the block template may be changed \n" 363 " \"value\" (string) A way the block template may be changed, e.g. 'time', 'transactions', 'prevblock'\n" 366 " \"noncerange\" : \"00000000ffffffff\",(string) A range of valid nonces\n" 367 " \"sigoplimit\" : n, (numeric) limit of sigops in blocks\n" 368 " \"sizelimit\" : n, (numeric) limit of block size\n" 369 " \"weightlimit\" : n, (numeric) limit of block weight\n" 370 " \"curtime\" : ttt, (numeric) current timestamp in seconds since epoch (Jan 1 1970 GMT)\n" 371 " \"bits\" : \"xxxxxxxx\", (string) compressed target of next block\n" 372 " \"height\" : n (numeric) The height of the next block\n" 382 std::string strMode =
"template";
384 std::set<std::string> setClientRules;
385 int64_t nMaxVersionPreVB = -1;
392 else if (modeval.
isNull())
400 if (strMode ==
"proposal")
403 if (!dataval.
isStr())
417 return "duplicate-invalid";
418 return "duplicate-inconclusive";
424 return "inconclusive-not-best-prevblk";
427 return BIP22ValidationResult(state);
432 for (
unsigned int i = 0; i < aClientRules.
size(); ++i) {
433 const UniValue& v = aClientRules[i];
434 setClientRules.insert(v.
get_str());
439 if (uvMaxVersion.
isNum()) {
440 nMaxVersionPreVB = uvMaxVersion.
get_int64();
445 if (strMode !=
"template")
457 static unsigned int nTransactionsUpdatedLast;
463 boost::system_time checktxtime;
464 unsigned int nTransactionsUpdatedLastLP;
469 std::string lpstr = lpval.
get_str();
471 hashWatchedChain.
SetHex(lpstr.substr(0, 64));
472 nTransactionsUpdatedLastLP =
atoi64(lpstr.substr(64));
478 nTransactionsUpdatedLastLP = nTransactionsUpdatedLast;
484 checktxtime = boost::get_system_time() + boost::posix_time::minutes(1);
486 boost::unique_lock<boost::mutex> lock(
csBestBlock);
494 checktxtime += boost::posix_time::seconds(10);
513 static int64_t nStart;
514 static std::unique_ptr<CBlockTemplate> pblocktemplate;
517 static bool fLastTemplateSupportsSegwit =
true;
520 fLastTemplateSupportsSegwit != fSupportsSegwit)
523 pindexPrev =
nullptr;
529 fLastTemplateSupportsSegwit = fSupportsSegwit;
538 pindexPrev = pindexPrevNew;
540 CBlock* pblock = &pblocktemplate->block;
544 UpdateTime(pblock, consensusParams, pindexPrev);
548 const bool fPreSegWit =
false;
553 std::map<uint256, int64_t> setTxIndex;
555 for (
const auto& it : pblock->
vtx) {
558 setTxIndex[txHash] = i++;
577 int index_in_template = i - 1;
578 entry.
push_back(Pair(
"fee", pblocktemplate->vTxFees[index_in_template]));
579 int64_t nTxSigOps = pblocktemplate->vTxSigOpsCost[index_in_template];
581 assert(nTxSigOps % WITNESS_SCALE_FACTOR == 0);
582 nTxSigOps /= WITNESS_SCALE_FACTOR;
584 entry.
push_back(Pair(
"sigops", nTxSigOps));
585 entry.
push_back(Pair(
"weight", GetTransactionWeight(tx)));
601 result.
push_back(Pair(
"capabilities", aCaps));
621 if (setClientRules.find(vbinfo.
name) == setClientRules.end()) {
634 if (setClientRules.find(vbinfo.
name) == setClientRules.end()) {
647 result.
push_back(Pair(
"vbavailable", vbavailable));
648 result.
push_back(Pair(
"vbrequired",
int(0)));
650 if (nMaxVersionPreVB >= 2) {
659 result.
push_back(Pair(
"transactions", transactions));
660 result.
push_back(Pair(
"coinbaseaux", aux));
661 result.
push_back(Pair(
"coinbasevalue", (int64_t)pblock->
vtx[0]->vout[0].nValue));
665 result.
push_back(Pair(
"mutable", aMutable));
666 result.
push_back(Pair(
"noncerange",
"00000000ffffffff"));
667 int64_t nSigOpLimit = MAX_BLOCK_SIGOPS_COST;
670 assert(nSigOpLimit % WITNESS_SCALE_FACTOR == 0);
671 nSigOpLimit /= WITNESS_SCALE_FACTOR;
672 assert(nSizeLimit % WITNESS_SCALE_FACTOR == 0);
673 nSizeLimit /= WITNESS_SCALE_FACTOR;
675 result.
push_back(Pair(
"sigoplimit", nSigOpLimit));
676 result.
push_back(Pair(
"sizelimit", nSizeLimit));
684 if (!pblocktemplate->vchCoinbaseCommitment.empty() && fSupportsSegwit) {
685 result.
push_back(Pair(
"default_witness_commitment",
HexStr(pblocktemplate->vchCoinbaseCommitment.begin(), pblocktemplate->vchCoinbaseCommitment.end())));
713 throw std::runtime_error(
714 "submitblock \"hexdata\" ( \"dummy\" )\n" 715 "\nAttempts to submit new block to network.\n" 716 "See https://en.raven.it/wiki/BIP_0022 for full specification.\n" 719 "1. \"hexdata\" (string, required) the hex-encoded block data to submit\n" 720 "2. \"dummy\" (optional) dummy value, for compatibility with BIP22. This value is ignored.\n" 728 std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
729 CBlock& block = *blockptr;
734 if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) {
739 bool fBlockPresent =
false;
749 return "duplicate-invalid";
752 fBlockPresent =
true;
758 BlockMap::iterator mi =
mapBlockIndex.find(block.hashPrevBlock);
769 if (fAccepted && !sc.found) {
770 return "duplicate-inconclusive";
775 return "inconclusive";
777 return BIP22ValidationResult(sc.state);
783 throw std::runtime_error(
784 "estimatefee nblocks\n" 785 "\nDEPRECATED. Please use estimatesmartfee for more intelligent estimates." 786 "\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n" 787 "confirmation within nblocks blocks. Uses virtual transaction size of transaction\n" 788 "as defined in BIP 141 (witness data is discounted).\n" 790 "1. nblocks (numeric, required)\n" 792 "n (numeric) estimated fee-per-kilobyte\n" 794 "A negative value is returned if not enough transactions and blocks\n" 795 "have been observed to make an estimate.\n" 796 "-1 is always returned for nblocks == 1 as it is impossible to calculate\n" 797 "a fee that is high enough to get reliably included in the next block.\n" 804 "To use estimatefee in v0.16, restart ravend with -deprecatedrpc=estimatefee.\n" 805 "Projects should transition to using estimatesmartfee before upgrading to v0.17");
824 throw std::runtime_error(
825 "estimatesmartfee conf_target (\"estimate_mode\")\n" 826 "\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n" 827 "confirmation within conf_target blocks if possible and return the number of blocks\n" 828 "for which the estimate is valid. Uses virtual transaction size as defined\n" 829 "in BIP 141 (witness data is discounted).\n" 831 "1. conf_target (numeric) Confirmation target in blocks (1 - 1008)\n" 832 "2. \"estimate_mode\" (string, optional, default=CONSERVATIVE) The fee estimate mode.\n" 833 " Whether to return a more conservative estimate which also satisfies\n" 834 " a longer history. A conservative estimate potentially returns a\n" 835 " higher feerate and is more likely to be sufficient for the desired\n" 836 " target, but is not as responsive to short term drops in the\n" 837 " prevailing fee market. Must be one of:\n" 838 " \"UNSET\" (defaults to CONSERVATIVE)\n" 840 " \"CONSERVATIVE\"\n" 843 " \"feerate\" : x.x, (numeric, optional) estimate fee rate in " +
CURRENCY_UNIT +
"/kB\n" 844 " \"errors\": [ str... ] (json array of strings, optional) Errors encountered during processing\n" 845 " \"blocks\" : n (numeric) block number where estimate was found\n" 848 "The request target will be clamped between 2 and the highest target\n" 849 "fee estimation is able to return based on how long it has been running.\n" 850 "An error is returned if not enough transactions and blocks\n" 851 "have been observed to make an estimate for any number of blocks.\n" 859 bool conservative =
true;
875 errors.
push_back(
"Insufficient data or no feerate found");
876 result.
push_back(Pair(
"errors", errors));
885 throw std::runtime_error(
886 "estimaterawfee conf_target (threshold)\n" 887 "\nWARNING: This interface is unstable and may disappear or change!\n" 888 "\nWARNING: This is an advanced API call that is tightly coupled to the specific\n" 889 " implementation of fee estimation. The parameters it can be called with\n" 890 " and the results it returns will change if the internal implementation changes.\n" 891 "\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n" 892 "confirmation within conf_target blocks if possible. Uses virtual transaction size as\n" 893 "defined in BIP 141 (witness data is discounted).\n" 895 "1. conf_target (numeric) Confirmation target in blocks (1 - 1008)\n" 896 "2. threshold (numeric, optional) The proportion of transactions in a given feerate range that must have been\n" 897 " confirmed within conf_target in order to consider those feerates as high enough and proceed to check\n" 898 " lower buckets. Default: 0.95\n" 901 " \"short\" : { (json object, optional) estimate for short time horizon\n" 902 " \"feerate\" : x.x, (numeric, optional) estimate fee rate in " +
CURRENCY_UNIT +
"/kB\n" 903 " \"decay\" : x.x, (numeric) exponential decay (per block) for historical moving average of confirmation data\n" 904 " \"scale\" : x, (numeric) The resolution of confirmation targets at this time horizon\n" 905 " \"pass\" : { (json object, optional) information about the lowest range of feerates to succeed in meeting the threshold\n" 906 " \"startrange\" : x.x, (numeric) start of feerate range\n" 907 " \"endrange\" : x.x, (numeric) end of feerate range\n" 908 " \"withintarget\" : x.x, (numeric) number of txs over history horizon in the feerate range that were confirmed within target\n" 909 " \"totalconfirmed\" : x.x, (numeric) number of txs over history horizon in the feerate range that were confirmed at any point\n" 910 " \"inmempool\" : x.x, (numeric) current number of txs in mempool in the feerate range unconfirmed for at least target blocks\n" 911 " \"leftmempool\" : x.x, (numeric) number of txs over history horizon in the feerate range that left mempool unconfirmed after target\n" 913 " \"fail\" : { ... }, (json object, optional) information about the highest range of feerates to fail to meet the threshold\n" 914 " \"errors\": [ str... ] (json array of strings, optional) Errors encountered during processing\n" 916 " \"medium\" : { ... }, (json object, optional) estimate for medium time horizon\n" 917 " \"long\" : { ... } (json object) estimate for long time horizon\n" 920 "Results are returned for any horizon which tracks blocks up to the confirmation target.\n" 928 double threshold = 0.95;
932 if (threshold < 0 || threshold > 1) {
968 horizon_result.
push_back(Pair(
"pass", passbucket));
975 horizon_result.
push_back(Pair(
"fail", failbucket));
976 errors.
push_back(
"Insufficient data or no feerate found which meets threshold");
977 horizon_result.
push_back(Pair(
"errors",errors));
988 throw std::runtime_error(
990 "\nReturn if the server is set to generate coins or not. The default is false.\n" 991 "It is set with the command line argument -gen (or " + std::string(
RAVEN_CONF_FILENAME) +
" setting gen)\n" 992 "It can also be set with the setgenerate call.\n" 994 "true|false (boolean) If the server is set to generate coins or not\n" 1007 throw std::runtime_error(
1008 "setgenerate generate ( genproclimit )\n" 1009 "\nSet 'generate' true or false to turn generation on or off.\n" 1010 "Generation is limited to 'genproclimit' processors, -1 is unlimited.\n" 1011 "See the getgenerate call for the current setting.\n" 1013 "1. generate (boolean, required) Set to true to turn on generation, false to turn off.\n" 1014 "2. genproclimit (numeric, optional) Set the processor limit for when generation is on. Can be -1 for unlimited.\n" 1016 "\nSet the generation on with a limit of one processor\n" 1018 "\nCheck the setting\n" 1020 "\nTurn off generation\n" 1022 "\nUsing json rpc\n" 1030 bool fGenerate =
true;
1034 int nGenProcLimit =
gArgs.
GetArg(
"-genproclimit", DEFAULT_GENERATE_THREADS);
1038 if (nGenProcLimit == 0)
1048 nGenProcLimit = nGenProcLimit >= 0 ? nGenProcLimit : numCores;
1049 std::string msg = std::to_string(nGenProcLimit) +
" of " + std::to_string(numCores);
1061 {
"mining",
"submitblock", &
submitblock, {
"hexdata",
"dummy"} },
1064 {
"generating",
"getgenerate", &
getgenerate, {} },
1065 {
"generating",
"setgenerate", &
setgenerate, {
"generate",
"genproclimit"} },
1067 {
"generating",
"generatetoaddress", &
generatetoaddress, {
"nblocks",
"address",
"maxtries"} },
1069 {
"util",
"estimatefee", &
estimatefee, {
"nblocks"} },
1070 {
"util",
"estimatesmartfee", &
estimatesmartfee, {
"conf_target",
"estimate_mode"} },
1072 {
"hidden",
"estimaterawfee", &
estimaterawfee, {
"conf_target",
"threshold"} },
1077 for (
unsigned int vcidx = 0; vcidx <
ARRAYLEN(commands); vcidx++)
arith_uint256 nChainWork
(memory only) Total amount of work (expected number of hashes) in the chain up to and including this ...
UniValue estimaterawfee(const JSONRPCRequest &request)
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
const char *const RAVEN_CONF_FILENAME
bool DecodeHexBlk(CBlock &, const std::string &strHexBlk)
Ran out of memory during operation.
uint256 GetWitnessHash() const
Raven RPC command dispatcher.
int64_t GetBlockTime() const
bool FeeModeFromString(const std::string &mode_string, FeeEstimateMode &fee_estimate_mode)
CBlockIndex * pprev
pointer to the index of the predecessor of this block
UniValue setgenerate(const JSONRPCRequest &request)
uint32_t nStatus
Verification status of this block. See enum BlockStatus.
int64_t UpdateTime(CBlockHeader *pblock, const Consensus::Params &consensusParams, const CBlockIndex *pindexPrev)
bool IsRPCRunning()
Query whether RPC is running.
bool gbt_force
Whether GBT clients can safely ignore this rule in simplified usage.
unsigned int GetMaxBlockWeight()
UniValue prioritisetransaction(const JSONRPCRequest &request)
CWaitableCriticalSection csBestBlock
UniValue GetNetworkHashPS(int lookup, int height)
Return average network hashes per second based on the last 'lookup' blocks, or from the last difficul...
void RegisterMiningRPCCommands(CRPCTable &t)
Register mining RPC commands.
UniValue estimatesmartfee(const JSONRPCRequest &request)
int Height() const
Return the maximal height in the chain.
CCriticalSection cs_main
Global state.
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
CTxDestination DecodeDestination(const std::string &str)
std::string HexStr(const T itbegin, const T itend, bool fSpaces=false)
const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS]
UniValue estimatefee(const JSONRPCRequest &request)
void BlockChecked(const CBlock &block, const CValidationState &stateIn) override
Notifies listeners of a block validation result.
std::string StringForFeeEstimateHorizon(FeeEstimateHorizon horizon)
const std::string & get_str() const
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
const std::string CURRENCY_UNIT
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
double GetDifficulty(const CBlockIndex *blockindex)
Get the difficulty of the net wrt to the given block index, or the chain tip if not provided...
UniValue getmininginfo(const JSONRPCRequest &request)
int64_t get_int64() const
uint32_t VersionBitsMask(const Consensus::Params ¶ms, Consensus::DeploymentPos pos)
void UnregisterValidationInterface(CValidationInterface *pwalletIn)
Unregister a wallet from core.
std::string GetWarnings(const std::string &strFor)
Format a string that describes several potential problems detected by the core.
UniValue ValueFromAmount(const CAmount &amount, const int8_t units)
submitblock_StateCatcher(const uint256 &hashIn)
bool ProcessNewBlock(const CChainParams &chainparams, const std::shared_ptr< const CBlock > pblock, bool fForceProcessing, bool *fNewBlock)
Process an incoming block.
bool SoftSetArg(const std::string &strArg, const std::string &strValue)
Set an argument if it doesn't already have a value.
bool appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
void RPCTypeCheck(const UniValue ¶ms, const std::list< UniValue::VType > &typesExpected, bool fAllowNull)
Type-check arguments; throws JSONRPCError if wrong type given.
UniValue getblocktemplate(const JSONRPCRequest &request)
const std::vector< CTxIn > vin
Invalid, missing or duplicate parameter.
int GenerateRavens(bool fGenerate, int nThreads, const CChainParams &chainparams)
const UniValue & find_value(const UniValue &obj, const std::string &name)
uint64_t nLastBlockWeight
UniValue generateBlocks(std::shared_ptr< CReserveScript > coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript)
Generate blocks (mine)
int64_t CAmount
Amount in corbies (Can be negative)
uint256 GetBlockHash() const
General error during transaction or block submission.
bool IsValid(enum BlockStatus nUpTo=BLOCK_VALID_TRANSACTIONS) const
Check whether this block index entry is valid up to the passed validity level.
CBlockPolicyEstimator feeEstimator
bool push_back(const UniValue &val)
bool MineBlocksOnDemand() const
Make miner stop after a block is found.
Scripts & signatures ok. Implies all parents are also at least SCRIPTS.
#define LEAVE_CRITICAL_SECTION(cs)
CFeeRate estimateRawFee(int confTarget, double successThreshold, FeeEstimateHorizon horizon, EstimationResult *result=nullptr) const
Return a specific fee estimate calculation with a given success threshold and time horizon...
An input of a transaction.
const uint256 & GetHash() const
CFeeRate estimateSmartFee(int confTarget, FeeCalculation *feeCalc, bool conservative) const
Estimate feerate needed to get be included in a block within confTarget blocks.
void RPCTypeCheckArgument(const UniValue &value, UniValue::VType typeExpected)
Type-check one argument; throws JSONRPCError if wrong type given.
std::string GetRejectReason() const
Unexpected type was passed as parameter.
bool IsInitialBlockDownload()
Check whether we are doing an initial block download (synchronizing from disk or network) ...
Generate a new block, without valid proof-of-work.
CChain chainActive
The currently-connected chain of blocks (protected by cs_main).
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Raven scriptPubKey for the given CTxDestination.
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
UniValue getgenerate(const JSONRPCRequest &request)
Parameters that influence chain consensus.
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params ¶ms)
Check whether a block hash satisfies the proof-of-work requirement specified by nBits.
CScript COINBASE_FLAGS
Constant stuff for coinbase transactions we create:
bool IsDeprecatedRPCEnabled(const std::string &method)
256-bit unsigned big integer.
int64_t GetMedianTimePast() const
VersionBitsCache versionbitscache
RPC method is deprecated.
int64_t DifficultyAdjustmentInterval() const
void RegisterValidationInterface(CValidationInterface *pwalletIn)
Register a wallet to receive updates from core.
CFeeRate estimateFee(int confTarget) const
DEPRECATED.
void IncrementExtraNonce(CBlock *pblock, const CBlockIndex *pindexPrev, unsigned int &nExtraNonce)
Modify the extranonce in a block.
#define ENTER_CRITICAL_SECTION(cs)
unsigned int HighestTargetTracked(FeeEstimateHorizon horizon) const
Calculation of highest target that estimates are tracked for.
std::vector< CTransactionRef > vtx
uint256 ParseHashStr(const std::string &, const std::string &strName)
const char * name
Deployment name.
The block chain is a tree shaped structure starting with the genesis block at the root...
const CChainParams & Params()
Return the currently selected parameters.
Serialized script, used inside transaction inputs and outputs.
const UniValue & get_obj() const
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
bool TestBlockValidity(CValidationState &state, const CChainParams &chainparams, const CBlock &block, CBlockIndex *pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot)
Check a block is completely valid from start to finish (only works on top of our current best block...
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
std::string GetHex() const
int64_t atoi64(const char *psz)
unsigned int ParseConfirmTarget(const UniValue &value)
Check bounds on a command line confirm target.
std::string EncodeHexTx(const CTransaction &tx, const int serializeFlags=0)
Fee rate in satoshis per kilobyte: CAmount / kB.
std::unique_ptr< CConnman > g_connman
const UniValue NullUniValue
std::string i64tostr(int64_t n)
unsigned int GetTransactionsUpdated() const
arith_uint256 & SetCompact(uint32_t nCompact, bool *pfNegative=nullptr, bool *pfOverflow=nullptr)
The "compact" format is a representation of a whole number N using an unsigned 32bit number similar t...
std::string gbt_vb_name(const Consensus::DeploymentPos pos)
UniValue generatetoaddress(const JSONRPCRequest &request)
UniValue JSONRPCError(int code, const std::string &message)
No valid connection manager instance found.
std::string GetHex() const
Use default settings based on other criteria.
int64_t GetTime()
GetTimeMicros() and GetTimeMillis() both return the system time, but in different units...
The basic transaction that is broadcasted on the network and contained in blocks. ...
int nHeight
height of the entry in the chain. The genesis block has height 0
UniValue submitblock(const JSONRPCRequest &request)
const Consensus::Params & GetConsensus() const
int bit
Bit position to select the particular bit in nVersion.
UniValue getnetworkhashps(const JSONRPCRequest &request)
Still downloading initial blocks.
unsigned int GetMaxBlockSerializedSize()
void SetHex(const char *psz)
ThresholdState VersionBitsState(const CBlockIndex *pindexPrev, const Consensus::Params ¶ms, Consensus::DeploymentPos pos, VersionBitsCache &cache)
std::unique_ptr< CBlockTemplate > CreateNewBlock(const CScript &scriptPubKeyIn, bool fMineWitnessTx=true)
Construct a new block template with coinbase to scriptPubKeyIn.
void PrioritiseTransaction(const uint256 &hash, const CAmount &nFeeDelta)
Affect CreateNewBlock prioritisation of transactions.
CAmount GetFeePerK() const
Return the fee in satoshis for a size of 1000 bytes.
void UpdateUncommittedBlockStructures(CBlock &block, const CBlockIndex *pindexPrev, const Consensus::Params &consensusParams)
Update uncommitted block structures (currently: only the witness nonce).
BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS]
std::string itostr(int n)
Error parsing or validating structure in raw format.
CConditionVariable cvBlockChange