Class: Bitcoin::Descriptor::Wsh
Overview
Instance Attribute Summary
#script
Instance Method Summary
collapse
#args, #initialize
Methods inherited from Expression
#==, #args, #compressed_key?, #derive_path, #extract_pubkey, #to_hex, #to_s
Instance Method Details
#to_script ⇒ Object
10
11
12
|
# File 'lib/bitcoin/descriptor/wsh.rb', line 10
def to_script
Script.to_p2wsh(script.to_script)
end
|
#top_level? ⇒ Boolean
14
15
16
|
# File 'lib/bitcoin/descriptor/wsh.rb', line 14
def top_level?
false
end
|
#type ⇒ Object
6
7
8
|
# File 'lib/bitcoin/descriptor/wsh.rb', line 6
def type
:wsh
end
|
#validate!(script) ⇒ Object
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/bitcoin/descriptor/wsh.rb', line 18
def validate!(script)
super(script)
raise ArgumentError, 'A function is needed within P2WSH.' unless script.is_a?(Expression)
if script.is_a?(Wpkh) || script.is_a?(Wsh)
raise ArgumentError, "Can only have #{script.type}() at top level or inside sh()."
end
if script.to_script.get_pubkeys.any?{|p|!compressed_key?(p)}
raise ArgumentError, "Uncompressed key are not allowed."
end
end
|