Skip to content

Commit

Permalink
!isAfter()
Browse files Browse the repository at this point in the history
  • Loading branch information
schildbach committed Sep 3, 2024
1 parent dd2d6f2 commit 3d07499
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/bitcoinj/core/AbstractBlockChain.java
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ private void connectBlock(final Block block, StoredBlock storedPrev, boolean exp
block.getHashAsString(), filteredTxHashList.size(), filteredTxn.size());
for (Sha256Hash hash : filteredTxHashList) log.debug(" matched tx {}", hash);
}
if (expensiveChecks && block.time().compareTo(getMedianTimestampOfRecentBlocks(head, blockStore)) <= 0)
if (expensiveChecks && !block.time().isAfter(getMedianTimestampOfRecentBlocks(head, blockStore)))
throw new VerificationException("Block's timestamp is too early");

// BIP 66 & 65: Enforce block version 3/4 once they are a supermajority of blocks
Expand Down Expand Up @@ -832,7 +832,7 @@ private void handleNewBestChain(StoredBlock storedPrev, StoredBlock newChainHead
for (Iterator<StoredBlock> it = newBlocks.descendingIterator(); it.hasNext();) {
cursor = it.next();
Block cursorBlock = cursor.getHeader();
if (expensiveChecks && cursorBlock.time().compareTo(getMedianTimestampOfRecentBlocks(cursor.getPrev(blockStore), blockStore)) <= 0)
if (expensiveChecks && !cursorBlock.time().isAfter(getMedianTimestampOfRecentBlocks(cursor.getPrev(blockStore), blockStore)))
throw new VerificationException("Block's timestamp is too early during reorg");
TransactionOutputChanges txOutChanges;
if (cursor != newChainHead || block == null)
Expand Down

0 comments on commit 3d07499

Please sign in to comment.