orphan blocks ignored on file sync
This commit is contained in:
parent
23960f0c37
commit
02c3512f94
|
@ -320,9 +320,15 @@ function spec() {
|
|||
|
||||
isMainChain = blockInfo.hash === nextHash;
|
||||
|
||||
//TODO
|
||||
blockInfo.isOrphan = !isMainChain;
|
||||
|
||||
/*
|
||||
* In file sync, orphan blocks are just ignored.
|
||||
* This is to simplify our schema and the
|
||||
* sync process
|
||||
*/
|
||||
if (blockInfo.isOrphan) return c();
|
||||
|
||||
self.sync.storeBlock(blockInfo, function(err) {
|
||||
existed = err && err.toString().match(/E11000/);
|
||||
|
||||
|
@ -340,19 +346,23 @@ function spec() {
|
|||
return cb(err);
|
||||
}
|
||||
else {
|
||||
self.err = null;
|
||||
self.status = 'syncing';
|
||||
}
|
||||
|
||||
// Continue
|
||||
if (blockInfo) {
|
||||
// Continue
|
||||
if (blockInfo) {
|
||||
|
||||
// mainchain
|
||||
if (isMainChain) height++;
|
||||
// mainchain
|
||||
if (isMainChain) height++;
|
||||
|
||||
self.syncedBlocks++;
|
||||
self.syncedBlocks++;
|
||||
self.err = null;
|
||||
self.status = 'syncing';
|
||||
|
||||
return self.getBlockFromFile(height, scanOpts, cb);
|
||||
return self.getBlockFromFile(height, scanOpts, cb);
|
||||
}
|
||||
else {
|
||||
self.err = null;
|
||||
self.status = 'finished';
|
||||
}
|
||||
}
|
||||
return cb(err);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue