Skip to content

Commit 6afd4b0

Browse files
authored
Merge pull request bitcoinjs#1183 from bitcoinjs/delays
integration tests: 1 timeout to rule them
2 parents fbaad04 + ad6fa57 commit 6afd4b0

File tree

6 files changed

+1
-33
lines changed

6 files changed

+1
-33
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"coverage-report": "nyc report --reporter=lcov",
1818
"coverage-html": "nyc report --reporter=html",
1919
"coverage": "nyc --check-coverage --branches 90 --functions 90 mocha",
20-
"integration": "mocha test/integration/",
20+
"integration": "mocha --timeout 50000 test/integration/",
2121
"standard": "standard",
2222
"test": "npm run standard && npm run coverage",
2323
"unit": "mocha"

test/integration/cltv.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const bob = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZs
1212
describe('bitcoinjs-lib (transactions w/ CLTV)', function () {
1313
// force update MTP
1414
before(function (done) {
15-
this.timeout(30000)
1615
regtestUtils.mine(11, done)
1716
})
1817

@@ -41,8 +40,6 @@ describe('bitcoinjs-lib (transactions w/ CLTV)', function () {
4140

4241
// expiry past, {Alice's signature} OP_TRUE
4342
it('can create (and broadcast via 3PBP) a Transaction where Alice can redeem the output after the expiry (in the past)', function (done) {
44-
this.timeout(30000)
45-
4643
// 3 hours ago
4744
const lockTime = bip65.encode({ utc: utcNow() - (3600 * 3) })
4845
const redeemScript = cltvCheckSigOutput(alice, bob, lockTime)
@@ -86,8 +83,6 @@ describe('bitcoinjs-lib (transactions w/ CLTV)', function () {
8683

8784
// expiry will pass, {Alice's signature} OP_TRUE
8885
it('can create (and broadcast via 3PBP) a Transaction where Alice can redeem the output after the expiry (in the future)', function (done) {
89-
this.timeout(30000)
90-
9186
regtestUtils.height(function (err, height) {
9287
if (err) return done(err)
9388

@@ -142,8 +137,6 @@ describe('bitcoinjs-lib (transactions w/ CLTV)', function () {
142137

143138
// expiry ignored, {Bob's signature} {Alice's signature} OP_FALSE
144139
it('can create (and broadcast via 3PBP) a Transaction where Alice and Bob can redeem the output at any time', function (done) {
145-
this.timeout(30000)
146-
147140
// two hours ago
148141
const lockTime = bip65.encode({ utc: utcNow() - (3600 * 2) })
149142
const redeemScript = cltvCheckSigOutput(alice, bob, lockTime)
@@ -188,8 +181,6 @@ describe('bitcoinjs-lib (transactions w/ CLTV)', function () {
188181

189182
// expiry in the future, {Alice's signature} OP_TRUE
190183
it('can create (but fail to broadcast via 3PBP) a Transaction where Alice attempts to redeem before the expiry', function (done) {
191-
this.timeout(30000)
192-
193184
// two hours from now
194185
const lockTime = bip65.encode({ utc: utcNow() + (3600 * 2) })
195186
const redeemScript = cltvCheckSigOutput(alice, bob, lockTime)

test/integration/crypto.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ const tinysecp = require('tiny-secp256k1')
99

1010
describe('bitcoinjs-lib (crypto)', function () {
1111
it('can recover a private key from duplicate R values', function () {
12-
this.timeout(30000)
13-
1412
// https://blockchain.info/tx/f4c16475f2a6e9c602e4a287f9db3040e319eb9ece74761a4b84bc820fbeef50
1513
const tx = bitcoin.Transaction.fromHex('01000000020b668015b32a6178d8524cfef6dc6fc0a4751915c2e9b2ed2d2eab02424341c8000000006a47304402205e00298dc5265b7a914974c9d0298aa0e69a0ca932cb52a360436d6a622e5cd7022024bf5f506968f5f23f1835574d5afe0e9021b4a5b65cf9742332d5e4acb68f41012103fd089f73735129f3d798a657aaaa4aa62a00fa15c76b61fc7f1b27ed1d0f35b8ffffffffa95fa69f11dc1cbb77ef64f25a95d4b12ebda57d19d843333819d95c9172ff89000000006b48304502205e00298dc5265b7a914974c9d0298aa0e69a0ca932cb52a360436d6a622e5cd7022100832176b59e8f50c56631acbc824bcba936c9476c559c42a4468be98975d07562012103fd089f73735129f3d798a657aaaa4aa62a00fa15c76b61fc7f1b27ed1d0f35b8ffffffff02b000eb04000000001976a91472956eed9a8ecb19ae7e3ebd7b06cae4668696a788ac303db000000000001976a9146c0bd55dd2592287cd9992ce3ba3fc1208fb76da88ac00000000')
1614

test/integration/csv.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const bob = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZs
1212
describe('bitcoinjs-lib (transactions w/ CSV)', function () {
1313
// force update MTP
1414
before(function (done) {
15-
this.timeout(30000)
1615
regtestUtils.mine(11, done)
1716
})
1817

@@ -38,8 +37,6 @@ describe('bitcoinjs-lib (transactions w/ CSV)', function () {
3837

3938
// expiry will pass, {Alice's signature} OP_TRUE
4039
it('can create (and broadcast via 3PBP) a Transaction where Alice can redeem the output after the expiry (in the future)', function (done) {
41-
this.timeout(30000)
42-
4340
regtestUtils.height(function (err, height) {
4441
if (err) return done(err)
4542

@@ -99,8 +96,6 @@ describe('bitcoinjs-lib (transactions w/ CSV)', function () {
9996

10097
// expiry in the future, {Alice's signature} OP_TRUE
10198
it('can create (but fail to broadcast via 3PBP) a Transaction where Alice attempts to redeem before the expiry', function (done) {
102-
this.timeout(30000)
103-
10499
// two hours after confirmation
105100
const sequence = bip68.encode({ seconds: 7168 })
106101
const p2sh = bitcoin.payments.p2sh({

test/integration/payments.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ function buildAndSign (depends, prevOutput, redeemScript, witnessScript, done) {
4343
if (!output) throw new TypeError('Missing output')
4444

4545
describe('bitcoinjs-lib (payments - ' + k + ')', function () {
46-
this.timeout(30000)
47-
4846
it('can broadcast as an output, and be spent as an input', (done) => {
4947
buildAndSign(depends, output, null, null, done)
5048
})

test/integration/transactions.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ describe('bitcoinjs-lib (transactions)', function () {
4545
})
4646

4747
it('can create (and broadcast via 3PBP) a typical Transaction', function (done) {
48-
this.timeout(30000)
49-
5048
const alice1 = bitcoin.ECPair.makeRandom({ network: regtest })
5149
const alice2 = bitcoin.ECPair.makeRandom({ network: regtest })
5250
const aliceChange = bitcoin.ECPair.makeRandom({ network: regtest, rng: rng })
@@ -81,8 +79,6 @@ describe('bitcoinjs-lib (transactions)', function () {
8179
})
8280

8381
it('can create (and broadcast via 3PBP) a Transaction with an OP_RETURN output', function (done) {
84-
this.timeout(30000)
85-
8682
const keyPair = bitcoin.ECPair.makeRandom({ network: regtest })
8783
const p2pkh = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey, network: regtest })
8884

@@ -103,8 +99,6 @@ describe('bitcoinjs-lib (transactions)', function () {
10399
})
104100

105101
it('can create (and broadcast via 3PBP) a Transaction, w/ a P2SH(P2MS(2 of 4)) (multisig) input', function (done) {
106-
this.timeout(30000)
107-
108102
const keyPairs = [
109103
bitcoin.ECPair.makeRandom({ network: regtest }),
110104
bitcoin.ECPair.makeRandom({ network: regtest }),
@@ -141,8 +135,6 @@ describe('bitcoinjs-lib (transactions)', function () {
141135
})
142136

143137
it('can create (and broadcast via 3PBP) a Transaction, w/ a P2SH(P2WPKH) input', function (done) {
144-
this.timeout(30000)
145-
146138
const keyPair = bitcoin.ECPair.makeRandom({ network: regtest })
147139
const p2wpkh = bitcoin.payments.p2wpkh({ pubkey: keyPair.publicKey, network: regtest })
148140
const p2sh = bitcoin.payments.p2sh({ redeem: p2wpkh, network: regtest })
@@ -172,8 +164,6 @@ describe('bitcoinjs-lib (transactions)', function () {
172164
})
173165

174166
it('can create (and broadcast via 3PBP) a Transaction, w/ a P2WPKH input', function (done) {
175-
this.timeout(30000)
176-
177167
const keyPair = bitcoin.ECPair.makeRandom({ network: regtest })
178168
const p2wpkh = bitcoin.payments.p2wpkh({ pubkey: keyPair.publicKey, network: regtest })
179169

@@ -202,8 +192,6 @@ describe('bitcoinjs-lib (transactions)', function () {
202192
})
203193

204194
it('can create (and broadcast via 3PBP) a Transaction, w/ a P2WSH(P2PK) input', function (done) {
205-
this.timeout(30000)
206-
207195
const keyPair = bitcoin.ECPair.makeRandom({ network: regtest })
208196
const p2pk = bitcoin.payments.p2pk({ pubkey: keyPair.publicKey, network: regtest })
209197
const p2wsh = bitcoin.payments.p2wsh({ redeem: p2pk, network: regtest })
@@ -233,8 +221,6 @@ describe('bitcoinjs-lib (transactions)', function () {
233221
})
234222

235223
it('can create (and broadcast via 3PBP) a Transaction, w/ a P2SH(P2WSH(P2MS(3 of 4))) (SegWit multisig) input', function (done) {
236-
this.timeout(50000)
237-
238224
const keyPairs = [
239225
bitcoin.ECPair.makeRandom({ network: regtest }),
240226
bitcoin.ECPair.makeRandom({ network: regtest }),

0 commit comments

Comments
 (0)