lib/segwit/script_witness.rb in openassets-ruby-0.6.1 vs lib/segwit/script_witness.rb in openassets-ruby-0.6.2

- old
+ new

@@ -1,23 +1,35 @@ -class Bitcoin::Protocol::ScriptWitness +# encoding: ascii-8bit - # witness stack - attr_reader :stack +module Bitcoin - def initialize - @stack = [] - end + module Protocol - def empty? - stack.empty? - end + class ScriptWitness - # output script in raw binary format - def to_payload - payload = Bitcoin::Protocol.pack_var_int(stack.size) - stack.each{|e| - payload << Bitcoin::Protocol.pack_var_int(e.htb.bytesize) - payload << e.htb - } - payload + # witness stack + attr_reader :stack + + def initialize + @stack = [] + end + + # check empty + def empty? + stack.empty? + end + + # output script in raw binary format + def to_payload + payload = Bitcoin::Protocol.pack_var_int(stack.size) + stack.each{|e| + payload << Bitcoin::Protocol.pack_var_int(e.htb.bytesize) + payload << e.htb + } + payload + end + + end + end + end \ No newline at end of file