address: improve isNull.
This commit is contained in:
parent
41d9493cc7
commit
5915338407
@ -138,7 +138,20 @@ Address.prototype.verifyNetwork = function verifyNetwork(network) {
|
||||
*/
|
||||
|
||||
Address.prototype.isNull = function isNull() {
|
||||
return util.equal(this.hash, encoding.ZERO_HASH160);
|
||||
var i;
|
||||
|
||||
if (this.hash.length === 20)
|
||||
return util.equal(this.hash, encoding.ZERO_HASH160);
|
||||
|
||||
if (this.hash.length === 32)
|
||||
return util.equal(this.hash, encoding.ZERO_HASH);
|
||||
|
||||
for (i = 0; i < this.hash.length; i++) {
|
||||
if (this.hash[i] !== 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user