Network.isNetwork.

This commit is contained in:
Christopher Jeffrey 2016-05-16 13:20:36 -07:00
parent 48f8edbe80
commit 052c18e091
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 13 additions and 1 deletions

View File

@ -91,7 +91,6 @@ Address.prototype.toScript = function toScript() {
*/ */
Address.prototype.toString = function toString() { Address.prototype.toString = function toString() {
assert(false, 'Cannot toString an address.');
return this.toBase58(); return this.toBase58();
}; };

View File

@ -161,6 +161,19 @@ Network.prototype.inspect = function inspect() {
return '<Network: ' + this.type + '>'; return '<Network: ' + this.type + '>';
}; };
/**
* Test an object to see if it is a Network.
* @param {Object} obj
* @returns {Boolean}
*/
Network.isNetwork = function isNetwork(obj) {
return obj
&& typeof obj.getMinRelay === 'function'
&& typeof obj.genesisBlock === 'string'
&& typeof obj.pow === 'object';
};
/* /*
* Expose * Expose
*/ */