mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-09-06 15:01:00 +02:00
Merge bitcoin/bitcoin#32528: rpc: Round verificationprogress to 1 for a recent tip
fab1e02086
refactor: Pass verification_progress into block tip notifications (MarcoFalke)fa76b378e4
rpc: Round verificationprogress to exactly 1 for a recent tip (MarcoFalke)faf6304bdf
test: Use mockable time in GuessVerificationProgress (MarcoFalke) Pull request description: Some users really seem to care about this. While it shouldn't matter much, the diff is so trivial that it is probably worth doing. Fixes #31127 One could also consider to split the field into two dedicated ones (https://github.com/bitcoin/bitcoin/issues/28847#issuecomment-1807115357), but this is left for a more involved follow-up and may also be controversial. ACKs for top commit: achow101: ACKfab1e02086
pinheadmz: ACKfab1e02086
sipa: utACKfab1e02086
Tree-SHA512: a3c24e3c446d38fbad9399c1e7f1ffa7904490a3a7d12623b44e583b435cc8b5f1ba83b84d29c7ffaf22028bc909c7cec07202b825480449c6419d2a190938f5
This commit is contained in:
@@ -101,6 +101,7 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
self._test_waitforblockheight()
|
||||
self._test_getblock()
|
||||
self._test_getdeploymentinfo()
|
||||
self._test_verificationprogress()
|
||||
self._test_y2106()
|
||||
assert self.nodes[0].verifychain(4, 0)
|
||||
|
||||
@@ -280,6 +281,20 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
# calling with an explicit hash works
|
||||
self.check_signalling_deploymentinfo_result(self.nodes[0].getdeploymentinfo(gbci207["bestblockhash"]), gbci207["blocks"], gbci207["bestblockhash"], "started")
|
||||
|
||||
def _test_verificationprogress(self):
|
||||
self.log.info("Check that verificationprogress is less than 1 when the block tip is old")
|
||||
future = 2 * 60 * 60
|
||||
self.nodes[0].setmocktime(self.nodes[0].getblockchaininfo()["time"] + future + 1)
|
||||
assert_greater_than(1, self.nodes[0].getblockchaininfo()["verificationprogress"])
|
||||
|
||||
self.log.info("Check that verificationprogress is exactly 1 for a recent block tip")
|
||||
self.nodes[0].setmocktime(self.nodes[0].getblockchaininfo()["time"] + future)
|
||||
assert_equal(1, self.nodes[0].getblockchaininfo()["verificationprogress"])
|
||||
|
||||
self.log.info("Check that verificationprogress is less than 1 as soon as a new header comes in")
|
||||
self.nodes[0].submitheader(self.generateblock(self.nodes[0], output="raw(55)", transactions=[], submit=False, sync_fun=self.no_op)["hex"])
|
||||
assert_greater_than(1, self.nodes[0].getblockchaininfo()["verificationprogress"])
|
||||
|
||||
def _test_y2106(self):
|
||||
self.log.info("Check that block timestamps work until year 2106")
|
||||
self.generate(self.nodes[0], 8)[-1]
|
||||
|
Reference in New Issue
Block a user