Package org.bitcoinj.core
Class RejectMessage
java.lang.Object
org.bitcoinj.core.Message
org.bitcoinj.core.RejectMessage
A message sent by nodes when a message we sent was rejected (ie a transaction had too little fee/was invalid/etc).
Instances of this class are not safe for use by multiple threads.
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.bitcoinj.core.Message
cursor, length, MAX_SIZE, offset, params, payload, recached, serializer, UNKNOWN_LENGTH
-
Constructor Summary
ConstructorDescriptionRejectMessage
(NetworkParameters params, byte[] payload) RejectMessage
(NetworkParameters params, RejectMessage.RejectCode code, Sha256Hash hash, String message, String reason) Constructs a reject message that fingers the object with the given hash as rejected for the given reason. -
Method Summary
Modifier and TypeMethodDescriptionvoid
bitcoinSerializeToStream
(OutputStream stream) Serializes this message to the provided stream.boolean
The reason code given for why the peer rejected the message.The reason message given for rejection.Provides the type of message which was rejected by the peer.Provides the hash of the rejected object (if getRejectedMessage() is either "tx" or "block"), otherwise null.int
hashCode()
protected void
parse()
toString()
A String representation of the relevant details of this reject message.Methods inherited from class org.bitcoinj.core.Message
adjustLength, bitcoinSerialize, bitcoinSerialize, getHash, getMessageSize, getParams, hasMoreBytes, isCached, isRecached, readByte, readByteArray, readBytes, readHash, readInt64, readStr, readUint32, readUint64, readVarInt, readVarInt, setSerializer, unCache, unsafeBitcoinSerialize
-
Constructor Details
-
RejectMessage
- Throws:
ProtocolException
-
RejectMessage
public RejectMessage(NetworkParameters params, RejectMessage.RejectCode code, Sha256Hash hash, String message, String reason) throws ProtocolException Constructs a reject message that fingers the object with the given hash as rejected for the given reason.- Throws:
ProtocolException
-
-
Method Details
-
parse
- Specified by:
parse
in classMessage
- Throws:
ProtocolException
-
bitcoinSerializeToStream
Description copied from class:Message
Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Overrides:
bitcoinSerializeToStream
in classMessage
- Throws:
IOException
-
getRejectedMessage
Provides the type of message which was rejected by the peer. Note that this is ENTIRELY UNTRUSTED and should be sanity-checked before it is printed or processed. -
getRejectedObjectHash
Provides the hash of the rejected object (if getRejectedMessage() is either "tx" or "block"), otherwise null. -
getReasonCode
The reason code given for why the peer rejected the message. -
getReasonString
The reason message given for rejection. Note that this is ENTIRELY UNTRUSTED and should be sanity-checked before it is printed or processed. -
toString
A String representation of the relevant details of this reject message. Be aware that the value returned by this method includes the value returned bygetReasonString
, which is taken from the reject message unchecked. Through malice or otherwise, it might contain control characters or other harmful content. -
equals
-
hashCode
public int hashCode()
-