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:
1 file changed
+7
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user