Skip to content

Commit 1a3fdf1

Browse files
committed
chain: Use SufficientlyHeavierThan
1 parent 45aa6bf commit 1a3fdf1

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

chain/manager.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,7 @@ func (m *Manager) AddBlocks(blocks []types.Block) error {
229229
}
230230

231231
// if this chain is now the best chain, trigger a reorg
232-
//
233-
// TODO: SurpassThreshold?
234-
if cs.Depth.CmpWork(m.tipState.Depth) > 0 {
232+
if cs.SufficientlyHeavierThan(m.tipState) {
235233
oldTip := m.tipState.Index
236234
if err := m.reorgTo(cs.Index); err != nil {
237235
if err := m.reorgTo(oldTip); err != nil {

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.21.6
44

55
require (
66
go.etcd.io/bbolt v1.3.9
7-
go.sia.tech/core v0.2.2
7+
go.sia.tech/core v0.2.3-0.20240416172826-f9d44a4149e1
88
go.uber.org/zap v1.27.0
99
golang.org/x/crypto v0.22.0
1010
lukechampine.com/frand v1.4.2

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ go.etcd.io/bbolt v1.3.9 h1:8x7aARPEXiXbHmtUwAIv7eV2fQFHrLLavdiJ3uzJXoI=
1010
go.etcd.io/bbolt v1.3.9/go.mod h1:zaO32+Ti0PK1ivdPtgMESzuzL2VPoIG1PCQNvOdo/dE=
1111
go.sia.tech/core v0.2.2 h1:33RJrt08o7KyUOY4tITH6ECmRq1lhtapqc/SncIF/2A=
1212
go.sia.tech/core v0.2.2/go.mod h1:Zk7HaybEPgkPC1p6e6tTQr8PIeZClTgNcLNGYDLQJeE=
13+
go.sia.tech/core v0.2.3-0.20240416172826-f9d44a4149e1 h1:tG9JJk6qPevT2CrFttL9Y4ZIT5+RS3J+Hk9E3zJaGiY=
14+
go.sia.tech/core v0.2.3-0.20240416172826-f9d44a4149e1/go.mod h1:24liZWimivGQF+h3d14ly9oEpMIYxHPSgEMKmunxxi0=
1315
go.sia.tech/mux v1.2.0 h1:ofa1Us9mdymBbGMY2XH/lSpY8itFsKIo/Aq8zwe+GHU=
1416
go.sia.tech/mux v1.2.0/go.mod h1:Yyo6wZelOYTyvrHmJZ6aQfRoer3o4xyKQ4NmQLJrBSo=
1517
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=

0 commit comments

Comments
 (0)