diff --git a/core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java b/core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java index fa2a0eeb1..274394df1 100644 --- a/core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java +++ b/core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java @@ -247,7 +247,7 @@ public class BitcoinSerializer extends MessageSerializer { check(!payload.hasRemaining(), ProtocolException::new); return new VersionAck(); } else if (command.equals("headers")) { - return new HeadersMessage(params, payload); + return new HeadersMessage(payload); } else if (command.equals("filterload")) { return makeBloomFilter(payload); } else if (command.equals("notfound")) { diff --git a/core/src/main/java/org/bitcoinj/core/HeadersMessage.java b/core/src/main/java/org/bitcoinj/core/HeadersMessage.java index 911a991cf..27704db95 100644 --- a/core/src/main/java/org/bitcoinj/core/HeadersMessage.java +++ b/core/src/main/java/org/bitcoinj/core/HeadersMessage.java @@ -44,17 +44,17 @@ public class HeadersMessage extends Message { private List blockHeaders; - public HeadersMessage(NetworkParameters params, ByteBuffer payload) throws ProtocolException { - super(params, payload); + public HeadersMessage(ByteBuffer payload) throws ProtocolException { + super(payload); } - public HeadersMessage(NetworkParameters params, Block... headers) throws ProtocolException { - super(params); + public HeadersMessage(Block... headers) throws ProtocolException { + super(); blockHeaders = Arrays.asList(headers); } - public HeadersMessage(NetworkParameters params, List headers) throws ProtocolException { - super(params); + public HeadersMessage(List headers) throws ProtocolException { + super(); blockHeaders = headers; } diff --git a/core/src/test/java/org/bitcoinj/core/BitcoindComparisonTool.java b/core/src/test/java/org/bitcoinj/core/BitcoindComparisonTool.java index b1aecfaa0..413b4a34f 100644 --- a/core/src/test/java/org/bitcoinj/core/BitcoindComparisonTool.java +++ b/core/src/test/java/org/bitcoinj/core/BitcoindComparisonTool.java @@ -187,7 +187,7 @@ public class BitcoindComparisonTool { } if (!found) sendHeaders = headers; - bitcoind.sendMessage(new HeadersMessage(PARAMS, sendHeaders)); + bitcoind.sendMessage(new HeadersMessage(sendHeaders)); InventoryMessage i = new InventoryMessage(); for (Block b : sendHeaders) i.addBlock(b); diff --git a/integration-test/src/test/java/org/bitcoinj/core/PeerTest.java b/integration-test/src/test/java/org/bitcoinj/core/PeerTest.java index 519a7fead..3daf37a44 100644 --- a/integration-test/src/test/java/org/bitcoinj/core/PeerTest.java +++ b/integration-test/src/test/java/org/bitcoinj/core/PeerTest.java @@ -477,7 +477,7 @@ public class PeerTest extends TestWithNetworkConnections { assertEquals(getheaders.getLocator(), expectedLocator); assertEquals(getheaders.getStopHash(), Sha256Hash.ZERO_HASH); // Now send all the headers. - HeadersMessage headers = new HeadersMessage(TESTNET, b2.cloneAsHeader(), + HeadersMessage headers = new HeadersMessage(b2.cloneAsHeader(), b3.cloneAsHeader(), b4.cloneAsHeader()); // We expect to be asked for b3 and b4 again, but this time, with a body. expectedLocator = new BlockLocator();