tabs -> spaces

This commit is contained in:
Wei Lu 2014-03-24 03:19:39 +08:00
parent eca20ad297
commit 9358a40500
3 changed files with 60 additions and 60 deletions

View file

@ -190,6 +190,6 @@ ECKey.prototype.verify = function (hash, sig) {
* Parse an exported private key contained in a string.
*/
module.exports = {
ECKey: ECKey,
ECPubKey: ECPubKey
ECKey: ECKey,
ECPubKey: ECPubKey
};

View file

@ -70,72 +70,72 @@ describe('ECKey', function() {
describe('toAddress', function() {
var privkeys = [
'CA48EC9783CF3AD0DFEFF1FC254395A2E403CBBC666477B61B45E31D3B8AB458',
'1111111111111111111111111111111111111111111111111111111111111111',
'18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725'
];
'CA48EC9783CF3AD0DFEFF1FC254395A2E403CBBC666477B61B45E31D3B8AB458',
'1111111111111111111111111111111111111111111111111111111111111111',
'18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725'
];
// compressed pubkeys
var cpubkeys = [
'024B12D9D7C77DB68388B6FF7C89046174C871546436806BCD80D07C28EA811992',
'034F355BDCB7CC0AF728EF3CCEB9615D90684BB5B2CA5F859AB0F0B704075871AA',
'0250863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2352'
];
// compressed pubkeys
var cpubkeys = [
'024B12D9D7C77DB68388B6FF7C89046174C871546436806BCD80D07C28EA811992',
'034F355BDCB7CC0AF728EF3CCEB9615D90684BB5B2CA5F859AB0F0B704075871AA',
'0250863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2352'
];
var pubkeys = cpubkeys.map(function(x) {
return new ECPubKey(x).pub.getEncoded(false);
});
var pubkeys = cpubkeys.map(function(x) {
return new ECPubKey(x).pub.getEncoded(false);
});
it('mainnet', function() {
var addresses = [
'19SgmoUj4xowEjwtXvNAtYTAgbvR9iBCui',
'1MsHWS1BnwMc3tLE8G35UXsS58fKipzB7a',
'16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM'
];
var compressedAddresses = [
'1AA4sjKW2aUmbtN3MtegdvhYtDBbDEke1q',
'1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9',
'1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs',
];
var addresses = [
'19SgmoUj4xowEjwtXvNAtYTAgbvR9iBCui',
'1MsHWS1BnwMc3tLE8G35UXsS58fKipzB7a',
'16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM'
];
var compressedAddresses = [
'1AA4sjKW2aUmbtN3MtegdvhYtDBbDEke1q',
'1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9',
'1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs',
];
for (var i = 0; i < addresses.length; ++i) {
var priv = new ECKey(privkeys[i], false);
var pubcomp = new ECPubKey(cpubkeys[i], true);
var pub = new ECPubKey(pubkeys[i], false);
for (var i = 0; i < addresses.length; ++i) {
var priv = new ECKey(privkeys[i], false);
var pubcomp = new ECPubKey(cpubkeys[i], true);
var pub = new ECPubKey(pubkeys[i], false);
var addr = addresses[i];
var caddr = compressedAddresses[i];
var addr = addresses[i];
var caddr = compressedAddresses[i];
assert.equal(priv.getAddress().toString(), addr);
assert.equal(pub.getAddress().toString(), addr);
assert.equal(pubcomp.getAddress().toString(), caddr);
}
assert.equal(priv.getAddress().toString(), addr);
assert.equal(pub.getAddress().toString(), addr);
assert.equal(pubcomp.getAddress().toString(), caddr);
}
})
it('testnet', function() {
var addresses = [
'19SgmoUj4xowEjwtXvNAtYTAgbvR9iBCui',
'1MsHWS1BnwMc3tLE8G35UXsS58fKipzB7a',
'16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM'
];
var compressedAddresses = [
'1AA4sjKW2aUmbtN3MtegdvhYtDBbDEke1q',
'1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9',
'1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs',
];
var addresses = [
'19SgmoUj4xowEjwtXvNAtYTAgbvR9iBCui',
'1MsHWS1BnwMc3tLE8G35UXsS58fKipzB7a',
'16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM'
];
var compressedAddresses = [
'1AA4sjKW2aUmbtN3MtegdvhYtDBbDEke1q',
'1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9',
'1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs',
];
for (var i = 0; i < addresses.length; ++i) {
var priv = new ECKey(privkeys[i], false);
var pubcomp = new ECPubKey(cpubkeys[i], true);
var pub = new ECPubKey(pubkeys[i], false);
for (var i = 0; i < addresses.length; ++i) {
var priv = new ECKey(privkeys[i], false);
var pubcomp = new ECPubKey(cpubkeys[i], true);
var pub = new ECPubKey(pubkeys[i], false);
var addr = addresses[i];
var caddr = compressedAddresses[i];
var addr = addresses[i];
var caddr = compressedAddresses[i];
assert.equal(priv.getAddress().toString(), addr);
assert.equal(pub.getAddress().toString(), addr);
assert.equal(pubcomp.getAddress().toString(), caddr);
}
assert.equal(priv.getAddress().toString(), addr);
assert.equal(pub.getAddress().toString(), addr);
assert.equal(pubcomp.getAddress().toString(), caddr);
}
})
});
})

View file

@ -33,10 +33,10 @@ describe('HDWallet', function() {
})
describe('constructor & seed deserialization', function() {
var expectedPrivateKey = '0fd71c652e847ba7ea7956e3cf3fc0a0985871846b1b2c23b9c6a29a38cee86001';
var expectedPrivateKey = '0fd71c652e847ba7ea7956e3cf3fc0a0985871846b1b2c23b9c6a29a38cee86001';
var seed = [
99, 114, 97, 122, 121, 32, 104, 111, 114, 115, 101, 32, 98,
97, 116, 116, 101, 114, 121, 32, 115, 116, 97, 112, 108, 101
99, 114, 97, 122, 121, 32, 104, 111, 114, 115, 101, 32, 98,
97, 116, 116, 101, 114, 121, 32, 115, 116, 97, 112, 108, 101
];
it('creates from binary seed', function() {
@ -244,12 +244,12 @@ describe('HDWallet', function() {
describe('network types', function() {
it('ensures that a mainnet Wallet generates mainnet addresses', function() {
var wallet = new HDWallet('foobar', 'mainnet')
assert.equal(wallet.getAddress().toString(), '1JNymexJHEr5u1BndiChMStFkCgPm4EQ6o');
assert.equal(wallet.getAddress().toString(), '1JNymexJHEr5u1BndiChMStFkCgPm4EQ6o');
})
it('ensures that a testnet Wallet generates testnet addresses', function() {
var wallet = new HDWallet('foobar', 'testnet')
assert.equal(wallet.getAddress().toString(), 'mxtw4i3H6GHLg7fQMHB5BN6acCH6kQ7aoY');
assert.equal(wallet.getAddress().toString(), 'mxtw4i3H6GHLg7fQMHB5BN6acCH6kQ7aoY');
})
it('throws an excption when unknown network type is passed in', function() {