Add branch IDs for current and next block to getblockchaininfo
Closes #2974.
This commit is contained in:
parent
71768555dd
commit
ed9aa2b62a
|
@ -38,6 +38,9 @@ class WalletOverwinterTxTest (BitcoinTestFramework):
|
||||||
#
|
#
|
||||||
# Currently at block 198. The next block to be mined 199 is a Sprout block
|
# Currently at block 198. The next block to be mined 199 is a Sprout block
|
||||||
#
|
#
|
||||||
|
assert_equal(self.nodes[0].getblockchaininfo()['consensus']['chaintip'], '00000000')
|
||||||
|
assert_equal(self.nodes[0].getblockchaininfo()['consensus']['nextblock'], '00000000')
|
||||||
|
|
||||||
taddr0 = self.nodes[0].getnewaddress()
|
taddr0 = self.nodes[0].getnewaddress()
|
||||||
taddr2 = self.nodes[2].getnewaddress()
|
taddr2 = self.nodes[2].getnewaddress()
|
||||||
zaddr2 = self.nodes[2].z_getnewaddress()
|
zaddr2 = self.nodes[2].z_getnewaddress()
|
||||||
|
@ -76,6 +79,8 @@ class WalletOverwinterTxTest (BitcoinTestFramework):
|
||||||
#
|
#
|
||||||
# Currently at block 199. The next block to be mined 200 is an Overwinter block
|
# Currently at block 199. The next block to be mined 200 is an Overwinter block
|
||||||
#
|
#
|
||||||
|
assert_equal(self.nodes[0].getblockchaininfo()['consensus']['chaintip'], '00000000')
|
||||||
|
assert_equal(self.nodes[0].getblockchaininfo()['consensus']['nextblock'], '5ba81b19')
|
||||||
|
|
||||||
# Send taddr to taddr
|
# Send taddr to taddr
|
||||||
tsendamount = Decimal('4.56')
|
tsendamount = Decimal('4.56')
|
||||||
|
@ -88,9 +93,12 @@ class WalletOverwinterTxTest (BitcoinTestFramework):
|
||||||
myopid = self.nodes[0].z_sendmany(taddr0, recipients)
|
myopid = self.nodes[0].z_sendmany(taddr0, recipients)
|
||||||
txid_shielded = wait_and_assert_operationid_status(self.nodes[0], myopid)
|
txid_shielded = wait_and_assert_operationid_status(self.nodes[0], myopid)
|
||||||
|
|
||||||
|
# Mine the first Overwinter block
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
assert_equal(self.nodes[0].getblockchaininfo()['consensus']['chaintip'], '5ba81b19')
|
||||||
|
assert_equal(self.nodes[0].getblockchaininfo()['consensus']['nextblock'], '5ba81b19')
|
||||||
|
|
||||||
# Verify balance
|
# Verify balance
|
||||||
assert_equal(self.nodes[3].getbalance(), tsendamount)
|
assert_equal(self.nodes[3].getbalance(), tsendamount)
|
||||||
|
|
|
@ -726,6 +726,10 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
|
||||||
" \"status\": \"xxxx\", (string) status of upgrade\n"
|
" \"status\": \"xxxx\", (string) status of upgrade\n"
|
||||||
" \"info\": \"xxxx\", (string) additional information about upgrade\n"
|
" \"info\": \"xxxx\", (string) additional information about upgrade\n"
|
||||||
" }, ...\n"
|
" }, ...\n"
|
||||||
|
" },\n"
|
||||||
|
" \"consensus\": { (object) branch IDs of the current and upcoming consensus rules\n"
|
||||||
|
" \"chaintip\": \"xxxxxxxx\", (string) branch ID used to validate the current chain tip\n"
|
||||||
|
" \"nextblock\": \"xxxxxxxx\" (string) branch ID that the next block will be validated under\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
"\nExamples:\n"
|
||||||
|
@ -767,6 +771,11 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
|
||||||
}
|
}
|
||||||
obj.push_back(Pair("upgrades", upgrades));
|
obj.push_back(Pair("upgrades", upgrades));
|
||||||
|
|
||||||
|
UniValue consensus(UniValue::VOBJ);
|
||||||
|
consensus.push_back(Pair("chaintip", HexInt(CurrentEpochBranchId(tip->nHeight, consensusParams))));
|
||||||
|
consensus.push_back(Pair("nextblock", HexInt(CurrentEpochBranchId(tip->nHeight + 1, consensusParams))));
|
||||||
|
obj.push_back(Pair("consensus", consensus));
|
||||||
|
|
||||||
if (fPruneMode)
|
if (fPruneMode)
|
||||||
{
|
{
|
||||||
CBlockIndex *block = chainActive.Tip();
|
CBlockIndex *block = chainActive.Tip();
|
||||||
|
|
Loading…
Reference in New Issue