From 580a2f4dc6a8c301346684d6021917eb9f954ec0 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Fri, 23 Oct 2020 01:35:26 +0200 Subject: [PATCH] Add option to join by common parents Signed-off-by: Jakub Sztandera --- chain/sync_manager.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/chain/sync_manager.go b/chain/sync_manager.go index 27643b054..c25068f60 100644 --- a/chain/sync_manager.go +++ b/chain/sync_manager.go @@ -2,6 +2,7 @@ package chain import ( "context" + "os" "sort" "strings" "sync" @@ -12,6 +13,14 @@ import ( const BootstrapPeerThreshold = 2 +var coalesceForksParents = false + +func init() { + if os.Getenv("LOTUS_SYNC_REL_PARENT") == "yes" { + coalesceForksParents = true + } +} + const ( BSStateInit = 0 BSStateSelected = 1 @@ -256,6 +265,9 @@ func (stb *syncTargetBucket) sameChainAs(ts *types.TipSet) bool { if ts.Parents() == t.Key() { return true } + if coalesceForksParents && ts.Parents() == t.Parents() { + return true + } } return false }