Class: Bitcoin::Protocol::TxWitness
- Inherits:
-
Object
- Object
- Bitcoin::Protocol::TxWitness
- Defined in:
- lib/segwit/tx_witness.rb
Instance Attribute Summary collapse
-
#tx_in_wit ⇒ Object
readonly
Returns the value of attribute tx_in_wit.
Instance Method Summary collapse
-
#add_empty_witness ⇒ Object
add empty witness.
-
#add_witness(tx_in_wit) ⇒ Object
Add witness @param tx_in_wit witness object.
- #empty? ⇒ Boolean
-
#initialize ⇒ TxWitness
constructor
A new instance of TxWitness.
- #size ⇒ Object
-
#to_payload ⇒ Object
output witness in raw binary format.
Constructor Details
#initialize ⇒ TxWitness
Returns a new instance of TxWitness.
10 11 12 |
# File 'lib/segwit/tx_witness.rb', line 10 def initialize @tx_in_wit = [] end |
Instance Attribute Details
#tx_in_wit ⇒ Object (readonly)
Returns the value of attribute tx_in_wit.
8 9 10 |
# File 'lib/segwit/tx_witness.rb', line 8 def tx_in_wit @tx_in_wit end |
Instance Method Details
#add_empty_witness ⇒ Object
add empty witness
21 22 23 |
# File 'lib/segwit/tx_witness.rb', line 21 def add_empty_witness add_witness(TxInWitness.new) end |
#add_witness(tx_in_wit) ⇒ Object
Add witness @param tx_in_wit witness object
16 17 18 |
# File 'lib/segwit/tx_witness.rb', line 16 def add_witness(tx_in_wit) (@tx_in_wit ||= []) << tx_in_wit end |
#empty? ⇒ Boolean
36 37 38 |
# File 'lib/segwit/tx_witness.rb', line 36 def empty? size == 0 end |
#size ⇒ Object
32 33 34 |
# File 'lib/segwit/tx_witness.rb', line 32 def size tx_in_wit.length end |
#to_payload ⇒ Object
output witness in raw binary format
26 27 28 29 30 |
# File 'lib/segwit/tx_witness.rb', line 26 def to_payload payload = "" @tx_in_wit.each{|w|payload << w.to_payload} payload end |