Merge pull request #10079 from guggero/funding-timeout-error

Add missing `FundingTimeoutEvent` type to `SubscribeChannelEvents` RPC
This commit is contained in:
Oliver Gugger authored and GitHub committed 2025-07-15 10:42:08 -06:00
commit 7f491dbd88
6 files changed
+2180 -2128

No files matched your search

+1 -1
View File
@@ -192,7 +192,7 @@ func (c *ChannelNotifier) NotifyFullyResolvedChannelEvent(
} }
} }
// NotifyFundingTimeoutEvent notifies the channelEventNotifier goroutine that // NotifyFundingTimeout notifies the channelEventNotifier goroutine that
// a funding timeout has occurred for a certain channel point. // a funding timeout has occurred for a certain channel point.
func (c *ChannelNotifier) NotifyFundingTimeout(chanPoint wire.OutPoint) { func (c *ChannelNotifier) NotifyFundingTimeout(chanPoint wire.OutPoint) {
// Send this event to all channel event subscribers. // Send this event to all channel event subscribers.
@@ -46,6 +46,12 @@
would not be able to decode persisted data in the utxo nursery and therefore would not be able to decode persisted data in the utxo nursery and therefore
would fail to start up. would fail to start up.
- [Added the missing `FundingTimeoutEvent` event type to the
`SubscribeChannelEvents`
RPC](https://github.com/lightningnetwork/lnd/pull/10079) to avoid the
`unexpected channel event update` error that lead to the termination of the
streaming RPC call.
# New Features # New Features
## Functional Enhancements ## Functional Enhancements
+2152 -2126
View File
File diff suppressed because it is too large. Load diff
+2
View File
@@ -2973,6 +2973,7 @@ message ChannelEventUpdate {
ChannelPoint inactive_channel = 4; ChannelPoint inactive_channel = 4;
PendingUpdate pending_open_channel = 6; PendingUpdate pending_open_channel = 6;
ChannelPoint fully_resolved_channel = 7; ChannelPoint fully_resolved_channel = 7;
ChannelPoint channel_funding_timeout = 8;
} }
enum UpdateType { enum UpdateType {
@@ -2982,6 +2983,7 @@ message ChannelEventUpdate {
INACTIVE_CHANNEL = 3; INACTIVE_CHANNEL = 3;
PENDING_OPEN_CHANNEL = 4; PENDING_OPEN_CHANNEL = 4;
FULLY_RESOLVED_CHANNEL = 5; FULLY_RESOLVED_CHANNEL = 5;
CHANNEL_FUNDING_TIMEOUT = 6;
} }
UpdateType type = 5; UpdateType type = 5;
+5 -1
View File
@@ -3009,7 +3009,8 @@
"ACTIVE_CHANNEL", "ACTIVE_CHANNEL",
"INACTIVE_CHANNEL", "INACTIVE_CHANNEL",
"PENDING_OPEN_CHANNEL", "PENDING_OPEN_CHANNEL",
"FULLY_RESOLVED_CHANNEL" "FULLY_RESOLVED_CHANNEL",
"CHANNEL_FUNDING_TIMEOUT"
], ],
"default": "OPEN_CHANNEL" "default": "OPEN_CHANNEL"
}, },
@@ -4480,6 +4481,9 @@
"fully_resolved_channel": { "fully_resolved_channel": {
"$ref": "#/definitions/lnrpcChannelPoint" "$ref": "#/definitions/lnrpcChannelPoint"
}, },
"channel_funding_timeout": {
"$ref": "#/definitions/lnrpcChannelPoint"
},
"type": { "type": {
"$ref": "#/definitions/ChannelEventUpdateUpdateType" "$ref": "#/definitions/ChannelEventUpdateUpdateType"
} }
+14
View File
@@ -5315,6 +5315,7 @@ func (r *rpcServer) SubscribeChannelEvents(req *lnrpc.ChannelEventSubscription,
defer channelEventSub.Cancel() defer channelEventSub.Cancel()
for { for {
//nolint:ll
select { select {
// A new update has been sent by the channel router, we'll // A new update has been sent by the channel router, we'll
// marshal it into the form expected by the gRPC client, then // marshal it into the form expected by the gRPC client, then
@@ -5410,6 +5411,19 @@ func (r *rpcServer) SubscribeChannelEvents(req *lnrpc.ChannelEventSubscription,
}, },
} }
case channelnotifier.FundingTimeoutEvent:
update = &lnrpc.ChannelEventUpdate{
Type: lnrpc.ChannelEventUpdate_CHANNEL_FUNDING_TIMEOUT,
Channel: &lnrpc.ChannelEventUpdate_ChannelFundingTimeout{
ChannelFundingTimeout: &lnrpc.ChannelPoint{
FundingTxid: &lnrpc.ChannelPoint_FundingTxidBytes{
FundingTxidBytes: event.ChannelPoint.Hash[:],
},
OutputIndex: event.ChannelPoint.Index,
},
},
}
default: default:
return fmt.Errorf("unexpected channel event update: %v", event) return fmt.Errorf("unexpected channel event update: %v", event)
} }