mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-14 11:15:51 +00:00
RejectMessage: add a c'tor for initialising a new message and fix a bug in serialisation.
This commit is contained in:
parent
f3fa050c09
commit
c981555be4
@ -72,8 +72,13 @@ public class RejectMessage extends Message {
|
||||
super(params, payload, 0);
|
||||
}
|
||||
|
||||
public RejectMessage(NetworkParameters params, byte[] payload, boolean parseLazy, boolean parseRetain, int length) throws ProtocolException {
|
||||
super(params, payload, 0, parseLazy, parseRetain, length);
|
||||
/** Constructs a reject message that fingers the object with the given hash as rejected for the given reason. */
|
||||
public RejectMessage(NetworkParameters params, RejectCode code, Sha256Hash hash, String message, String reason) throws ProtocolException {
|
||||
super(params);
|
||||
this.code = code;
|
||||
this.messageHash = hash;
|
||||
this.message = message;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -102,7 +107,7 @@ public class RejectMessage extends Message {
|
||||
stream.write(new VarInt(reasonBytes.length).encode());
|
||||
stream.write(reasonBytes);
|
||||
if (message.equals("block") || message.equals("tx"))
|
||||
stream.write(messageHash.getBytes());
|
||||
stream.write(Utils.reverseBytes(messageHash.getBytes()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user