primitives: use equals instead of equal for consistency.
This commit is contained in:
parent
33c32d32c1
commit
edebc51d18
@ -393,9 +393,8 @@ HDPrivateKey.prototype.derivePath = function derivePath(path) {
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
HDPrivateKey.prototype.equal = function equal(obj) {
|
||||
if (!HDPrivateKey.isHDPrivateKey(obj))
|
||||
return false;
|
||||
HDPrivateKey.prototype.equals = function equals(obj) {
|
||||
assert(HDPrivateKey.isHDPrivateKey(obj));
|
||||
|
||||
return this.network === obj.network
|
||||
&& this.depth === obj.depth
|
||||
|
||||
@ -315,9 +315,8 @@ HDPublicKey.prototype.derivePath = function derivePath(path) {
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
HDPublicKey.prototype.equal = function equal(obj) {
|
||||
if (!HDPublicKey.isHDPublicKey(obj))
|
||||
return false;
|
||||
HDPublicKey.prototype.equals = function equals(obj) {
|
||||
assert(HDPublicKey.isHDPublicKey(obj));
|
||||
|
||||
return this.network === obj.network
|
||||
&& this.depth === obj.depth
|
||||
|
||||
@ -119,6 +119,21 @@ Address.prototype.isNull = function isNull() {
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Test equality against another address.
|
||||
* @param {Address} addr
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
Address.prototype.equals = function equals(addr) {
|
||||
assert(addr instanceof Address);
|
||||
|
||||
return this.network === addr.network
|
||||
&& this.type === addr.type
|
||||
&& this.version === addr.version
|
||||
&& this.hash.equals(addr.hash);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the address type as a string.
|
||||
* @returns {String}
|
||||
|
||||
@ -85,7 +85,7 @@ SigCache.prototype.has = function has(hash, sig, key) {
|
||||
if (!entry)
|
||||
return false;
|
||||
|
||||
return entry.equal(sig, key);
|
||||
return entry.equals(sig, key);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -138,7 +138,7 @@ function SigCacheEntry(sig, key) {
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
SigCacheEntry.prototype.equal = function equal(sig, key) {
|
||||
SigCacheEntry.prototype.equals = function equals(sig, key) {
|
||||
return this.sig.equals(sig) && this.key.equals(key);
|
||||
};
|
||||
|
||||
|
||||
@ -289,7 +289,7 @@ Account.prototype.pushKey = function pushKey(key) {
|
||||
if (this.type !== Account.types.MULTISIG)
|
||||
throw new Error('Cannot add keys to non-multisig wallet.');
|
||||
|
||||
if (key.equal(this.accountKey))
|
||||
if (key.equals(this.accountKey))
|
||||
throw new Error('Cannot add own key.');
|
||||
|
||||
const index = util.binaryInsert(this.keys, key, cmp, true);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user