refactor.
This commit is contained in:
parent
6216bcbd97
commit
799c40136a
@ -1982,13 +1982,7 @@ Chain.prototype.getOrphanRoot = function getOrphanRoot(hash) {
|
|||||||
hash = this.orphan.bmap[hash].prevBlock;
|
hash = this.orphan.bmap[hash].prevBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!root)
|
return root;
|
||||||
return;
|
|
||||||
|
|
||||||
return {
|
|
||||||
root: root,
|
|
||||||
soil: this.orphan.bmap[root].prevBlock
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -135,7 +135,6 @@ MemBlock.prototype.fromRaw = function fromRaw(data) {
|
|||||||
height = bcoin.script.getCoinbaseHeight(input.script.raw);
|
height = bcoin.script.getCoinbaseHeight(input.script.raw);
|
||||||
|
|
||||||
this.coinbaseHeight = height;
|
this.coinbaseHeight = height;
|
||||||
this.txs = [];
|
|
||||||
this.raw = p.data;
|
this.raw = p.data;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@ -1741,6 +1741,7 @@ Peer.prototype.reject = function reject(obj, code, reason, score) {
|
|||||||
|
|
||||||
Peer.prototype.resolveOrphan = function resolveOrphan(tip, orphan, callback) {
|
Peer.prototype.resolveOrphan = function resolveOrphan(tip, orphan, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var root;
|
||||||
|
|
||||||
callback = utils.ensure(callback);
|
callback = utils.ensure(callback);
|
||||||
|
|
||||||
@ -1750,15 +1751,15 @@ Peer.prototype.resolveOrphan = function resolveOrphan(tip, orphan, callback) {
|
|||||||
if (err)
|
if (err)
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
|
||||||
orphan = self.chain.getOrphanRoot(orphan);
|
root = self.chain.getOrphanRoot(orphan);
|
||||||
|
|
||||||
// Was probably resolved.
|
// Was probably resolved.
|
||||||
if (!orphan) {
|
if (!root) {
|
||||||
bcoin.debug('Orphan root was already resolved.');
|
bcoin.debug('Orphan root was already resolved.');
|
||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.sendGetBlocks(locator, orphan.root);
|
self.sendGetBlocks(locator, root);
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user