Removed redundant code
This commit is contained in:
parent
fe64fb8855
commit
42e6df669e
10
lib/util.js
10
lib/util.js
|
@ -6,7 +6,7 @@ var bignum = require('bignum');
|
|||
|
||||
exports.addressFromEx = function(exAddress, ripdm160Key){
|
||||
try {
|
||||
var versionByte = base58.decode(exAddress).slice(0, 1);
|
||||
var versionByte = exports.getVersionByte(exAddress);
|
||||
var addrBase = Buffer.concat([versionByte, new Buffer(ripdm160Key, 'hex')]);
|
||||
var checksum = exports.sha256d(addrBase).slice(0, 4);
|
||||
var address = Buffer.concat([addrBase, checksum]);
|
||||
|
@ -18,6 +18,11 @@ exports.addressFromEx = function(exAddress, ripdm160Key){
|
|||
};
|
||||
|
||||
|
||||
exports.getVersionByte = function(addr){
|
||||
var versionByte = base58.decode(addr).slice(0, 1);
|
||||
return versionByte;
|
||||
};
|
||||
|
||||
exports.sha256 = function(buffer){
|
||||
var hash1 = crypto.createHash('sha256');
|
||||
hash1.update(buffer);
|
||||
|
@ -230,9 +235,6 @@ exports.range = function(start, stop, step){
|
|||
};
|
||||
|
||||
|
||||
exports.getVersionByte = function(addr){
|
||||
return base58.decode(addr)[0];
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue