From 2853cc4ed237cb21044026e8e6180fd59a0f48a0 Mon Sep 17 00:00:00 2001 From: HashEngineering Date: Wed, 19 Jul 2023 13:46:56 -0700 Subject: [PATCH] fix(core): stop at genesis block when copying to header chain Signed-off-by: HashEngineering --- core/src/main/java/org/bitcoinj/core/PeerGroup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/bitcoinj/core/PeerGroup.java b/core/src/main/java/org/bitcoinj/core/PeerGroup.java index 03d4bc67a..434c03321 100644 --- a/core/src/main/java/org/bitcoinj/core/PeerGroup.java +++ b/core/src/main/java/org/bitcoinj/core/PeerGroup.java @@ -437,7 +437,7 @@ public int compare(PeerAddress a, PeerAddress b) { try { this.headerChain = new BlockChain(params, new MemoryBlockStore(params)); StoredBlock cursor = chain.getChainHead(); - while (cursor != null) { + while (cursor != null && !cursor.getHeader().equals(params.getGenesisBlock())) { this.headerChain.getBlockStore().put(cursor); cursor = cursor.getPrev(chain.getBlockStore()); }