Merge pull request #1106 from bitcoinjs/reglimits

tests: use random keys to prevent db limitations
This commit is contained in:
Jonathan Underwood 2018-06-21 14:32:52 +09:00 committed by GitHub
commit 8341faeecf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -109,13 +109,13 @@ describe('bitcoinjs-lib (transactions)', function () {
it('can create (and broadcast via 3PBP) a Transaction with a 2-of-4 P2SH(multisig) input', function (done) { it('can create (and broadcast via 3PBP) a Transaction with a 2-of-4 P2SH(multisig) input', function (done) {
this.timeout(30000) this.timeout(30000)
var keyPairs = [ const keyPairs = [
'91avARGdfge8E4tZfYLoxeJ5sGBdNJQH4kvjJoQFacbgwmaKkrx', bitcoin.ECPair.makeRandom({ network: regtest }),
'91avARGdfge8E4tZfYLoxeJ5sGBdNJQH4kvjJoQFacbgww7vXtT', bitcoin.ECPair.makeRandom({ network: regtest }),
'91avARGdfge8E4tZfYLoxeJ5sGBdNJQH4kvjJoQFacbgx3cTMqe', bitcoin.ECPair.makeRandom({ network: regtest }),
'91avARGdfge8E4tZfYLoxeJ5sGBdNJQH4kvjJoQFacbgx9rcrL7' bitcoin.ECPair.makeRandom({ network: regtest })
].map(function (wif) { return bitcoin.ECPair.fromWIF(wif, regtest) }) ]
var pubKeys = keyPairs.map(function (x) { return x.publicKey }) const pubKeys = keyPairs.map(function (x) { return x.publicKey })
var redeemScript = bitcoin.script.multisig.output.encode(2, pubKeys) var redeemScript = bitcoin.script.multisig.output.encode(2, pubKeys)
var scriptPubKey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript)) var scriptPubKey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript))
@ -149,8 +149,8 @@ describe('bitcoinjs-lib (transactions)', function () {
it('can create (and broadcast via 3PBP) a Transaction with a SegWit P2SH(P2WPKH) input', function (done) { it('can create (and broadcast via 3PBP) a Transaction with a SegWit P2SH(P2WPKH) input', function (done) {
this.timeout(30000) this.timeout(30000)
var keyPair = bitcoin.ECPair.fromWIF('cMahea7zqjxrtgAbB7LSGbcQUr1uX1ojuat9jZodMN87JcbXMTcA', regtest) const keyPair = bitcoin.ECPair.makeRandom({ network: regtest })
var pubKeyHash = bitcoin.crypto.hash160(keyPair.publicKey) const pubKeyHash = bitcoin.crypto.hash160(keyPair.publicKey)
var redeemScript = bitcoin.script.witnessPubKeyHash.output.encode(pubKeyHash) var redeemScript = bitcoin.script.witnessPubKeyHash.output.encode(pubKeyHash)
var redeemScriptHash = bitcoin.crypto.hash160(redeemScript) var redeemScriptHash = bitcoin.crypto.hash160(redeemScript)
@ -184,13 +184,13 @@ describe('bitcoinjs-lib (transactions)', function () {
it('can create (and broadcast via 3PBP) a Transaction with a SegWit 3-of-4 P2SH(P2WSH(multisig)) input', function (done) { it('can create (and broadcast via 3PBP) a Transaction with a SegWit 3-of-4 P2SH(P2WSH(multisig)) input', function (done) {
this.timeout(50000) this.timeout(50000)
var keyPairs = [ const keyPairs = [
'cMahea7zqjxrtgAbB7LSGbcQUr1uX1ojuat9jZodMN87JcbXMTcA', bitcoin.ECPair.makeRandom({ network: regtest }),
'cMahea7zqjxrtgAbB7LSGbcQUr1uX1ojuat9jZodMN87K7XCyj5v', bitcoin.ECPair.makeRandom({ network: regtest }),
'cMahea7zqjxrtgAbB7LSGbcQUr1uX1ojuat9jZodMN87KcLPVfXz', bitcoin.ECPair.makeRandom({ network: regtest }),
'cMahea7zqjxrtgAbB7LSGbcQUr1uX1ojuat9jZodMN87L7FgDCKE' bitcoin.ECPair.makeRandom({ network: regtest })
].map(function (wif) { return bitcoin.ECPair.fromWIF(wif, regtest) }) ]
var pubKeys = keyPairs.map(function (x) { return x.publicKey }) const pubKeys = keyPairs.map(function (x) { return x.publicKey })
var witnessScript = bitcoin.script.multisig.output.encode(3, pubKeys) var witnessScript = bitcoin.script.multisig.output.encode(3, pubKeys)
var redeemScript = bitcoin.script.witnessScriptHash.output.encode(bitcoin.crypto.sha256(witnessScript)) var redeemScript = bitcoin.script.witnessScriptHash.output.encode(bitcoin.crypto.sha256(witnessScript))