HeadersMessage: remove params from constructors

This commit is contained in:
Andreas Schildbach 2023-04-03 17:14:43 +02:00
parent c613a7d98a
commit f2fa39ef3e
4 changed files with 9 additions and 9 deletions

View File

@ -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")) {

View File

@ -44,17 +44,17 @@ public class HeadersMessage extends Message {
private List<Block> 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<Block> headers) throws ProtocolException {
super(params);
public HeadersMessage(List<Block> headers) throws ProtocolException {
super();
blockHeaders = headers;
}

View File

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

View File

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