Module: SegwitScript
- Included in:
- Bitcoin::Script
- Defined in:
- lib/segwit/script.rb
Instance Method Summary collapse
-
#is_standard? ⇒ Boolean
override Bitcoin::Script#is_standard? Add P2WPKH and P2WSH to the standard.
- #is_witness_v0_keyhash? ⇒ Boolean
- #is_witness_v0_scripthash? ⇒ Boolean
-
#type ⇒ Object
override Bitcoin::Script#type Add type witness_v0_keyhash and witness_v0_scripthash.
Instance Method Details
#is_standard? ⇒ Boolean
override Bitcoin::Script#is_standard? Add P2WPKH and P2WSH to the standard
5 6 7 |
# File 'lib/segwit/script.rb', line 5 def is_standard? super || is_witness_v0_keyhash? || is_witness_v0_scripthash? end |
#is_witness_v0_keyhash? ⇒ Boolean
10 11 12 |
# File 'lib/segwit/script.rb', line 10 def is_witness_v0_keyhash? @chunks.length == 2 &&@chunks[0] == 0 && @chunks[1].bytesize == 20 end |
#is_witness_v0_scripthash? ⇒ Boolean
15 16 17 |
# File 'lib/segwit/script.rb', line 15 def is_witness_v0_scripthash? @chunks.length == 2 &&@chunks[0] == 0 && @chunks[1].bytesize == 32 end |
#type ⇒ Object
override Bitcoin::Script#type Add type witness_v0_keyhash and witness_v0_scripthash
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/segwit/script.rb', line 21 def type base = super if base == :unknown return :witness_v0_keyhash if is_witness_v0_keyhash? return :witness_v0_scripthash if is_witness_v0_scripthash? :unknown else base end end |