Class: Tapyrus::Message::PrefilledTx
- Inherits:
-
Object
- Object
- Tapyrus::Message::PrefilledTx
- Defined in:
- lib/tapyrus/message/prefilled_tx.rb
Overview
A PrefilledTransaction structure is used in HeaderAndShortIDs to provide a list of a few transactions explicitly. github.com/bitcoin/bips/blob/master/bip-0152.mediawiki
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#tx ⇒ Object
Returns the value of attribute tx.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(index, tx) ⇒ PrefilledTx
constructor
A new instance of PrefilledTx.
- #to_payload ⇒ Object
Constructor Details
#initialize(index, tx) ⇒ PrefilledTx
Returns a new instance of PrefilledTx.
9 10 11 12 |
# File 'lib/tapyrus/message/prefilled_tx.rb', line 9 def initialize(index, tx) @index = index @tx = tx end |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
6 7 8 |
# File 'lib/tapyrus/message/prefilled_tx.rb', line 6 def index @index end |
#tx ⇒ Object
Returns the value of attribute tx.
7 8 9 |
# File 'lib/tapyrus/message/prefilled_tx.rb', line 7 def tx @tx end |
Class Method Details
.parse_from_io(io) ⇒ Object
14 15 16 17 18 |
# File 'lib/tapyrus/message/prefilled_tx.rb', line 14 def self.parse_from_io(io) index = Tapyrus.unpack_var_int_from_io(io) tx = Tapyrus::Tx.parse_from_payload(io) self.new(index, tx) end |
Instance Method Details
#to_payload ⇒ Object
20 21 22 |
# File 'lib/tapyrus/message/prefilled_tx.rb', line 20 def to_payload Tapyrus.pack_var_int(index) << tx.to_payload end |