Class: Tapyrus::Message::Reject
- Defined in:
- lib/tapyrus/message/reject.rb
Overview
reject message bitcoin.org/en/developer-reference#reject
Constant Summary collapse
- COMMAND =
"reject"
- CODE_MALFORMED =
0x01
- CODE_INVALID =
0x10
- CODE_OBSOLETE =
0x11
- CODE_DUPLICATE =
0x12
- CODE_NONSTANDARD =
0x40
- CODE_DUST =
0x41
- CODE_INSUFFICIENT_FEE =
0x42
- CODE_CHECKPOINT =
0x43
Constants included from Util
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#extra ⇒ Object
Returns the value of attribute extra.
-
#message ⇒ Object
Returns the value of attribute message.
-
#reason ⇒ Object
Returns the value of attribute reason.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message, code, reason = "", extra = "") ⇒ Reject
constructor
A new instance of Reject.
- #to_payload ⇒ Object
Methods inherited from Base
Methods included from Util
#byte_to_bit, #calc_checksum, #decode_base58_address, #double_sha256, #encode_base58_address, #hash160, #hmac_sha256, #pack_boolean, #pack_var_int, #pack_var_string, #padding_zero, #sha256, #unpack_boolean, #unpack_var_int, #unpack_var_int_from_io, #unpack_var_string, #valid_address?
Methods included from HexConverter
Constructor Details
#initialize(message, code, reason = "", extra = "") ⇒ Reject
Returns a new instance of Reject.
22 23 24 25 26 27 |
# File 'lib/tapyrus/message/reject.rb', line 22 def initialize(, code, reason = "", extra = "") @message = @code = code @reason = reason @extra = extra end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
7 8 9 |
# File 'lib/tapyrus/message/reject.rb', line 7 def code @code end |
#extra ⇒ Object
Returns the value of attribute extra.
9 10 11 |
# File 'lib/tapyrus/message/reject.rb', line 9 def extra @extra end |
#message ⇒ Object
Returns the value of attribute message.
6 7 8 |
# File 'lib/tapyrus/message/reject.rb', line 6 def @message end |
#reason ⇒ Object
Returns the value of attribute reason.
8 9 10 |
# File 'lib/tapyrus/message/reject.rb', line 8 def reason @reason end |
Class Method Details
.parse_from_payload(payload) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/tapyrus/message/reject.rb', line 29 def self.parse_from_payload(payload) , payload = Tapyrus.unpack_var_string(payload) code, payload = payload.unpack("Ca*") reason, payload = Tapyrus.unpack_var_string(payload) extra = %w[tx block].include?() ? payload.bth : payload new(, code, reason, extra) end |
Instance Method Details
#to_payload ⇒ Object
37 38 39 40 |
# File 'lib/tapyrus/message/reject.rb', line 37 def to_payload e = %w[tx block].include?() ? extra.htb : extra Tapyrus.pack_var_string() << [code].pack("C") << Tapyrus.pack_var_string(reason) << e end |