@btc-vision/bitcoin 6.4.0 → 6.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,28 +1,28 @@
1
- import assert from 'assert';
2
- import { describe, it } from 'mocha';
3
- import * as bitcoin from '../../src/index.js';
4
-
5
- describe('bitcoinjs-lib (blocks)', () => {
6
- it('can extract a height from a CoinBase transaction', () => {
7
- // from 00000000000000000097669cdca131f24d40c4cc7d80eaa65967a2d09acf6ce6
8
- const txHex =
9
- '010000000001010000000000000000000000000000000000000000000000000000000' +
10
- '000000000ffffffff50037f9a07174d696e656420627920416e74506f6f6c685b205a' +
11
- '2b1f7bfabe6d6d36afe1910eca9405b66f97750940a656e38e2c0312958190ff8e98f' +
12
- 'd16761d220400000000000000aa340000d49f0000ffffffff02b07fc3660000000019' +
13
- '76a9148349212dc27ce3ab4c5b29b85c4dec643d764b1788ac0000000000000000266' +
14
- 'a24aa21a9ed72d9432948505e3d3062f1307a3f027a5dea846ff85e47159680919c12' +
15
- 'bf1e40012000000000000000000000000000000000000000000000000000000000000' +
16
- '0000000000000';
17
- const tx = bitcoin.Transaction.fromHex(txHex);
18
-
19
- assert.strictEqual(tx.ins.length, 1);
20
- const script = tx.ins[0].script;
21
- // bitcoin.script.decompile(script) // returns [] :(
22
-
23
- assert.strictEqual(script[0], 0x03);
24
- const heightBuffer = script.slice(1, 4);
25
- const height = bitcoin.script.number.decode(heightBuffer);
26
- assert.strictEqual(height, 498303);
27
- });
28
- });
1
+ import assert from 'assert';
2
+ import { describe, it } from 'mocha';
3
+ import * as bitcoin from '../../src/index.js';
4
+
5
+ describe('bitcoinjs-lib (blocks)', () => {
6
+ it('can extract a height from a CoinBase transaction', () => {
7
+ // from 00000000000000000097669cdca131f24d40c4cc7d80eaa65967a2d09acf6ce6
8
+ const txHex =
9
+ '010000000001010000000000000000000000000000000000000000000000000000000' +
10
+ '000000000ffffffff50037f9a07174d696e656420627920416e74506f6f6c685b205a' +
11
+ '2b1f7bfabe6d6d36afe1910eca9405b66f97750940a656e38e2c0312958190ff8e98f' +
12
+ 'd16761d220400000000000000aa340000d49f0000ffffffff02b07fc3660000000019' +
13
+ '76a9148349212dc27ce3ab4c5b29b85c4dec643d764b1788ac0000000000000000266' +
14
+ 'a24aa21a9ed72d9432948505e3d3062f1307a3f027a5dea846ff85e47159680919c12' +
15
+ 'bf1e40012000000000000000000000000000000000000000000000000000000000000' +
16
+ '0000000000000';
17
+ const tx = bitcoin.Transaction.fromHex(txHex);
18
+
19
+ assert.strictEqual(tx.ins.length, 1);
20
+ const script = tx.ins[0].script;
21
+ // bitcoin.script.decompile(script) // returns [] :(
22
+
23
+ assert.strictEqual(script[0], 0x03);
24
+ const heightBuffer = script.slice(1, 4);
25
+ const height = bitcoin.script.number.decode(heightBuffer);
26
+ assert.strictEqual(height, 498303);
27
+ });
28
+ });
@@ -1,241 +1,241 @@
1
- import assert from 'assert';
2
- import { ECPairFactory } from 'ecpair';
3
- import * as ecc from 'tiny-secp256k1';
4
- import { before, describe, it } from 'mocha';
5
- import * as bitcoin from '../../src/index.js';
6
- import { regtestUtils } from './_regtest.js';
7
-
8
- // @ts-ignore
9
- import bip65 from 'bip65';
10
-
11
- const ECPair = ECPairFactory(ecc);
12
- const regtest = regtestUtils.network;
13
-
14
- function toOutputScript(address: string): Buffer {
15
- return bitcoin.address.toOutputScript(address, regtest);
16
- }
17
-
18
- function idToHash(txid: string): Buffer {
19
- return Buffer.from(txid, 'hex').reverse();
20
- }
21
-
22
- const alice = ECPair.fromWIF('cScfkGjbzzoeewVWmU2hYPUHeVGJRDdFt7WhmrVVGkxpmPP8BHWe', regtest);
23
- const bob = ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsLwjHXA9x', regtest);
24
-
25
- describe('bitcoinjs-lib (transactions w/ CLTV)', () => {
26
- // force update MTP
27
- before(async () => {
28
- await regtestUtils.mine(11);
29
- });
30
-
31
- const hashType = bitcoin.Transaction.SIGHASH_ALL;
32
-
33
- interface KeyPair {
34
- publicKey: Buffer;
35
- }
36
-
37
- function cltvCheckSigOutput(aQ: KeyPair, bQ: KeyPair, lockTime: number): Buffer {
38
- return bitcoin.script.fromASM(
39
- `
40
- OP_IF
41
- ${bitcoin.script.number.encode(lockTime).toString('hex')}
42
- OP_CHECKLOCKTIMEVERIFY
43
- OP_DROP
44
- OP_ELSE
45
- ${bQ.publicKey.toString('hex')}
46
- OP_CHECKSIGVERIFY
47
- OP_ENDIF
48
- ${aQ.publicKey.toString('hex')}
49
- OP_CHECKSIG
50
- `
51
- .trim()
52
- .replace(/\s+/g, ' '),
53
- );
54
- }
55
-
56
- function utcNow(): number {
57
- return Math.floor(Date.now() / 1000);
58
- }
59
-
60
- // expiry past, {Alice's signature} OP_TRUE
61
- it(
62
- 'can create (and broadcast via 3PBP) a Transaction where Alice can redeem ' +
63
- 'the output after the expiry (in the past)',
64
- async () => {
65
- // 3 hours ago
66
- const lockTime = bip65.encode({ utc: utcNow() - 3600 * 3 });
67
- const redeemScript = cltvCheckSigOutput(alice, bob, lockTime);
68
- const { address } = bitcoin.payments.p2sh({
69
- redeem: { output: redeemScript, network: regtest },
70
- network: regtest,
71
- });
72
-
73
- // fund the P2SH(CLTV) address
74
- const unspent = await regtestUtils.faucet(address!, 1e5);
75
- const tx = new bitcoin.Transaction();
76
- tx.locktime = lockTime;
77
- // Note: nSequence MUST be <= 0xfffffffe otherwise OP_CHECKLOCKTIMEVERIFY will fail.
78
- tx.addInput(idToHash(unspent.txId), unspent.vout, 0xfffffffe);
79
- tx.addOutput(toOutputScript(regtestUtils.RANDOM_ADDRESS), 7e4);
80
-
81
- // {Alice's signature} OP_TRUE
82
- const signatureHash = tx.hashForSignature(0, redeemScript, hashType);
83
- const redeemScriptSig = bitcoin.payments.p2sh({
84
- redeem: {
85
- input: bitcoin.script.compile([
86
- bitcoin.script.signature.encode(alice.sign(signatureHash), hashType),
87
- bitcoin.opcodes.OP_TRUE,
88
- ]),
89
- output: redeemScript,
90
- },
91
- }).input;
92
- tx.setInputScript(0, redeemScriptSig!);
93
-
94
- await regtestUtils.broadcast(tx.toHex());
95
-
96
- await regtestUtils.verify({
97
- txId: tx.getId(),
98
- address: regtestUtils.RANDOM_ADDRESS,
99
- vout: 0,
100
- value: 7e4,
101
- });
102
- },
103
- );
104
-
105
- // expiry will pass, {Alice's signature} OP_TRUE
106
- it(
107
- 'can create (and broadcast via 3PBP) a Transaction where Alice can redeem ' +
108
- 'the output after the expiry (in the future)',
109
- async () => {
110
- const height = await regtestUtils.height();
111
- // 5 blocks from now
112
- const lockTime = bip65.encode({ blocks: height + 5 });
113
- const redeemScript = cltvCheckSigOutput(alice, bob, lockTime);
114
- const { address } = bitcoin.payments.p2sh({
115
- redeem: { output: redeemScript, network: regtest },
116
- network: regtest,
117
- });
118
-
119
- // fund the P2SH(CLTV) address
120
- const unspent = await regtestUtils.faucet(address!, 1e5);
121
- const tx = new bitcoin.Transaction();
122
- tx.locktime = lockTime;
123
- // Note: nSequence MUST be <= 0xfffffffe otherwise OP_CHECKLOCKTIMEVERIFY will fail.
124
- tx.addInput(idToHash(unspent.txId), unspent.vout, 0xfffffffe);
125
- tx.addOutput(toOutputScript(regtestUtils.RANDOM_ADDRESS), 7e4);
126
-
127
- // {Alice's signature} OP_TRUE
128
- const signatureHash = tx.hashForSignature(0, redeemScript, hashType);
129
- const redeemScriptSig = bitcoin.payments.p2sh({
130
- redeem: {
131
- input: bitcoin.script.compile([
132
- bitcoin.script.signature.encode(alice.sign(signatureHash), hashType),
133
- bitcoin.opcodes.OP_TRUE,
134
- ]),
135
- output: redeemScript,
136
- },
137
- }).input;
138
- tx.setInputScript(0, redeemScriptSig!);
139
-
140
- // TODO: test that it failures _prior_ to expiry, unfortunately, race conditions when run concurrently
141
- // ...
142
- // into the future!
143
- await regtestUtils.mine(5);
144
- await regtestUtils.broadcast(tx.toHex());
145
- await regtestUtils.verify({
146
- txId: tx.getId(),
147
- address: regtestUtils.RANDOM_ADDRESS,
148
- vout: 0,
149
- value: 7e4,
150
- });
151
- },
152
- );
153
-
154
- // expiry ignored, {Bob's signature} {Alice's signature} OP_FALSE
155
- it(
156
- 'can create (and broadcast via 3PBP) a Transaction where Alice and Bob can ' +
157
- 'redeem the output at any time',
158
- async () => {
159
- // two hours ago
160
- const lockTime = bip65.encode({ utc: utcNow() - 3600 * 2 });
161
- const redeemScript = cltvCheckSigOutput(alice, bob, lockTime);
162
- const { address } = bitcoin.payments.p2sh({
163
- redeem: { output: redeemScript, network: regtest },
164
- network: regtest,
165
- });
166
-
167
- // fund the P2SH(CLTV) address
168
- const unspent = await regtestUtils.faucet(address!, 2e5);
169
- const tx = new bitcoin.Transaction();
170
- tx.locktime = lockTime;
171
- // Note: nSequence MUST be <= 0xfffffffe otherwise OP_CHECKLOCKTIMEVERIFY will fail.
172
- tx.addInput(idToHash(unspent.txId), unspent.vout, 0xfffffffe);
173
- tx.addOutput(toOutputScript(regtestUtils.RANDOM_ADDRESS), 8e4);
174
-
175
- // {Alice's signature} {Bob's signature} OP_FALSE
176
- const signatureHash = tx.hashForSignature(0, redeemScript, hashType);
177
- const redeemScriptSig = bitcoin.payments.p2sh({
178
- redeem: {
179
- input: bitcoin.script.compile([
180
- bitcoin.script.signature.encode(alice.sign(signatureHash), hashType),
181
- bitcoin.script.signature.encode(bob.sign(signatureHash), hashType),
182
- bitcoin.opcodes.OP_FALSE,
183
- ]),
184
- output: redeemScript,
185
- },
186
- }).input;
187
- tx.setInputScript(0, redeemScriptSig!);
188
-
189
- await regtestUtils.broadcast(tx.toHex());
190
- await regtestUtils.verify({
191
- txId: tx.getId(),
192
- address: regtestUtils.RANDOM_ADDRESS,
193
- vout: 0,
194
- value: 8e4,
195
- });
196
- },
197
- );
198
-
199
- // expiry in the future, {Alice's signature} OP_TRUE
200
- it(
201
- 'can create (but fail to broadcast via 3PBP) a Transaction where Alice ' +
202
- 'attempts to redeem before the expiry',
203
- async () => {
204
- // two hours from now
205
- const lockTime = bip65.encode({ utc: utcNow() + 3600 * 2 });
206
- const redeemScript = cltvCheckSigOutput(alice, bob, lockTime);
207
- const { address } = bitcoin.payments.p2sh({
208
- redeem: { output: redeemScript, network: regtest },
209
- network: regtest,
210
- });
211
-
212
- // fund the P2SH(CLTV) address
213
- const unspent = await regtestUtils.faucet(address!, 2e4);
214
- const tx = new bitcoin.Transaction();
215
- tx.locktime = lockTime;
216
- // Note: nSequence MUST be <= 0xfffffffe otherwise OP_CHECKLOCKTIMEVERIFY will fail.
217
- tx.addInput(idToHash(unspent.txId), unspent.vout, 0xfffffffe);
218
- tx.addOutput(toOutputScript(regtestUtils.RANDOM_ADDRESS), 1e4);
219
-
220
- // {Alice's signature} OP_TRUE
221
- const signatureHash = tx.hashForSignature(0, redeemScript, hashType);
222
- const redeemScriptSig = bitcoin.payments.p2sh({
223
- redeem: {
224
- input: bitcoin.script.compile([
225
- bitcoin.script.signature.encode(alice.sign(signatureHash), hashType),
226
- bitcoin.script.signature.encode(bob.sign(signatureHash), hashType),
227
- bitcoin.opcodes.OP_TRUE,
228
- ]),
229
- output: redeemScript,
230
- },
231
- }).input;
232
- tx.setInputScript(0, redeemScriptSig!);
233
-
234
- await regtestUtils.broadcast(tx.toHex()).catch((err) => {
235
- assert.throws(() => {
236
- if (err) throw err;
237
- }, /Error: non-final/);
238
- });
239
- },
240
- );
241
- });
1
+ import assert from 'assert';
2
+ import { ECPairFactory } from 'ecpair';
3
+ import * as ecc from 'tiny-secp256k1';
4
+ import { before, describe, it } from 'mocha';
5
+ import * as bitcoin from '../../src/index.js';
6
+ import { regtestUtils } from './_regtest.js';
7
+
8
+ // @ts-ignore
9
+ import bip65 from 'bip65';
10
+
11
+ const ECPair = ECPairFactory(ecc);
12
+ const regtest = regtestUtils.network;
13
+
14
+ function toOutputScript(address: string): Buffer {
15
+ return bitcoin.address.toOutputScript(address, regtest);
16
+ }
17
+
18
+ function idToHash(txid: string): Buffer {
19
+ return Buffer.from(txid, 'hex').reverse();
20
+ }
21
+
22
+ const alice = ECPair.fromWIF('cScfkGjbzzoeewVWmU2hYPUHeVGJRDdFt7WhmrVVGkxpmPP8BHWe', regtest);
23
+ const bob = ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsLwjHXA9x', regtest);
24
+
25
+ describe('bitcoinjs-lib (transactions w/ CLTV)', () => {
26
+ // force update MTP
27
+ before(async () => {
28
+ await regtestUtils.mine(11);
29
+ });
30
+
31
+ const hashType = bitcoin.Transaction.SIGHASH_ALL;
32
+
33
+ interface KeyPair {
34
+ publicKey: Buffer;
35
+ }
36
+
37
+ function cltvCheckSigOutput(aQ: KeyPair, bQ: KeyPair, lockTime: number): Buffer {
38
+ return bitcoin.script.fromASM(
39
+ `
40
+ OP_IF
41
+ ${bitcoin.script.number.encode(lockTime).toString('hex')}
42
+ OP_CHECKLOCKTIMEVERIFY
43
+ OP_DROP
44
+ OP_ELSE
45
+ ${bQ.publicKey.toString('hex')}
46
+ OP_CHECKSIGVERIFY
47
+ OP_ENDIF
48
+ ${aQ.publicKey.toString('hex')}
49
+ OP_CHECKSIG
50
+ `
51
+ .trim()
52
+ .replace(/\s+/g, ' '),
53
+ );
54
+ }
55
+
56
+ function utcNow(): number {
57
+ return Math.floor(Date.now() / 1000);
58
+ }
59
+
60
+ // expiry past, {Alice's signature} OP_TRUE
61
+ it(
62
+ 'can create (and broadcast via 3PBP) a Transaction where Alice can redeem ' +
63
+ 'the output after the expiry (in the past)',
64
+ async () => {
65
+ // 3 hours ago
66
+ const lockTime = bip65.encode({ utc: utcNow() - 3600 * 3 });
67
+ const redeemScript = cltvCheckSigOutput(alice, bob, lockTime);
68
+ const { address } = bitcoin.payments.p2sh({
69
+ redeem: { output: redeemScript, network: regtest },
70
+ network: regtest,
71
+ });
72
+
73
+ // fund the P2SH(CLTV) address
74
+ const unspent = await regtestUtils.faucet(address!, 1e5);
75
+ const tx = new bitcoin.Transaction();
76
+ tx.locktime = lockTime;
77
+ // Note: nSequence MUST be <= 0xfffffffe otherwise OP_CHECKLOCKTIMEVERIFY will fail.
78
+ tx.addInput(idToHash(unspent.txId), unspent.vout, 0xfffffffe);
79
+ tx.addOutput(toOutputScript(regtestUtils.RANDOM_ADDRESS), 7e4);
80
+
81
+ // {Alice's signature} OP_TRUE
82
+ const signatureHash = tx.hashForSignature(0, redeemScript, hashType);
83
+ const redeemScriptSig = bitcoin.payments.p2sh({
84
+ redeem: {
85
+ input: bitcoin.script.compile([
86
+ bitcoin.script.signature.encode(alice.sign(signatureHash), hashType),
87
+ bitcoin.opcodes.OP_TRUE,
88
+ ]),
89
+ output: redeemScript,
90
+ },
91
+ }).input;
92
+ tx.setInputScript(0, redeemScriptSig!);
93
+
94
+ await regtestUtils.broadcast(tx.toHex());
95
+
96
+ await regtestUtils.verify({
97
+ txId: tx.getId(),
98
+ address: regtestUtils.RANDOM_ADDRESS,
99
+ vout: 0,
100
+ value: 7e4,
101
+ });
102
+ },
103
+ );
104
+
105
+ // expiry will pass, {Alice's signature} OP_TRUE
106
+ it(
107
+ 'can create (and broadcast via 3PBP) a Transaction where Alice can redeem ' +
108
+ 'the output after the expiry (in the future)',
109
+ async () => {
110
+ const height = await regtestUtils.height();
111
+ // 5 blocks from now
112
+ const lockTime = bip65.encode({ blocks: height + 5 });
113
+ const redeemScript = cltvCheckSigOutput(alice, bob, lockTime);
114
+ const { address } = bitcoin.payments.p2sh({
115
+ redeem: { output: redeemScript, network: regtest },
116
+ network: regtest,
117
+ });
118
+
119
+ // fund the P2SH(CLTV) address
120
+ const unspent = await regtestUtils.faucet(address!, 1e5);
121
+ const tx = new bitcoin.Transaction();
122
+ tx.locktime = lockTime;
123
+ // Note: nSequence MUST be <= 0xfffffffe otherwise OP_CHECKLOCKTIMEVERIFY will fail.
124
+ tx.addInput(idToHash(unspent.txId), unspent.vout, 0xfffffffe);
125
+ tx.addOutput(toOutputScript(regtestUtils.RANDOM_ADDRESS), 7e4);
126
+
127
+ // {Alice's signature} OP_TRUE
128
+ const signatureHash = tx.hashForSignature(0, redeemScript, hashType);
129
+ const redeemScriptSig = bitcoin.payments.p2sh({
130
+ redeem: {
131
+ input: bitcoin.script.compile([
132
+ bitcoin.script.signature.encode(alice.sign(signatureHash), hashType),
133
+ bitcoin.opcodes.OP_TRUE,
134
+ ]),
135
+ output: redeemScript,
136
+ },
137
+ }).input;
138
+ tx.setInputScript(0, redeemScriptSig!);
139
+
140
+ // TODO: test that it failures _prior_ to expiry, unfortunately, race conditions when run concurrently
141
+ // ...
142
+ // into the future!
143
+ await regtestUtils.mine(5);
144
+ await regtestUtils.broadcast(tx.toHex());
145
+ await regtestUtils.verify({
146
+ txId: tx.getId(),
147
+ address: regtestUtils.RANDOM_ADDRESS,
148
+ vout: 0,
149
+ value: 7e4,
150
+ });
151
+ },
152
+ );
153
+
154
+ // expiry ignored, {Bob's signature} {Alice's signature} OP_FALSE
155
+ it(
156
+ 'can create (and broadcast via 3PBP) a Transaction where Alice and Bob can ' +
157
+ 'redeem the output at any time',
158
+ async () => {
159
+ // two hours ago
160
+ const lockTime = bip65.encode({ utc: utcNow() - 3600 * 2 });
161
+ const redeemScript = cltvCheckSigOutput(alice, bob, lockTime);
162
+ const { address } = bitcoin.payments.p2sh({
163
+ redeem: { output: redeemScript, network: regtest },
164
+ network: regtest,
165
+ });
166
+
167
+ // fund the P2SH(CLTV) address
168
+ const unspent = await regtestUtils.faucet(address!, 2e5);
169
+ const tx = new bitcoin.Transaction();
170
+ tx.locktime = lockTime;
171
+ // Note: nSequence MUST be <= 0xfffffffe otherwise OP_CHECKLOCKTIMEVERIFY will fail.
172
+ tx.addInput(idToHash(unspent.txId), unspent.vout, 0xfffffffe);
173
+ tx.addOutput(toOutputScript(regtestUtils.RANDOM_ADDRESS), 8e4);
174
+
175
+ // {Alice's signature} {Bob's signature} OP_FALSE
176
+ const signatureHash = tx.hashForSignature(0, redeemScript, hashType);
177
+ const redeemScriptSig = bitcoin.payments.p2sh({
178
+ redeem: {
179
+ input: bitcoin.script.compile([
180
+ bitcoin.script.signature.encode(alice.sign(signatureHash), hashType),
181
+ bitcoin.script.signature.encode(bob.sign(signatureHash), hashType),
182
+ bitcoin.opcodes.OP_FALSE,
183
+ ]),
184
+ output: redeemScript,
185
+ },
186
+ }).input;
187
+ tx.setInputScript(0, redeemScriptSig!);
188
+
189
+ await regtestUtils.broadcast(tx.toHex());
190
+ await regtestUtils.verify({
191
+ txId: tx.getId(),
192
+ address: regtestUtils.RANDOM_ADDRESS,
193
+ vout: 0,
194
+ value: 8e4,
195
+ });
196
+ },
197
+ );
198
+
199
+ // expiry in the future, {Alice's signature} OP_TRUE
200
+ it(
201
+ 'can create (but fail to broadcast via 3PBP) a Transaction where Alice ' +
202
+ 'attempts to redeem before the expiry',
203
+ async () => {
204
+ // two hours from now
205
+ const lockTime = bip65.encode({ utc: utcNow() + 3600 * 2 });
206
+ const redeemScript = cltvCheckSigOutput(alice, bob, lockTime);
207
+ const { address } = bitcoin.payments.p2sh({
208
+ redeem: { output: redeemScript, network: regtest },
209
+ network: regtest,
210
+ });
211
+
212
+ // fund the P2SH(CLTV) address
213
+ const unspent = await regtestUtils.faucet(address!, 2e4);
214
+ const tx = new bitcoin.Transaction();
215
+ tx.locktime = lockTime;
216
+ // Note: nSequence MUST be <= 0xfffffffe otherwise OP_CHECKLOCKTIMEVERIFY will fail.
217
+ tx.addInput(idToHash(unspent.txId), unspent.vout, 0xfffffffe);
218
+ tx.addOutput(toOutputScript(regtestUtils.RANDOM_ADDRESS), 1e4);
219
+
220
+ // {Alice's signature} OP_TRUE
221
+ const signatureHash = tx.hashForSignature(0, redeemScript, hashType);
222
+ const redeemScriptSig = bitcoin.payments.p2sh({
223
+ redeem: {
224
+ input: bitcoin.script.compile([
225
+ bitcoin.script.signature.encode(alice.sign(signatureHash), hashType),
226
+ bitcoin.script.signature.encode(bob.sign(signatureHash), hashType),
227
+ bitcoin.opcodes.OP_TRUE,
228
+ ]),
229
+ output: redeemScript,
230
+ },
231
+ }).input;
232
+ tx.setInputScript(0, redeemScriptSig!);
233
+
234
+ await regtestUtils.broadcast(tx.toHex()).catch((err) => {
235
+ assert.throws(() => {
236
+ if (err) throw err;
237
+ }, /Error: non-final/);
238
+ });
239
+ },
240
+ );
241
+ });