31 #include <libgpusolver/libgpusolver.h> 32 #include <libgpusolver/libclwrapper.h> 42 #include <boost/assign/list_of.hpp> 43 #include <boost/shared_ptr.hpp> 51 if (target < 1 || (
unsigned int)target > max_target) {
54 return (
unsigned int)target;
68 if (pb ==
nullptr || !pb->
nHeight)
81 int64_t maxTime = minTime;
82 for (
int i = 0; i < lookup; i++) {
90 if (minTime == maxTime)
94 int64_t timeDiff = maxTime - minTime;
104 throw std::runtime_error(
105 "getnetworkhashps ( nblocks height )\n" 106 "\nReturns the estimated network hashes per second based on the last n blocks.\n" 107 "Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n" 108 "Pass in [height] to estimate the network speed at the time when a certain block was found.\n" 110 "1. nblocks (numeric, optional, default=120) The number of blocks, or -1 for blocks since last difficulty change.\n" 111 "2. height (numeric, optional, default=-1) To estimate at the time of the given height.\n" 113 "x (numeric) Hashes per second estimated\n" 124 #if defined(ENABLE_GPU) && defined(USE_CUDA) 125 #include <../cuda/eqcuda.hpp> 127 static bool cb_cancel()
132 static bool cb_validate(std::vector<unsigned char> sols,
unsigned char *pblockdata,
int thrid)
151 LogPrintf(
"CheckBlockHeader(): Equihash solution invalid at height %d\n", pblock->
nHeight);
158 CBlock dumpBlock(*pblock);
172 UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript,
int nGenerate, uint64_t nMaxTries,
bool keepScript)
174 static const int nInnerLoopCount = 0x10000;
183 nHeightEnd = nHeight+nGenerate;
185 unsigned int nExtraNonce = 0;
199 uint8_t * header = NULL;
209 while (nHeight < nHeightEnd)
213 std::unique_ptr<CBlockTemplate> pblocktemplate(
BlockAssembler(
Params()).CreateNewBlock(coinbaseScript->reserveScript,
true,
nullptr, 0,
GetAdjustedTime()+POW_MINER_MAX_TIME));
215 if (!pblocktemplate.get())
218 CBlock *pblock = &pblocktemplate->block;
227 LogPrintf(
"Using Equihash solver with n = %u, k = %u\n", n, k);
232 while (nMaxTries > 0 && (
int)pblock->
nNonce.
GetUint64(0) < nInnerLoopCount &&
250 crypto_generichash_blake2b_state eh_state;
264 crypto_generichash_blake2b_update(&eh_state, (
unsigned char*)&ss[0], ss.
size());
267 while ( nMaxTries > 0 && nCounter < nInnerLoopCount )
269 crypto_generichash_blake2b_state curr_state;
270 curr_state = eh_state;
282 header[ headerlen-32 + i] = pblock->
nNonce.
begin()[i];
288 curr_state = eh_state;
293 std::function<bool(std::vector<unsigned char>)> validBlock =
294 [&pblock](std::vector<unsigned char> soln)
306 found = g_solver->
run(n, k, header, headerlen, pblock->
nNonce, validBlock,
false, curr_state);
319 if (nCounter == nInnerLoopCount)
322 std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(*pblock);
326 blockHashes.
push_back(pblock->GetHash().GetHex());
331 coinbaseScript->KeepScript();
349 throw std::runtime_error(
350 "generatetoaddress nblocks address (maxtries)\n" 351 "\nMine blocks immediately to a specified address (before the RPC call returns)\n" 353 "1. nblocks (numeric, required) How many blocks are generated immediately.\n" 354 "2. address (string, required) The address to send the newly generated fabcoin to.\n" 355 "3. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n" 357 "[ blockhashes ] (array) hashes of blocks generated\n" 359 "\nGenerate 11 blocks to myaddress\n" 367 uint64_t nMaxTries = 1000000;
376 std::shared_ptr<CReserveScript> coinbaseScript = std::make_shared<CReserveScript>();
379 return generateBlocks(coinbaseScript, nGenerate, nMaxTries,
false);
385 throw std::runtime_error(
387 "\nReturns a json object containing mining-related information." 390 " \"blocks\": nnn, (numeric) The current block\n" 391 " \"currentblocksize\": nnn, (numeric) The last block size\n" 392 " \"currentblockweight\": nnn, (numeric) The last block weight\n" 393 " \"currentblocktx\": nnn, (numeric) The last block transaction\n" 394 " \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n" 395 " \"errors\": \"...\" (string) Current errors\n" 396 " \"networkhashps\": nnn, (numeric) The network hashes per second\n" 397 " \"pooledtx\": n (numeric) The size of the mempool\n" 398 " \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n" 425 throw std::runtime_error(
426 "prioritisetransaction <txid> <dummy value> <fee delta>\n" 427 "Accepts the transaction into mined blocks at a higher (or lower) priority\n" 429 "1. \"txid\" (string, required) The transaction id.\n" 430 "2. dummy (numeric, optional) API-Compatibility for previous API. Must be zero or null.\n" 431 " DEPRECATED. For forward compatibility use named arguments and omit this parameter.\n" 432 "3. fee_delta (numeric, required) The fee value (in liu) to add (or subtract, if negative).\n" 433 " The fee is not actually paid, only the algorithm for selecting transactions into a block\n" 434 " considers the transaction as it would have paid a higher (or lower) fee.\n" 436 "true (boolean) Returns true\n" 467 if (strRejectReason.empty())
469 return strRejectReason;
477 std::string s = vbinfo.
name;
479 s.insert(s.begin(),
'!');
487 throw std::runtime_error(
488 "getblocktemplate ( TemplateRequest )\n" 489 "\nIf the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n" 490 "It returns data needed to construct a block to work on.\n" 491 "For full specification, see BIPs 22, 23, 9, and 145:\n" 492 " https://github.com/fabcoin/bips/blob/master/bip-0022.mediawiki\n" 493 " https://github.com/fabcoin/bips/blob/master/bip-0023.mediawiki\n" 494 " https://github.com/fabcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n" 495 " https://github.com/fabcoin/bips/blob/master/bip-0145.mediawiki\n" 498 "1. template_request (json object, optional) A json object in the following spec\n" 500 " \"mode\":\"template\" (string, optional) This must be set to \"template\", \"proposal | proposal_legacy \", or omitted\n" 501 " \"capabilities\":[ (array, optional) A list of strings\n" 502 " \"support\" (string) client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'\n" 505 " \"rules\":[ (array, optional) A list of strings\n" 506 " \"support\" (string) client side supported softfork deployment\n" 514 " \"version\" : n, (numeric) The preferred block version\n" 515 " \"rules\" : [ \"rulename\", ... ], (array of strings) specific block rules that are to be enforced\n" 516 " \"vbavailable\" : { (json object) set of pending, supported versionbit (BIP 9) softfork deployments\n" 517 " \"rulename\" : bitnumber (numeric) identifies the bit number as indicating acceptance and readiness for the named softfork rule\n" 520 " \"vbrequired\" : n, (numeric) bit mask of versionbits the server requires set in submissions\n" 521 " \"previousblockhash\" : \"xxxx\", (string) The hash of current highest block\n" 522 " \"transactions\" : [ (array) contents of non-coinbase transactions that should be included in the next block\n" 524 " \"data\" : \"xxxx\", (string) transaction data encoded in hexadecimal (byte-for-byte)\n" 525 " \"txid\" : \"xxxx\", (string) transaction id encoded in little-endian hexadecimal\n" 526 " \"hash\" : \"xxxx\", (string) hash encoded in little-endian hexadecimal (including witness data)\n" 527 " \"depends\" : [ (array) array of numbers \n" 528 " 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" 531 " \"fee\": n, (numeric) difference in value between transaction inputs and outputs (in lius); 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" 532 " \"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" 533 " \"weight\" : n, (numeric) total transaction weight, as counted for purposes of block limits\n" 534 " \"required\" : true|false (boolean) if provided and true, this transaction must be in the final block\n" 538 " \"coinbaseaux\" : { (json object) data that should be included in the coinbase's scriptSig content\n" 539 " \"flags\" : \"xx\" (string) key name is to be ignored, and value included in scriptSig\n" 541 " \"coinbasevalue\" : n, (numeric) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in lius)\n" 542 " \"coinbasetxn\" : { ... }, (json object) information for coinbase transaction\n" 543 " \"target\" : \"xxxx\", (string) The hash target\n" 544 " \"mintime\" : xxx, (numeric) The minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT)\n" 545 " \"mutable\" : [ (array of string) list of ways the block template may be changed \n" 546 " \"value\" (string) A way the block template may be changed, e.g. 'time', 'transactions', 'prevblock'\n" 549 " \"noncerange\" : \"00000000ffffffff\",(string) A range of valid nonces\n" 550 " \"sigoplimit\" : n, (numeric) limit of sigops in blocks\n" 551 " \"sizelimit\" : n, (numeric) limit of block size\n" 552 " \"weightlimit\" : n, (numeric) limit of block weight\n" 553 " \"curtime\" : ttt, (numeric) current timestamp in seconds since epoch (Jan 1 1970 GMT)\n" 554 " \"bits\" : \"xxxxxxxx\", (string) compressed target of next block\n" 555 " \"height\" : n (numeric) The height of the next block\n" 565 std::string strMode =
"template";
567 std::set<std::string> setClientRules;
568 int64_t nMaxVersionPreVB = -1;
575 else if (modeval.
isNull())
583 if (strMode ==
"proposal" || strMode ==
"proposal_legacy" )
586 if (!dataval.
isStr())
602 return "duplicate-invalid";
603 return "duplicate-inconclusive";
609 return "inconclusive-not-best-prevblk";
611 return "inconclusive-bad-height";
614 return BIP22ValidationResult(state);
619 for (
unsigned int i = 0; i < aClientRules.
size(); ++i) {
620 const UniValue& v = aClientRules[i];
621 setClientRules.insert(v.
get_str());
626 if (uvMaxVersion.
isNum()) {
627 nMaxVersionPreVB = uvMaxVersion.
get_int64();
632 if (strMode !=
"template")
644 static unsigned int nTransactionsUpdatedLast;
650 boost::system_time checktxtime;
651 unsigned int nTransactionsUpdatedLastLP;
656 std::string lpstr = lpval.
get_str();
658 hashWatchedChain.
SetHex(lpstr.substr(0, 64));
659 nTransactionsUpdatedLastLP =
atoi64(lpstr.substr(64));
665 nTransactionsUpdatedLastLP = nTransactionsUpdatedLast;
671 checktxtime = boost::get_system_time() + boost::posix_time::minutes(1);
673 boost::unique_lock<boost::mutex> lock(
csBestBlock);
681 checktxtime += boost::posix_time::seconds(10);
696 bool fSupportsSegwit = setClientRules.find(segwit_info.
name) != setClientRules.end();
700 static int64_t nStart;
701 static std::unique_ptr<CBlockTemplate> pblocktemplate;
704 static bool fLastTemplateSupportsSegwit =
true;
707 fLastTemplateSupportsSegwit != fSupportsSegwit)
710 pindexPrev =
nullptr;
716 fLastTemplateSupportsSegwit = fSupportsSegwit;
725 pindexPrev = pindexPrevNew;
727 CBlock* pblock = &pblocktemplate->block;
731 UpdateTime(pblock, consensusParams, pindexPrev);
741 std::map<uint256, int64_t> setTxIndex;
743 for (
const auto& it : pblock->
vtx) {
746 setTxIndex[txHash] = i++;
765 int index_in_template = i - 1;
766 entry.
push_back(
Pair(
"fee", pblocktemplate->vTxFees[index_in_template]));
767 int64_t nTxSigOps = pblocktemplate->vTxSigOpsCost[index_in_template];
769 assert(nTxSigOps % WITNESS_SCALE_FACTOR == 0);
770 nTxSigOps /= WITNESS_SCALE_FACTOR;
809 if (setClientRules.find(vbinfo.
name) == setClientRules.end()) {
822 if (setClientRules.find(vbinfo.
name) == setClientRules.end()) {
838 if (nMaxVersionPreVB >= 2) {
849 result.
push_back(
Pair(
"coinbasevalue", (int64_t)pblock->
vtx[0]->vout[0].nValue));
855 int64_t nSigOpLimit = MAX_BLOCK_SIGOPS_COST;
856 int64_t nSizeLimit = MAX_BLOCK_SERIALIZED_SIZE;
858 assert(nSigOpLimit % WITNESS_SCALE_FACTOR == 0);
859 nSigOpLimit /= WITNESS_SCALE_FACTOR;
860 assert(nSizeLimit % WITNESS_SCALE_FACTOR == 0);
861 nSizeLimit /= WITNESS_SCALE_FACTOR;
866 result.
push_back(
Pair(
"weightlimit", (int64_t)MAX_BLOCK_WEIGHT));
872 if (!pblocktemplate->vchCoinbaseCommitment.empty() && fSupportsSegwit) {
873 result.
push_back(
Pair(
"default_witness_commitment",
HexStr(pblocktemplate->vchCoinbaseCommitment.begin(), pblocktemplate->vchCoinbaseCommitment.end())));
901 throw std::runtime_error(
902 "submitblock \"hexdata\" ( \"dummy\" )\n" 903 "\nAttempts to submit new block to network.\n" 904 "See https://en.fabcoin.it/wiki/BIP_0022 for full specification.\n" 907 "1. \"hexdata\" (string, required) the hex-encoded block data to submit\n" 908 "2. \"dummy\" (optional) dummy value, for compatibility with BIP22. This value is ignored.\n" 916 std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
917 CBlock& block = *blockptr;
923 if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) {
928 bool fBlockPresent =
false;
938 return "duplicate-invalid";
941 fBlockPresent =
true;
947 BlockMap::iterator mi =
mapBlockIndex.find(block.hashPrevBlock);
958 if (fAccepted && !sc.found) {
959 return "duplicate-inconclusive";
964 return "inconclusive";
966 return BIP22ValidationResult(sc.state);
972 throw std::runtime_error(
973 "getblocksubsidy height\n" 974 "\nReturns block subsidy reward of block at index provided.\n" 976 "1. height (numeric, optional) The block height. If not provided, defaults to the current height of the chain.\n" 979 "\"miner\": n, (numeric) The mining reward amount in lius.\n" 980 "\"founders\": f, (numeric) Always 0, for Zcash mining compatibility.\n" 1006 throw std::runtime_error(
1007 "estimatefee nblocks\n" 1008 "\nDEPRECATED. Please use estimatesmartfee for more intelligent estimates." 1009 "\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n" 1010 "confirmation within nblocks blocks. Uses virtual transaction size of transaction\n" 1011 "as defined in BIP 141 (witness data is discounted).\n" 1013 "1. nblocks (numeric, required)\n" 1015 "n (numeric) estimated fee-per-kilobyte\n" 1017 "A negative value is returned if not enough transactions and blocks\n" 1018 "have been observed to make an estimate.\n" 1019 "-1 is always returned for nblocks == 1 as it is impossible to calculate\n" 1020 "a fee that is high enough to get reliably included in the next block.\n" 1041 throw std::runtime_error(
1042 "estimatesmartfee conf_target (\"estimate_mode\")\n" 1043 "\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n" 1044 "confirmation within conf_target blocks if possible and return the number of blocks\n" 1045 "for which the estimate is valid. Uses virtual transaction size as defined\n" 1046 "in BIP 141 (witness data is discounted).\n" 1048 "1. conf_target (numeric) Confirmation target in blocks (1 - 1008)\n" 1049 "2. \"estimate_mode\" (string, optional, default=CONSERVATIVE) The fee estimate mode.\n" 1050 " Whether to return a more conservative estimate which also satisfies\n" 1051 " a longer history. A conservative estimate potentially returns a\n" 1052 " higher feerate and is more likely to be sufficient for the desired\n" 1053 " target, but is not as responsive to short term drops in the\n" 1054 " prevailing fee market. Must be one of:\n" 1055 " \"UNSET\" (defaults to CONSERVATIVE)\n" 1057 " \"CONSERVATIVE\"\n" 1060 " \"feerate\" : x.x, (numeric, optional) estimate fee-per-kilobyte (in FAB)\n" 1061 " \"errors\": [ str... ] (json array of strings, optional) Errors encountered during processing\n" 1062 " \"blocks\" : n (numeric) block number where estimate was found\n" 1065 "The request target will be clamped between 2 and the highest target\n" 1066 "fee estimation is able to return based on how long it has been running.\n" 1067 "An error is returned if not enough transactions and blocks\n" 1068 "have been observed to make an estimate for any number of blocks.\n" 1076 bool conservative =
true;
1092 errors.
push_back(
"Insufficient data or no feerate found");
1102 throw std::runtime_error(
1103 "estimaterawfee conf_target (threshold)\n" 1104 "\nWARNING: This interface is unstable and may disappear or change!\n" 1105 "\nWARNING: This is an advanced API call that is tightly coupled to the specific\n" 1106 " implementation of fee estimation. The parameters it can be called with\n" 1107 " and the results it returns will change if the internal implementation changes.\n" 1108 "\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n" 1109 "confirmation within conf_target blocks if possible. Uses virtual transaction size as\n" 1110 "defined in BIP 141 (witness data is discounted).\n" 1112 "1. conf_target (numeric) Confirmation target in blocks (1 - 1008)\n" 1113 "2. threshold (numeric, optional) The proportion of transactions in a given feerate range that must have been\n" 1114 " confirmed within conf_target in order to consider those feerates as high enough and proceed to check\n" 1115 " lower buckets. Default: 0.95\n" 1118 " \"short\" : { (json object, optional) estimate for short time horizon\n" 1119 " \"feerate\" : x.x, (numeric, optional) estimate fee-per-kilobyte (in FAB)\n" 1120 " \"decay\" : x.x, (numeric) exponential decay (per block) for historical moving average of confirmation data\n" 1121 " \"scale\" : x, (numeric) The resolution of confirmation targets at this time horizon\n" 1122 " \"pass\" : { (json object, optional) information about the lowest range of feerates to succeed in meeting the threshold\n" 1123 " \"startrange\" : x.x, (numeric) start of feerate range\n" 1124 " \"endrange\" : x.x, (numeric) end of feerate range\n" 1125 " \"withintarget\" : x.x, (numeric) number of txs over history horizon in the feerate range that were confirmed within target\n" 1126 " \"totalconfirmed\" : x.x, (numeric) number of txs over history horizon in the feerate range that were confirmed at any point\n" 1127 " \"inmempool\" : x.x, (numeric) current number of txs in mempool in the feerate range unconfirmed for at least target blocks\n" 1128 " \"leftmempool\" : x.x, (numeric) number of txs over history horizon in the feerate range that left mempool unconfirmed after target\n" 1130 " \"fail\" : { ... }, (json object, optional) information about the highest range of feerates to fail to meet the threshold\n" 1131 " \"errors\": [ str... ] (json array of strings, optional) Errors encountered during processing\n" 1133 " \"medium\" : { ... }, (json object, optional) estimate for medium time horizon\n" 1134 " \"long\" : { ... } (json object) estimate for long time horizon\n" 1137 "Results are returned for any horizon which tracks blocks up to the confirmation target.\n" 1145 double threshold = 0.95;
1149 if (threshold < 0 || threshold > 1) {
1193 errors.
push_back(
"Insufficient data or no feerate found which meets threshold");
1204 throw std::runtime_error(
1206 "\nReturn if the server is set to generate coins or not. The default is false.\n" 1207 "It is set with the command line argument -gen (or " + std::string(
FABCOIN_CONF_FILENAME) +
" setting gen)\n" 1208 "It can also be set with the setgenerate call.\n" 1210 "true|false (boolean) If the server is set to generate coins or not\n" 1223 throw std::runtime_error(
1224 "setgenerate generate ( genproclimit )\n" 1225 "\nSet 'generate' true or false to turn generation on or off.\n" 1226 "Generation is limited to 'genproclimit' processors, -1 is unlimited.\n" 1227 "See the getgenerate call for the current setting.\n" 1229 "1. generate (boolean, required) Set to true to turn on generation, off to turn off.\n" 1230 "2. genproclimit (numeric, optional) Set the processor limit for when generation is on. Can be -1 for unlimited.\n" 1232 "\nSet the generation on with a limit of one processor\n" 1234 "\nCheck the setting\n" 1236 "\nTurn off generation\n" 1238 "\nUsing json rpc\n" 1245 bool fGenerate =
true;
1249 int nGenProcLimit = 1;
1253 if (nGenProcLimit == 0)
1275 {
"mining",
"getnetworkhashps", &
getnetworkhashps,
true, {
"nblocks",
"height"} },
1278 {
"mining",
"getblocktemplate", &
getblocktemplate,
true, {
"template_request"} },
1279 {
"mining",
"submitblock", &
submitblock,
true, {
"hexdata",
"dummy"} },
1282 {
"generating",
"generatetoaddress", &
generatetoaddress,
true, {
"nblocks",
"address",
"maxtries"} },
1283 {
"generating",
"getgenerate", &
getgenerate,
true, {
"generate",
"genproclimit"} },
1284 {
"generating",
"setgenerate", &
setgenerate,
true, {
"generate"} },
1286 {
"util",
"estimatefee", &
estimatefee,
true, {
"nblocks"} },
1287 {
"util",
"estimatesmartfee", &
estimatesmartfee,
true, {
"conf_target",
"estimate_mode"} },
1289 {
"hidden",
"estimaterawfee", &
estimaterawfee,
true, {
"conf_target",
"threshold"} },
1294 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)
CAmount GetFeePerK() const
Return the fee in liu for a size of 1000 bytes.
const std::string & get_str() const
bool MineBlocksOnDemand() const
Make miner stop after a block is found.
bool DecodeHexBlk(CBlock &, const std::string &strHexBlk)
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params &consensusParams)
Ran out of memory during operation.
Fabcoin RPC command dispatcher.
void SetThreadPriority(int nPriority)
int64_t GetTransactionWeight(const CTransaction &tx)
CBlockIndex * pprev
pointer to the index of the predecessor of this block
UniValue setgenerate(const JSONRPCRequest &request)
int64_t UpdateTime(CBlockHeader *pblock, const Consensus::Params &consensusParams, const CBlockIndex *pindexPrev)
bool IsRPCRunning()
Query whether RPC is running.
CFeeRate estimateSmartFee(int confTarget, int *answerFoundAtTarget, const CTxMemPool &pool)
Estimate feerate needed to get be included in a block within confTarget blocks.
unsigned int EquihashN(uint32_t nHeight=0) const
bool gbt_force
Whether GBT clients can safely ignore this rule in simplified usage.
#define EhInitialiseState(n, k, base_state)
uint256 GetWitnessHash() const
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...
std::string GetHex() const
void RegisterMiningRPCCommands(CRPCTable &t)
Register mining RPC commands.
UniValue estimatesmartfee(const JSONRPCRequest &request)
const Consensus::Params & GetConsensus() const
base58-encoded Fabcoin addresses.
UniValue ValueFromAmount(const CAmount &amount)
std::string HexStr(const T itbegin, const T itend, bool fSpaces=false)
const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS]
bool run(unsigned int n, unsigned int k, uint8_t *header, size_t header_len, uint256 nonce, const std::function< bool(std::vector< unsigned char >)> validBlock, const std::function< bool(GPUSolverCancelCheck)> cancelled, crypto_generichash_blake2b_state base_state)
void GenerateFabcoins(bool fGenerate, int nThreads, const CChainParams &chainparams)
Run the miner threads.
bool GetBoolArg(const std::string &strArg, bool fDefault)
Return boolean argument or default value.
UniValue estimatefee(const JSONRPCRequest &request)
void BlockChecked(const CBlock &block, const CValidationState &stateIn) override
Notifies listeners of a block validation result.
CFeeRate estimateFee(int confTarget) const
DEPRECATED.
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
assert(len-trim+(2 *lenIndices)<=WIDTH)
CChainParams defines various tweakable parameters of a given instance of the Fabcoin system...
std::unique_ptr< CBlockTemplate > CreateNewBlock(const CScript &scriptPubKeyIn, bool fMineWitnessTx=true, int64_t *pTotalFees=0, int32_t nTime=0, int32_t nTimeLimit=0)
Construct a new block template with coinbase to scriptPubKeyIn.
Double ended buffer combining vector and stream-like interfaces.
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)
uint32_t VersionBitsMask(const Consensus::Params ¶ms, Consensus::DeploymentPos pos)
void UnregisterValidationInterface(CValidationInterface *pwalletIn)
Unregister a wallet from core.
uint64_t GetUint64(int pos) const
UniValue getblocksubsidy(const JSONRPCRequest &request)
void ForceSetArg(const std::string &strArg, const std::string &strValue)
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.
#define FABCOIN_NONCE_LEN
bool appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
uint32_t FABHeight
Block height at which Fabcoin Equihash hard fork becomes active.
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.
arith_uint256 UintToArith256(const uint256 &a)
bool FeeModeFromString(const std::string &mode_string, FeeEstimateMode &fee_estimate_mode)
uint64_t nLastBlockWeight
UniValue generateBlocks(std::shared_ptr< CReserveScript > coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript)
Generate blocks (mine)
unsigned int GetTransactionsUpdated() const
int64_t CAmount
Amount in lius (Can be negative)
bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams ¶ms)
Check whether the Equihash solution in a block header is valid.
General error during transaction or block submission.
CBlockPolicyEstimator feeEstimator
#define THREAD_PRIORITY_NORMAL
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
std::string StringForFeeEstimateHorizon(FeeEstimateHorizon horizon)
int Height() const
Return the maximal height in the chain.
int64_t get_int64() const
unsigned int HighestTargetTracked(FeeEstimateHorizon horizon) const
Calculation of highest target that estimates are tracked for.
bool push_back(const UniValue &val)
bool CheckProofOfWork(uint256 hash, unsigned int nBits, bool postfork, const Consensus::Params ¶ms)
Check whether a block hash satisfies the proof-of-work requirement specified by nBits.
unsigned int nStatus
Verification status of this block. See enum BlockStatus.
#define THREAD_PRIORITY_LOWEST
Scripts & signatures ok. Implies all parents are also at least SCRIPTS.
#define LEAVE_CRITICAL_SECTION(cs)
const char *const FABCOIN_CONF_FILENAME
An input of a transaction.
const Object_type::value_type::Value_type & find_value(const Object_type &obj, const String_type &name)
void RPCTypeCheckArgument(const UniValue &value, UniValue::VType typeExpected)
Type-check one argument; throws JSONRPCError if wrong type given.
uint32_t ContractHeight
Block height at which Fabcoin Smart Contract hard fork becomes active.
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.
std::string GetWarnings(const std::string &strFor)
Format a string that describes several potential problems detected by the core.
CChain chainActive
The currently-connected chain of blocks (protected by cs_main).
CScript GetScriptForDestination(const CTxDestination &dest)
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
UniValue getgenerate(const JSONRPCRequest &request)
bool EhBasicSolveUncancellable(unsigned int n, unsigned int k, const eh_HashState &base_state, const std::function< bool(std::vector< unsigned char >)> validBlock)
Parameters that influence chain consensus.
CScript COINBASE_FLAGS
Constant stuff for coinbase transactions we create:
std::string GetHex() const
256-bit unsigned big integer.
int64_t DifficultyAdjustmentInterval(uint32_t nheight=0) const
VersionBitsCache versionbitscache
void RegisterValidationInterface(CValidationInterface *pwalletIn)
Register a wallet to receive updates from core.
std::string GetRejectReason() const
#define LogPrint(category,...)
void IncrementExtraNonce(CBlock *pblock, const CBlockIndex *pindexPrev, unsigned int &nExtraNonce)
Modify the extranonce in a block.
#define ENTER_CRITICAL_SECTION(cs)
std::string ToString() const
Capture information about block/transaction validation.
uint256 ArithToUint256(const arith_uint256 &a)
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.
std::string GetArg(const std::string &strArg, const std::string &strDefault)
Return string argument or default value.
Serialized script, used inside transaction inputs and outputs.
void * memcpy(void *a, const void *b, size_t c)
int64_t GetAdjustedTime()
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...
#define round(a, b, c, x, mul)
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 liu per kilobyte: CAmount / kB.
std::unique_ptr< CConnman > g_connman
const UniValue NullUniValue
std::string i64tostr(int64_t n)
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...
bool IsValid(enum BlockStatus nUpTo=BLOCK_VALID_TRANSACTIONS) const
Check whether this block index entry is valid up to the passed validity level.
std::string gbt_vb_name(const Consensus::DeploymentPos pos)
bool IsWitnessEnabled(const CBlockIndex *pindexPrev, const Consensus::Params ¶ms)
Check whether witness commitments are required for block.
const uint256 & GetHash() const
UniValue generatetoaddress(const JSONRPCRequest &request)
UniValue JSONRPCError(int code, const std::string &message)
No valid connection manager instance found.
dev::WithExisting max(dev::WithExisting _a, dev::WithExisting _b)
int64_t GetTime()
GetTimeMicros() and GetTimeMillis() both return the system time, but in different units...
struct evm_uint160be address(struct evm_env *env)
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
Use default settings based on other criteria.
UniValue submitblock(const JSONRPCRequest &request)
int bit
Bit position to select the particular bit in nVersion.
UniValue getnetworkhashps(const JSONRPCRequest &request)
Still downloading initial blocks.
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...
int64_t GetBlockTime() const
const UniValue & get_obj() const
void SetHex(const char *psz)
ThresholdState VersionBitsState(const CBlockIndex *pindexPrev, const Consensus::Params ¶ms, Consensus::DeploymentPos pos, VersionBitsCache &cache)
int64_t GetMedianTimePast() const
unsigned int EquihashK(uint32_t nHeight=0) const
void PrioritiseTransaction(const uint256 &hash, const CAmount &nFeeDelta)
Affect CreateNewBlock prioritisation of transactions.
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.
uint256 GetBlockHash() const
CConditionVariable cvBlockChange
unsigned int size() const