Skip to content

Commit cac779b

Browse files
committed
funding: send warning to remote peer if chan nonce missing on reest
1 parent 7feb8b2 commit cac779b

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

funding/manager.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,28 @@ func (f *Manager) failFundingFlow(peer lnpeer.Peer, cid *chanIdentifier,
960960
}
961961
}
962962

963+
// sendWarning sends a new warning message to the target peer, targeting the
964+
// specified cid with the passed funding error.
965+
func (f *Manager) sendWarning(peer lnpeer.Peer, cid *chanIdentifier,
966+
fundingErr error) {
967+
968+
msg := fundingErr.Error()
969+
970+
errMsg := &lnwire.Warning{
971+
ChanID: cid.tempChanID,
972+
Data: lnwire.WarningData(msg),
973+
}
974+
975+
log.Debugf("Sending funding warning to peer (%x): %v",
976+
peer.IdentityKey().SerializeCompressed(),
977+
spew.Sdump(errMsg),
978+
)
979+
980+
if err := peer.SendMessage(false, errMsg); err != nil {
981+
log.Errorf("unable to send error message to peer %v", err)
982+
}
983+
}
984+
963985
// reservationCoordinator is the primary goroutine tasked with progressing the
964986
// funding workflow between the wallet, and any outside peers or local callers.
965987
//
@@ -3890,7 +3912,7 @@ func (f *Manager) handleChannelReady(peer lnpeer.Peer, //nolint:funlen
38903912
)
38913913
if err != nil {
38923914
cid := newChanIdentifier(msg.ChanID)
3893-
f.failFundingFlow(peer, cid, err)
3915+
f.sendWarning(peer, cid, err)
38943916

38953917
return
38963918
}

0 commit comments

Comments
 (0)