Class: Bitcoin::Protocol::TxWitness

Inherits:
Object
  • Object
show all
Defined in:
lib/segwit/tx_witness.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTxWitness

Returns a new instance of TxWitness.



5
6
7
# File 'lib/segwit/tx_witness.rb', line 5

def initialize
  @tx_in_wit = []
end

Instance Attribute Details

#tx_in_witObject (readonly)

Returns the value of attribute tx_in_wit.



3
4
5
# File 'lib/segwit/tx_witness.rb', line 3

def tx_in_wit
  @tx_in_wit
end

Instance Method Details

#add_witness(tx_in_wit) ⇒ Object

Add witness @param tx_in_wit witness object



11
12
13
# File 'lib/segwit/tx_witness.rb', line 11

def add_witness(tx_in_wit)
  (@tx_in_wit ||= []) << tx_in_wit
end

#to_payloadObject

output witness in raw binary format



16
17
18
19
20
# File 'lib/segwit/tx_witness.rb', line 16

def to_payload
  payload = ""
  tx_in_wit.each{|w|payload << w.to_payload}
  payload
end