refactor.

This commit is contained in:
Christopher Jeffrey 2016-06-17 03:41:15 -07:00
parent 6216bcbd97
commit 799c40136a
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 5 additions and 11 deletions

View File

@ -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;
};
/**

View File

@ -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;

View File

@ -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();
});