FilteredBlock: simplify parse() a bit by using readBytes()

This commit is contained in:
Andreas Schildbach 2023-03-21 23:35:57 +01:00
parent 52b2f63d70
commit 01bf08159d

View File

@ -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();