minor.
This commit is contained in:
parent
b6ce94cec3
commit
634290687b
@ -438,25 +438,6 @@ Input.prototype.test = function test(addressMap) {
|
||||
*/
|
||||
|
||||
Input.prototype.inspect = function inspect() {
|
||||
var coin;
|
||||
|
||||
if (this.coin) {
|
||||
coin = this.coin;
|
||||
} else {
|
||||
coin = {
|
||||
type: 'unknown',
|
||||
version: 1,
|
||||
height: -1,
|
||||
value: '0.0',
|
||||
script: '',
|
||||
coinbase: false,
|
||||
hash: this.prevout.hash,
|
||||
index: this.prevout.index,
|
||||
age: 0,
|
||||
address: null
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
type: this.getType(),
|
||||
subtype: this.getSubtype(),
|
||||
@ -467,7 +448,7 @@ Input.prototype.inspect = function inspect() {
|
||||
redeem: this.getRedeem(),
|
||||
sequence: this.sequence,
|
||||
prevout: this.prevout,
|
||||
coin: coin
|
||||
coin: this.coin
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -50,7 +50,10 @@ Output.prototype.fromOptions = function fromOptions(options, mutable) {
|
||||
assert(!mutable || options.value >= 0);
|
||||
|
||||
this.mutable = !!mutable;
|
||||
this.value = options.value || 0;
|
||||
|
||||
if (options.value)
|
||||
this.value = options.value;
|
||||
|
||||
if (options.script)
|
||||
this.script.fromOptions(options.script);
|
||||
|
||||
@ -232,6 +235,7 @@ Output.prototype.isDust = function isDust(rate) {
|
||||
*/
|
||||
|
||||
Output.prototype.fromJSON = function fromJSON(json) {
|
||||
assert(typeof json.value === 'string');
|
||||
this.value = utils.satoshi(json.value);
|
||||
this.script.fromJSON(json.script);
|
||||
return this;
|
||||
|
||||
@ -874,18 +874,24 @@ NetworkAddress.uid = 0;
|
||||
NetworkAddress.prototype.fromOptions = function fromOptions(options) {
|
||||
var host = options.host;
|
||||
|
||||
assert(typeof options.host === 'string');
|
||||
assert(typeof options.port === 'number');
|
||||
|
||||
if (IP.version(host) !== -1)
|
||||
host = IP.normalize(host);
|
||||
|
||||
assert(typeof options.host === 'string');
|
||||
assert(typeof options.port === 'number');
|
||||
assert(typeof options.services === 'number');
|
||||
assert(typeof options.ts === 'number');
|
||||
|
||||
this.host = host;
|
||||
this.port = options.port;
|
||||
this.services = options.services;
|
||||
this.ts = options.ts;
|
||||
|
||||
if (options.services) {
|
||||
assert(typeof options.services === 'number');
|
||||
this.services = options.services;
|
||||
}
|
||||
|
||||
if (options.ts) {
|
||||
assert(typeof options.ts === 'number');
|
||||
this.ts = options.ts;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user