Skip to content

Commit fa03491

Browse files
committed
Merge commit 'refs/pull/3315/head' of https://github.com/BitBoxSwiss/bitbox-wallet-app
2 parents 65ab4ef + f17dee9 commit fa03491

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

backend/coins/btc/headers/headers.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,7 @@ func (headers *Headers) reorg(db DBInterface, tip int) {
366366
// Simple reorg method: re-fetch headers up to the maximum reorg limit. The server can shorten
367367
// our chain by sending a fake header and set us back by `reorgLimit` blocks, but it needs to
368368
// contain the correct PoW to do so.
369-
newTip := tip - reorgLimit
370-
if newTip < -1 {
371-
newTip = -1
372-
}
369+
newTip := max(tip-reorgLimit, -1)
373370
if err := db.RevertTo(newTip); err != nil {
374371
panic(err)
375372
}

0 commit comments

Comments
 (0)