chainentry json.
This commit is contained in:
parent
33f7b38433
commit
819795b1ae
@ -451,8 +451,8 @@ ChainEntry.fromRaw = function fromRaw(chain, buf) {
|
||||
|
||||
ChainEntry.prototype.toJSON = function toJSON() {
|
||||
return {
|
||||
version: this.version,
|
||||
hash: utils.revHex(this.hash),
|
||||
version: this.version,
|
||||
prevBlock: utils.revHex(this.prevBlock),
|
||||
merkleRoot: utils.revHex(this.merkleRoot),
|
||||
ts: this.ts,
|
||||
@ -471,11 +471,17 @@ ChainEntry.prototype.toJSON = function toJSON() {
|
||||
*/
|
||||
|
||||
ChainEntry.fromJSON = function fromJSON(chain, json) {
|
||||
json.hash = utils.revHex(json.hash);
|
||||
json.prevBlock = utils.revHex(json.prevBlock);
|
||||
json.merkleRoot = utils.revHex(json.merkleRoot);
|
||||
json.chainwork = new bn(json.chainwork, 10);
|
||||
return new ChainEntry(chain, json);
|
||||
return new ChainEntry(chain, {
|
||||
hash: utils.revHex(json.hash),
|
||||
version: json.version,
|
||||
prevBlock: utils.revHex(json.prevBlock),
|
||||
merkleRoot: utils.revHex(json.merkleRoot),
|
||||
ts: json.ts,
|
||||
bits: json.bits,
|
||||
nonce: json.nonce,
|
||||
height: json.height,
|
||||
chainwork: new bn(json.chainwork, 10)
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user