router: add SyncedHeight() method
The router subsystem has its own goroutine that receives chain updates and then does its (quite time consuming) work on each new block. To make it possible to find out what block the router currently is synced to, we export its internal best height through a new method.
This commit is contained in:
parent
6f2f23aae6
commit
9f0228b21c
@ -2479,6 +2479,13 @@ func (r *ChannelRouter) CurrentBlockHeight() (uint32, error) {
|
||||
return uint32(height), err
|
||||
}
|
||||
|
||||
// SyncedHeight returns the block height to which the router subsystem currently
|
||||
// is synced to. This can differ from the above chain height if the goroutine
|
||||
// responsible for processing the blocks isn't yet up to speed.
|
||||
func (r *ChannelRouter) SyncedHeight() uint32 {
|
||||
return atomic.LoadUint32(&r.bestHeight)
|
||||
}
|
||||
|
||||
// GetChannelByID return the channel by the channel id.
|
||||
//
|
||||
// NOTE: This method is part of the ChannelGraphSource interface.
|
||||
|
Loading…
Reference in New Issue
Block a user