Skip to content

Commit

Permalink
fix(core): stop at genesis block when copying to header chain (#223)
Browse files Browse the repository at this point in the history
Signed-off-by: HashEngineering <[email protected]>
  • Loading branch information
HashEngineering authored Jul 20, 2023
1 parent bf38a9e commit fcaa306
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/org/bitcoinj/core/PeerGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit fcaa306

Please sign in to comment.