HD wallet versions: Bitcoin -> prod, BitcoinTest -> testnet

This commit is contained in:
Wei Lu 2014-02-28 14:27:31 +08:00
parent c352868080
commit 293c864f4f
3 changed files with 12 additions and 13 deletions

View file

@ -11,8 +11,8 @@ describe('Wallet', function() {
wallet = new Wallet(seed)
})
it('defaults to Bitcoin network', function() {
assert.equal(wallet.getMasterKey().network, 'Bitcoin')
it('defaults to Bitcoin mainnet', function() {
assert.equal(wallet.getMasterKey().network, 'prod')
})
it('defaults to private derivationMethod', function() {
@ -23,11 +23,11 @@ describe('Wallet', function() {
describe('constructor options', function() {
var wallet;
beforeEach(function() {
wallet = new Wallet(seed, {network: 'Test', derivationMethod: 'public'})
wallet = new Wallet(seed, {network: 'testnet', derivationMethod: 'public'})
})
it('uses the network if specified', function() {
assert.equal(wallet.getMasterKey().network, 'Test')
assert.equal(wallet.getMasterKey().network, 'testnet')
})
it('uses the derivationMethod if specified', function() {
@ -37,14 +37,14 @@ describe('Wallet', function() {
describe('networkType', function() {
it('ensures that a mainnet Wallet has mainnet child keys (pub and priv)', function() {
var w = Wallet("foobar", {network: "Bitcoin"})
var w = Wallet("foobar", {network: "prod"})
assert(w.getMasterKey().priv.version == Address.address_types['prod'])
w.generateAddress()
assert(w.getPrivateKey(0).priv.version == Address.address_types['prod'])
})
it('ensures that a testnet Wallet has testnet child keys (pub and priv)', function() {
var w = Wallet("foobar", {network: "BitcoinTest"})
var w = Wallet("foobar", {network: "testnet"})
assert(w.getMasterKey().priv.version == Address.address_types['testnet'])
w.generateAddress()
assert(w.getPrivateKey(0).priv.version == Address.address_types['testnet'])