Add option to join by common parents

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-10-23 01:35:26 +02:00
parent c8fe21c1ef
commit 580a2f4dc6
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -2,6 +2,7 @@ package chain
import ( import (
"context" "context"
"os"
"sort" "sort"
"strings" "strings"
"sync" "sync"
@ -12,6 +13,14 @@ import (
const BootstrapPeerThreshold = 2 const BootstrapPeerThreshold = 2
var coalesceForksParents = false
func init() {
if os.Getenv("LOTUS_SYNC_REL_PARENT") == "yes" {
coalesceForksParents = true
}
}
const ( const (
BSStateInit = 0 BSStateInit = 0
BSStateSelected = 1 BSStateSelected = 1
@ -256,6 +265,9 @@ func (stb *syncTargetBucket) sameChainAs(ts *types.TipSet) bool {
if ts.Parents() == t.Key() { if ts.Parents() == t.Key() {
return true return true
} }
if coalesceForksParents && ts.Parents() == t.Parents() {
return true
}
} }
return false return false
} }