Skip to content

Commit ab91bf3

Browse files
committed
Apply BIP30 checks to all blocks except the two historic violations.
Matt pointed out some time ago that there existed a minor DOS attack where a node in its initial block download could be wedged by an overwrite attack in a fork created between checkpoints before a time where BIP30 was enforced. Now that the BIP30 timestamp is irreversibly past the check can be more aggressive and apply to all blocks except the two historic violations.
1 parent 0e08efc commit ab91bf3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,9 +1360,12 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex, bool fJustCheck)
13601360
// See BIP30 and http://r6.ca/blog/20120206T005236Z.html for more information.
13611361
// This logic is not necessary for memory pool transactions, as AcceptToMemoryPool
13621362
// already refuses previously-known transaction ids entirely.
1363-
// This rule applies to all blocks whose timestamp is after March 15, 2012, 0:00 UTC.
1364-
int64 nBIP30SwitchTime = 1331769600;
1365-
bool fEnforceBIP30 = (pindex->nTime > nBIP30SwitchTime);
1363+
// This rule was originally applied all blocks whose timestamp was after March 15, 2012, 0:00 UTC.
1364+
// Now that the whole chain is irreversibly beyond that time it is applied to all blocks except the
1365+
// two in the chain that violate it. This prevents exploiting the issue against nodes in their
1366+
// initial block download.
1367+
bool fEnforceBIP30 = !((pindex->nHeight==91842 && pindex->GetBlockHash() == uint256("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) ||
1368+
(pindex->nHeight==91880 && pindex->GetBlockHash() == uint256("0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721")));
13661369

13671370
// BIP16 didn't become active until Apr 1 2012
13681371
int64 nBIP16SwitchTime = 1333238400;

0 commit comments

Comments
 (0)