MessageSerializer: remove variant makeTransaction(payload, hash)

This commit is contained in:
Andreas Schildbach 2023-04-09 01:20:39 +02:00
parent 1346504fb0
commit 414bcf8b6c
3 changed files with 4 additions and 17 deletions

View File

@ -231,7 +231,7 @@ public class BitcoinSerializer extends MessageSerializer {
} else if (command.equals("getheaders")) {
return new GetHeadersMessage(payload);
} else if (command.equals("tx")) {
return makeTransaction(payload, hash);
return makeTransaction(payload);
} else if (command.equals("sendaddrv2")) {
check(!payload.hasRemaining(), ProtocolException::new);
return new SendAddrV2Message();
@ -333,7 +333,7 @@ public class BitcoinSerializer extends MessageSerializer {
* serialization format support.
*/
@Override
public Transaction makeTransaction(ByteBuffer payload, byte[] hashFromHeader)
public Transaction makeTransaction(ByteBuffer payload)
throws ProtocolException {
return new Transaction(payload, this);
}

View File

@ -96,7 +96,7 @@ class DummySerializer extends MessageSerializer {
}
@Override
public Transaction makeTransaction(ByteBuffer payload, byte[] hash) throws UnsupportedOperationException {
public Transaction makeTransaction(ByteBuffer payload) throws UnsupportedOperationException {
throw new UnsupportedOperationException(DEFAULT_EXCEPTION_MESSAGE);
}

View File

@ -101,20 +101,7 @@ public abstract class MessageSerializer {
* serializer (i.e. for messages with no network parameters), or because
* it does not support deserializing transactions.
*/
public abstract Transaction makeTransaction(ByteBuffer payload, byte[] hash) throws ProtocolException, UnsupportedOperationException;
/**
* Make a transaction from the payload. Extension point for alternative
* serialization format support.
*
* @throws UnsupportedOperationException if this serializer/deserializer
* does not support deserialization. This can occur either because it's a dummy
* serializer (i.e. for messages with no network parameters), or because
* it does not support deserializing transactions.
*/
public final Transaction makeTransaction(ByteBuffer payload) throws ProtocolException {
return makeTransaction(payload, null);
}
public abstract Transaction makeTransaction(ByteBuffer payload) throws ProtocolException, UnsupportedOperationException;
public abstract void seekPastMagicBytes(ByteBuffer in) throws BufferUnderflowException;