Skip to content

Commit d79ea80

Browse files
committed
Merge bitcoin/bitcoin#30647: Move maximum timewarp attack threshold back to 600s from 7200s
16e95bd Move maximum timewarp attack threshold back to 600s from 7200s (Matt Corallo) Pull request description: In 6bfa260 the testnet4 timewarp attack fix block time variation was increased from the Great Consensus Cleanup value of 600s to 7200s on the thesis that this allows miners to always create blocks with the current time. Sadly, doing so does allow for some nonzero inflation, even if not a huge amount. While it could be that some hardware ignores the timestamp provided to it over Stratum and forces the block header timestamp to the current time, I'm not aware of any such hardware, and it would also likely suffer from random invalid blocks due to relying on NTP anyway, making its existence highly unlikely. This leaves the only concern being pools, but most of those rely on work generated by Bitcoin Core (in one way or another, though when spy mining possibly not), and it seems likely that they will also not suffer any lost work. While its possible that a pool does generate invalid work due to spy mining or otherwise custom logic, it seems unlikely that a substantial portion of hashrate would do so, making the difference somewhat academic (any pool that screws this up will only do so once and the network would come out just fine). Further, while we may end up deciding these assumptions were invalid and we should instead use 7200s, it seems prudent to try with the value we "want" on testnet4, giving us the ability to learn if the compatibility concerns are an issue before we go to mainnet. ACKs for top commit: fjahr: tACK 16e95bd achow101: ACK 16e95bd murchandamus: crACK 16e95bd Tree-SHA512: ae46d03b728b6e23cb6ace64c9813bc01c01e38dd7f159cf0fab53b331ef84b3b811edab225453ccdfedb53b242f55b0efd69829782657490fe393d24dacbeb2
2 parents ee36717 + 16e95bd commit d79ea80

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/validation.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,7 @@ static constexpr int PRUNE_LOCK_BUFFER{10};
112112
* block of a difficulty adjustment period is allowed to
113113
* be earlier than the last block of the previous period (BIP94).
114114
*/
115-
static constexpr int64_t MAX_TIMEWARP{MAX_FUTURE_BLOCK_TIME};
116-
117-
/**
118-
* If the timestamp of the last block in a difficulty period is set
119-
* MAX_FUTURE_BLOCK_TIME seconds in the future, an honest miner should
120-
* be able to mine the first block using the current time. This is not
121-
* a consensus rule, but changing MAX_TIMEWARP should be done with caution.
122-
*/
123-
static_assert(MAX_FUTURE_BLOCK_TIME <= MAX_TIMEWARP);
115+
static constexpr int64_t MAX_TIMEWARP = 600;
124116

125117
GlobalMutex g_best_block_mutex;
126118
std::condition_variable g_best_block_cv;

0 commit comments

Comments
 (0)