lntest+routing: update best height after graph pruning
It seems #5246 introduced a subtle bug that lead to the error "out of order block: expecting height=1, got height=XXX" some times during startup. Apparently it can happen that during pruning of the graph tip some blocks can come in before we start our chain view and the new block subscription. By querying the chain backend for the best height before syncing with the graph we ensure that we never miss a block.
This commit is contained in:
2 files changed
+23
-3
No files matched your search
@@ -563,6 +563,14 @@ func (r *ChannelRouter) Start() error {
|
||||
}
|
||||
}
|
||||
|
||||
// The graph pruning might have taken a while and there could be
|
||||
// new blocks available.
|
||||
bestHash, bestHeight, err = r.cfg.Chain.GetBestBlock()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r.bestHeight = uint32(bestHeight)
|
||||
|
||||
// Before we begin normal operation of the router, we first need
|
||||
// to synchronize the channel graph to the latest state of the
|
||||
// UTXO set.
|
||||
|
||||
Reference in new issue
Block a user