mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-28 18:19:31 +01:00
Merge bitcoin/bitcoin#31600: rpc: have getblocktemplate mintime account for timewarp
e1676b08f7doc: release notes (Sjors Provoost)0082f6acc1rpc: have mintime account for timewarp rule (Sjors Provoost)79d45b10f1rpc: clarify BIP94 behavior for curtime (Sjors Provoost)0713548137refactor: add GetMinimumTime() helper (Sjors Provoost) Pull request description: #30681 fixed the `curtime` field of `getblocktemplate` to take the timewarp rule into account. However I forgot to do the same for the `mintime` field, which was hardcoded to use `pindexPrev->GetMedianTimePast()+1`. This PR adds a helper `GetMinimumTime()` and uses it for the `mintime` field. #31376 changed the `curtime` field to always account for the timewarp rule. This PR maintains that behavior. Note that `mintime` now always applies BIP94, including on mainnet. This makes future softfork activation safer. It could be backported to v28. ACKs for top commit: fjahr: tACKe1676b08f7achow101: ACKe1676b08f7darosior: utACKe1676b08f7on the code changes tdb3: brief code review re ACKe1676b08f7TheCharlatan: ACKe1676b08f7Tree-SHA512: 0e322d8cc3b8ff770849bce211edcb5b6f55d04e5e0dee0657805049663d758f27423b047ee6363bd8f6c6fead13f974760f48b3321ea86f514f446e1b23231c
This commit is contained in:
@@ -153,6 +153,8 @@ class MiningTest(BitcoinTestFramework):
|
||||
# The template will have an adjusted timestamp, which we then modify
|
||||
tmpl = node.getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)
|
||||
assert_greater_than_or_equal(tmpl['curtime'], t + MAX_FUTURE_BLOCK_TIME - MAX_TIMEWARP)
|
||||
# mintime and curtime should match
|
||||
assert_equal(tmpl['mintime'], tmpl['curtime'])
|
||||
|
||||
block = CBlock()
|
||||
block.nVersion = tmpl["version"]
|
||||
|
||||
Reference in New Issue
Block a user