routing: return err on validation failure of network update

This ensures the waiting receiving channel always receives an error to
prevent a deadlock when processing a network update that fails due to
the validation barrier.

On commit d5aedbcbd9db510c974c9f7be5ab177ad6546994:

1000 @ 0x43a285 0x44a38f 0xc42e86 0xc80fda 0xc8682d 0xc976c9 0x46fce1
github.com/lightningnetwork/lnd/routing.(*ChannelRouter).AddNode+0x245                      github.com/lightningnetwork/lnd/routing/router.go:2218
github.com/lightningnetwork/lnd/discovery.(*AuthenticatedGossiper).addNode+0x3b9            github.com/lightningnetwork/lnd/discovery/gossiper.go:1510
github.com/lightningnetwork/lnd/discovery.(*AuthenticatedGossiper).processNetworkAnnouncement+0x574c github.com/lightningnetwork/lnd/discovery/gossiper.go:1554
github.com/lightningnetwork/lnd/discovery.(*AuthenticatedGossiper).networkHandler.func1+0x24github.com/lightningnetwork/lnd/discovery/gossiper.go:1043
This commit is contained in:
Wilmer Paulino 2021-04-29 15:45:06 -07:00
parent 2a2bc64a12
commit eb4413154d
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -1038,12 +1038,19 @@ func (r *ChannelRouter) networkHandler() {
update.msg,
)
if err != nil {
if err != ErrVBarrierShuttingDown &&
err != ErrParentValidationFailed {
switch err {
case ErrVBarrierShuttingDown:
update.err <- err
case ErrParentValidationFailed:
update.err <- newErrf(
ErrIgnored, err.Error(),
)
default:
log.Warnf("unexpected error "+
"during validation "+
"barrier shutdown: %v",
err)
update.err <- err
}
return
}