mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge #10426: Replace bytes_serialized with bogosize
8b22af3
Replace bytes_serialized with bogosize (Pieter Wuille)
Tree-SHA512: e70a981bbb977329f9e324c45f9a1346ec9aacfbbad5474e608cdd1f852257502bb7db8003fd578260a609e45d1a9cf87ce96df9c4187d92d50f60a209e232ce
This commit is contained in:
parent
51525efd66
commit
175d68ac21
@ -1022,11 +1022,12 @@ struct CCoinsStats
|
||||
uint256 hashBlock;
|
||||
uint64_t nTransactions;
|
||||
uint64_t nTransactionOutputs;
|
||||
uint64_t nBogoSize;
|
||||
uint256 hashSerialized;
|
||||
uint64_t nDiskSize;
|
||||
CAmount nTotalAmount;
|
||||
|
||||
CCoinsStats() : nHeight(0), nTransactions(0), nTransactionOutputs(0), nTotalAmount(0) {}
|
||||
CCoinsStats() : nHeight(0), nTransactions(0), nTransactionOutputs(0), nBogoSize(0), nDiskSize(0), nTotalAmount(0) {}
|
||||
};
|
||||
|
||||
static void ApplyStats(CCoinsStats &stats, CHashWriter& ss, const uint256& hash, const std::map<uint32_t, Coin>& outputs)
|
||||
@ -1041,6 +1042,8 @@ static void ApplyStats(CCoinsStats &stats, CHashWriter& ss, const uint256& hash,
|
||||
ss << VARINT(output.second.out.nValue);
|
||||
stats.nTransactionOutputs++;
|
||||
stats.nTotalAmount += output.second.out.nValue;
|
||||
stats.nBogoSize += 32 /* txid */ + 4 /* vout index */ + 4 /* height + coinbase */ + 8 /* amount */ +
|
||||
2 /* scriptPubKey len */ + output.second.out.scriptPubKey.size() /* scriptPubKey */;
|
||||
}
|
||||
ss << VARINT(0);
|
||||
}
|
||||
@ -1145,7 +1148,8 @@ UniValue gettxoutsetinfo(const JSONRPCRequest& request)
|
||||
" \"bestblock\": \"hex\", (string) the best block hash hex\n"
|
||||
" \"transactions\": n, (numeric) The number of transactions\n"
|
||||
" \"txouts\": n, (numeric) The number of unspent transaction outputs\n"
|
||||
" \"hash_serialized\": \"hash\", (string) The serialized hash\n"
|
||||
" \"bogosize\": n, (numeric) A meaningless metric for UTXO set size\n"
|
||||
" \"hash_serialized_2\": \"hash\", (string) The serialized hash\n"
|
||||
" \"disk_size\": n, (numeric) The estimated size of the chainstate on disk\n"
|
||||
" \"total_amount\": x.xxx (numeric) The total amount\n"
|
||||
"}\n"
|
||||
@ -1163,6 +1167,7 @@ UniValue gettxoutsetinfo(const JSONRPCRequest& request)
|
||||
ret.push_back(Pair("bestblock", stats.hashBlock.GetHex()));
|
||||
ret.push_back(Pair("transactions", (int64_t)stats.nTransactions));
|
||||
ret.push_back(Pair("txouts", (int64_t)stats.nTransactionOutputs));
|
||||
ret.push_back(Pair("bogosize", (int64_t)stats.nBogoSize));
|
||||
ret.push_back(Pair("hash_serialized_2", stats.hashSerialized.GetHex()));
|
||||
ret.push_back(Pair("disk_size", stats.nDiskSize));
|
||||
ret.push_back(Pair("total_amount", ValueFromAmount(stats.nTotalAmount)));
|
||||
|
@ -59,6 +59,7 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
assert_equal(res['transactions'], 200)
|
||||
assert_equal(res['height'], 200)
|
||||
assert_equal(res['txouts'], 200)
|
||||
assert_equal(res['bogosize'], 17000),
|
||||
size = res['disk_size']
|
||||
assert size > 6400
|
||||
assert size < 64000
|
||||
@ -74,6 +75,7 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
assert_equal(res2['total_amount'], Decimal('0'))
|
||||
assert_equal(res2['height'], 0)
|
||||
assert_equal(res2['txouts'], 0)
|
||||
assert_equal(res2['bogosize'], 0),
|
||||
assert_equal(res2['bestblock'], node.getblockhash(0))
|
||||
assert_equal(len(res2['hash_serialized_2']), 64)
|
||||
|
||||
@ -85,6 +87,7 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
assert_equal(res['transactions'], res3['transactions'])
|
||||
assert_equal(res['height'], res3['height'])
|
||||
assert_equal(res['txouts'], res3['txouts'])
|
||||
assert_equal(res['bogosize'], res3['bogosize'])
|
||||
assert_equal(res['bestblock'], res3['bestblock'])
|
||||
assert_equal(res['hash_serialized_2'], res3['hash_serialized_2'])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user