chainentry: minor.
This commit is contained in:
parent
f3f585defc
commit
39b941516d
@ -501,7 +501,7 @@ ChainEntry.prototype.toJSON = function toJSON() {
|
||||
bits: this.bits,
|
||||
nonce: this.nonce,
|
||||
height: this.height,
|
||||
chainwork: this.chainwork.toString(10)
|
||||
chainwork: this.chainwork.toString('hex', 64)
|
||||
};
|
||||
};
|
||||
|
||||
@ -514,12 +514,12 @@ ChainEntry.prototype.toJSON = function toJSON() {
|
||||
ChainEntry.prototype.fromJSON = function fromJSON(json) {
|
||||
assert(json, 'Block data is required.');
|
||||
assert(typeof json.hash === 'string');
|
||||
assert(util.isNumber(json.version));
|
||||
assert(util.isUInt32(json.version));
|
||||
assert(typeof json.prevBlock === 'string');
|
||||
assert(typeof json.merkleRoot === 'string');
|
||||
assert(util.isNumber(json.ts));
|
||||
assert(util.isNumber(json.bits));
|
||||
assert(util.isNumber(json.nonce));
|
||||
assert(util.isUInt32(json.ts));
|
||||
assert(util.isUInt32(json.bits));
|
||||
assert(util.isUInt32(json.nonce));
|
||||
assert(typeof json.chainwork === 'string');
|
||||
|
||||
this.hash = util.revHex(json.hash);
|
||||
@ -530,7 +530,7 @@ ChainEntry.prototype.fromJSON = function fromJSON(json) {
|
||||
this.bits = json.bits;
|
||||
this.nonce = json.nonce;
|
||||
this.height = json.height;
|
||||
this.chainwork = new BN(json.chainwork, 10);
|
||||
this.chainwork = new BN(json.chainwork, 'hex');
|
||||
|
||||
return this;
|
||||
};
|
||||
@ -583,7 +583,7 @@ ChainEntry.prototype.inspect = function inspect() {
|
||||
|
||||
ChainEntry.isChainEntry = function isChainEntry(obj) {
|
||||
return obj
|
||||
&& obj.chainwork !== undefined
|
||||
&& BN.isBN(obj.chainwork)
|
||||
&& typeof obj.getMedianTime === 'function';
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user