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