Class: Bitcoin::Protocol::Reject
- Inherits:
-
Struct
- Object
- Struct
- Bitcoin::Protocol::Reject
- Defined in:
- lib/bitcoin/protocol/reject.rb
Constant Summary collapse
- CCODE_TABLE =
{ 0x01 => :malformed, 0x10 => :invalid, 0x11 => :obsolete, 0x12 => :duplicate, 0x40 => :nonstandard, 0x41 => :dust, 0x42 => :insufficientfee, 0x43 => :checkpoint }.freeze
Instance Attribute Summary collapse
-
#ccode ⇒ Object
Returns the value of attribute ccode.
-
#data ⇒ Object
Returns the value of attribute data.
-
#message ⇒ Object
Returns the value of attribute message.
-
#reason ⇒ Object
Returns the value of attribute reason.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#ccode ⇒ Object
Returns the value of attribute ccode
5 6 7 |
# File 'lib/bitcoin/protocol/reject.rb', line 5 def ccode @ccode end |
#data ⇒ Object
Returns the value of attribute data
5 6 7 |
# File 'lib/bitcoin/protocol/reject.rb', line 5 def data @data end |
#message ⇒ Object
Returns the value of attribute message
5 6 7 |
# File 'lib/bitcoin/protocol/reject.rb', line 5 def @message end |
#reason ⇒ Object
Returns the value of attribute reason
5 6 7 |
# File 'lib/bitcoin/protocol/reject.rb', line 5 def reason @reason end |
Class Method Details
.parse(payload) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/bitcoin/protocol/reject.rb', line 17 def self.parse(payload) , payload = Bitcoin::Protocol.unpack_var_string(payload) ccode, payload = payload.unpack('Ca*') reason, payload = Bitcoin::Protocol.unpack_var_string(payload) data = payload code = CCODE_TABLE[ccode] || ccode new(, code, reason, data) end |
Instance Method Details
#block_hash ⇒ Object
31 32 33 |
# File 'lib/bitcoin/protocol/reject.rb', line 31 def block_hash == 'block' && self[:data].reverse.bth end |
#tx_hash ⇒ Object
27 28 29 |
# File 'lib/bitcoin/protocol/reject.rb', line 27 def tx_hash == 'tx' && self[:data].reverse.bth end |