tests: bitcoin/core check WIF exports correctly
This commit is contained in:
parent
ff3b1bd395
commit
376c6533f1
1 changed files with 6 additions and 4 deletions
|
@ -96,17 +96,19 @@ describe('Bitcoin-core', function() {
|
||||||
var string = f[0]
|
var string = f[0]
|
||||||
var hex = f[1]
|
var hex = f[1]
|
||||||
var params = f[2]
|
var params = f[2]
|
||||||
var network = networks.bitcoin
|
var network = params.isTestnet ? networks.testnet : networks.bitcoin
|
||||||
|
|
||||||
if (!params.isPrivkey) return
|
if (!params.isPrivkey) return
|
||||||
if (params.isTestnet) network = networks.testnet
|
var privKey = ECKey.fromWIF(string)
|
||||||
|
|
||||||
it('imports ' + string + ' correctly', function() {
|
it('imports ' + string + ' correctly', function() {
|
||||||
var privKey = ECKey.fromWIF(string)
|
|
||||||
|
|
||||||
assert.equal(privKey.d.toHex(), hex)
|
assert.equal(privKey.d.toHex(), hex)
|
||||||
assert.equal(privKey.pub.compressed, params.isCompressed)
|
assert.equal(privKey.pub.compressed, params.isCompressed)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('exports ' + hex + ' to ' + string, function() {
|
||||||
|
assert.equal(privKey.toWIF(network), string)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue