* Slow down clock

* Faster and slower

* A0/50

* Fix dilithium inputs scan to compare for the voutpubtxids[vout]

* Prevent use of uninitialized ignoredAddresses

* Filter out amount=0 UTXOs from getsnapshot results

* rogue msvc build (#1327)

* + msvc 2015 deps headers

* + msvc deps build script

this script builds only deps, to build rogue binary, open
*.sln file in MSVC 2015 and build x64 Release version.

* + msvc solution (*.sln) update

* + msvc build fix

* fix libcurl deps install (msvc)

* Fix wrong dilithium compare

* Port getchaintxstats from BTC master (#1328)

This will allow explorers to present interesting analytics about
transaction volume in various time frames.

* customcc

* Make custom

* Syntax

* update

* Patch rogue msvc (#1330)

* + msvc 2015 deps headers

* + msvc deps build script

this script builds only deps, to build rogue binary, open
*.sln file in MSVC 2015 and build x64 Release version.

* + msvc solution (*.sln) update

* + msvc build fix

* fix libcurl deps install (msvc)

* [msvc] fix seed str -> uint64 conversion

* [msvc] fix config file name issue
+ debug print for send raw tx

* + comment debug printouts

* [ msvc ] display compiler version and build date on startup

* +pritns

* +prints

* I,

* Print hex

* Allow gold mismatch for validate

* Stricter player data validation

* Change data source

* Allow claiming less than cashout value

* 50902 exemption

* Taxied

* Print

* Debug file

* Log seed

* Potion file

* ;

* Log seed

* Commands log

* Fp

* Test

* Prints

*         static FILE *fp;

* Fp2

* Daemons or fuses

* Fuse prints

* All funcs

* Logfp

* turn_see is a daemon!

* 'void (*)(struct rogue_state *, int)

* -prints

* -file fp

* -potions file

* Test

* -log

* -print replay2 gold

* Test

* D'oh!
This commit is contained in:
jl777
2019-03-13 22:58:20 -11:00
committed by GitHub
parent e713c31ada
commit 05977b8af6
32 changed files with 3485 additions and 164 deletions

View File

@@ -1655,6 +1655,87 @@ UniValue getmempoolinfo(const UniValue& params, bool fHelp)
return mempoolInfoToJSON();
}
inline CBlockIndex* LookupBlockIndex(const uint256& hash)
{
AssertLockHeld(cs_main);
BlockMap::const_iterator it = mapBlockIndex.find(hash);
return it == mapBlockIndex.end() ? nullptr : it->second;
}
UniValue getchaintxstats(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() > 2)
throw runtime_error(
"getchaintxstats\n"
"\nCompute statistics about the total number and rate of transactions in the chain.\n"
"\nArguments:\n"
"1. nblocks (numeric, optional) Number of blocks in averaging window.\n"
"2. blockhash (string, optional) The hash of the block which ends the window.\n"
"\nResult:\n"
"{\n"
" \"time\": xxxxx, (numeric) The timestamp for the final block in the window in UNIX format.\n"
" \"txcount\": xxxxx, (numeric) The total number of transactions in the chain up to that point.\n"
" \"window_final_block_hash\": \"...\", (string) The hash of the final block in the window.\n"
" \"window_block_count\": xxxxx, (numeric) Size of the window in number of blocks.\n"
" \"window_tx_count\": xxxxx, (numeric) The number of transactions in the window. Only returned if \"window_block_count\" is > 0.\n"
" \"window_interval\": xxxxx, (numeric) The elapsed time in the window in seconds. Only returned if \"window_block_count\" is > 0.\n"
" \"txrate\": x.xx, (numeric) The average rate of transactions per second in the window. Only returned if \"window_interval\" is > 0.\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("getchaintxstats", "")
+ HelpExampleRpc("getchaintxstats", "2016")
);
const CBlockIndex* pindex;
int blockcount = 30 * 24 * 60 * 60 / Params().GetConsensus().nPowTargetSpacing; // By default: 1 month
if (params[1].isNull()) {
LOCK(cs_main);
pindex = chainActive.Tip();
} else {
uint256 hash(ParseHashV(params[1], "blockhash"));
LOCK(cs_main);
pindex = LookupBlockIndex(hash);
if (!pindex) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
}
if (!chainActive.Contains(pindex)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Block is not in main chain");
}
}
assert(pindex != nullptr);
if (params[0].isNull()) {
blockcount = std::max(0, std::min(blockcount, pindex->GetHeight() - 1));
} else {
blockcount = params[0].get_int();
if (blockcount < 0 || (blockcount > 0 && blockcount >= pindex->GetHeight())) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid block count: should be between 0 and the block's height - 1");
}
}
const CBlockIndex* pindexPast = pindex->GetAncestor(pindex->GetHeight() - blockcount);
int nTimeDiff = pindex->GetMedianTimePast() - pindexPast->GetMedianTimePast();
int nTxDiff = pindex->nChainTx - pindexPast->nChainTx;
UniValue ret(UniValue::VOBJ);
ret.pushKV("time", (int64_t)pindex->nTime);
ret.pushKV("txcount", (int64_t)pindex->nChainTx);
ret.pushKV("window_final_block_hash", pindex->GetBlockHash().GetHex());
ret.pushKV("window_block_count", blockcount);
if (blockcount > 0) {
ret.pushKV("window_tx_count", nTxDiff);
ret.pushKV("window_interval", nTimeDiff);
if (nTimeDiff > 0) {
ret.pushKV("txrate", ((double)nTxDiff) / nTimeDiff);
}
}
return ret;
}
UniValue invalidateblock(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 1)
@@ -1742,6 +1823,7 @@ static const CRPCCommand commands[] =
{ "blockchain", "getblockhash", &getblockhash, true },
{ "blockchain", "getblockheader", &getblockheader, true },
{ "blockchain", "getchaintips", &getchaintips, true },
{ "blockchain", "getchaintxstats", &getchaintxstats, true },
{ "blockchain", "getdifficulty", &getdifficulty, true },
{ "blockchain", "getmempoolinfo", &getmempoolinfo, true },
{ "blockchain", "getrawmempool", &getrawmempool, true },