spec/bitcoin/builder_spec.rb in bitcoin-ruby-0.0.10 vs spec/bitcoin/builder_spec.rb in bitcoin-ruby-0.0.11

- old
+ new

@@ -90,9 +90,21 @@ Bitcoin::Script.new(tx2.out[0].pk_script).to_string.should == "OP_DUP OP_HASH160 #{@keys[1].hash160} OP_EQUALVERIFY OP_CHECKSIG" tx2.out[2].value.should == 0 end + it "should build transactions with p2wpkh signatures" do + key = Bitcoin::Key.new('619c335025c7f4012e556c2a58b2506e30b8511b53ade95ea316fd8c3286feb9') + script_pubkey = '00141d0f172a0ecb48aee1be1f2687d2963ae33f71a1'.htb + tx = build_tx do |t| + t.input do |i| + i.prev_out '8ac60eb9575db5b2d987e29f301b5b819ea83a5c6579d282d189cc04b8e151ef', 1, script_pubkey, 600000000 + i.signature_key key + end + end + tx.verify_witness_input_signature(0, script_pubkey, 600000000).should == true + end + it "should allow txin.prev_out as tx or hash" do prev_tx = @block.tx[0] tx1 = build_tx do |t| t.input {|i| i.prev_out prev_tx, 0 } end