save memory by not storing prevBlock.

This commit is contained in:
Christopher Jeffrey 2016-01-20 13:58:11 -08:00
parent ef44bf44f0
commit e461e44303

View File

@ -61,7 +61,7 @@ function Chain(options) {
{ {
hash: network.genesis.hash, hash: network.genesis.hash,
version: network.genesis.version, version: network.genesis.version,
prevBlock: network.genesis.prevBlock, // prevBlock: network.genesis.prevBlock,
ts: network.genesis.ts, ts: network.genesis.ts,
bits: network.genesis.bits, bits: network.genesis.bits,
height: 0 height: 0
@ -349,7 +349,7 @@ Chain.prototype.add = function add(block, peer) {
entry = new ChainBlock(this, { entry = new ChainBlock(this, {
hash: hash, hash: hash,
version: block.version, version: block.version,
prevBlock: prevHash, // prevBlock: prevHash,
ts: block.ts, ts: block.ts,
bits: block.bits, bits: block.bits,
height: prevHeight + 1 height: prevHeight + 1
@ -872,7 +872,7 @@ function ChainBlock(chain, data) {
this.chain = chain; this.chain = chain;
this.hash = data.hash; this.hash = data.hash;
this.version = data.version; this.version = data.version;
this.prevBlock = data.prevBlock; // this.prevBlock = data.prevBlock;
this.ts = data.ts; this.ts = data.ts;
this.bits = data.bits; this.bits = data.bits;
this.height = data.height; this.height = data.height;
@ -950,7 +950,7 @@ ChainBlock.prototype.toJSON = function() {
return { return {
hash: this.hash, hash: this.hash,
version: this.version, version: this.version,
prevBlock: this.prevBlock, // prevBlock: this.prevBlock,
ts: this.ts, ts: this.ts,
bits: this.bits, bits: this.bits,
height: this.height height: this.height