From 01bf08159dc2c9dda8fc3ab03916d175645d8c08 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Tue, 21 Mar 2023 23:35:57 +0100 Subject: [PATCH] FilteredBlock: simplify `parse()` a bit by using `readBytes()` --- core/src/main/java/org/bitcoinj/core/FilteredBlock.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/core/FilteredBlock.java b/core/src/main/java/org/bitcoinj/core/FilteredBlock.java index 4580512c4..9594bd5cd 100644 --- a/core/src/main/java/org/bitcoinj/core/FilteredBlock.java +++ b/core/src/main/java/org/bitcoinj/core/FilteredBlock.java @@ -66,10 +66,8 @@ public class FilteredBlock extends Message { @Override protected void parse() throws ProtocolException { - byte[] headerBytes = new byte[Block.HEADER_SIZE]; - System.arraycopy(payload, 0, headerBytes, 0, Block.HEADER_SIZE); + byte[] headerBytes = readBytes(Block.HEADER_SIZE); header = params.getDefaultSerializer().makeBlock(ByteBuffer.wrap(headerBytes)); - merkleTree = new PartialMerkleTree(params, ByteBuffer.wrap(payload, Block.HEADER_SIZE, length - Block.HEADER_SIZE)); length = Block.HEADER_SIZE + merkleTree.getMessageSize();