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;
|
isMainChain = blockInfo.hash === nextHash;
|
||||||
|
|
||||||
//TODO
|
|
||||||
blockInfo.isOrphan = !isMainChain;
|
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) {
|
self.sync.storeBlock(blockInfo, function(err) {
|
||||||
existed = err && err.toString().match(/E11000/);
|
existed = err && err.toString().match(/E11000/);
|
||||||
|
|
||||||
@ -340,19 +346,23 @@ function spec() {
|
|||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
self.err = null;
|
|
||||||
self.status = 'syncing';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Continue
|
// Continue
|
||||||
if (blockInfo) {
|
if (blockInfo) {
|
||||||
|
|
||||||
// mainchain
|
// mainchain
|
||||||
if (isMainChain) height++;
|
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);
|
return cb(err);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user