server: send 0 bandwidth hints for links that can't add htlc

This commit is contained in:
carla
2021-06-22 13:56:09 +02:00
parent 5d717cb039
commit 6aa37066b2
3 changed files with 239 additions and 0 deletions

View File

@ -718,6 +718,12 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
return 0
}
// If our link isn't currently in a state where it can
// add another outgoing htlc, treat the link as unusable.
if err := link.MayAddOutgoingHtlc(); err != nil {
return 0
}
// Otherwise, we'll return the current best estimate
// for the available bandwidth for the link.
return link.Bandwidth()