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, }
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
6 7 8 |
# File 'lib/bitcoin/protocol/reject.rb', line 6 def ccode @ccode end |
#data ⇒ Object
Returns the value of attribute data
6 7 8 |
# File 'lib/bitcoin/protocol/reject.rb', line 6 def data @data end |
#message ⇒ Object
Returns the value of attribute message
6 7 8 |
# File 'lib/bitcoin/protocol/reject.rb', line 6 def @message end |
#reason ⇒ Object
Returns the value of attribute reason
6 7 8 |
# File 'lib/bitcoin/protocol/reject.rb', line 6 def reason @reason end |
Class Method Details
.parse(payload) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/bitcoin/protocol/reject.rb', line 18 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
32 33 34 |
# File 'lib/bitcoin/protocol/reject.rb', line 32 def block_hash == "block" && self[:data].reverse.bth end |
#tx_hash ⇒ Object
28 29 30 |
# File 'lib/bitcoin/protocol/reject.rb', line 28 def tx_hash == "tx" && self[:data].reverse.bth end |