lnrpc+rpcserver: add new fully resolved chan update event

This commit adds the new channel update event for a channel that is now
fully resolved to the event subscription RPC.
This commit is contained in:
Oliver Gugger
2021-08-09 13:55:34 +02:00
parent 5917486dc9
commit 06a693f10e
4 changed files with 1651 additions and 1606 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -2249,6 +2249,7 @@ message ChannelEventUpdate {
ChannelPoint active_channel = 3; ChannelPoint active_channel = 3;
ChannelPoint inactive_channel = 4; ChannelPoint inactive_channel = 4;
PendingUpdate pending_open_channel = 6; PendingUpdate pending_open_channel = 6;
ChannelPoint fully_resolved_channel = 7;
} }
enum UpdateType { enum UpdateType {
@@ -2257,6 +2258,7 @@ message ChannelEventUpdate {
ACTIVE_CHANNEL = 2; ACTIVE_CHANNEL = 2;
INACTIVE_CHANNEL = 3; INACTIVE_CHANNEL = 3;
PENDING_OPEN_CHANNEL = 4; PENDING_OPEN_CHANNEL = 4;
FULLY_RESOLVED_CHANNEL = 5;
} }
UpdateType type = 5; UpdateType type = 5;

View File

@@ -2327,7 +2327,8 @@
"CLOSED_CHANNEL", "CLOSED_CHANNEL",
"ACTIVE_CHANNEL", "ACTIVE_CHANNEL",
"INACTIVE_CHANNEL", "INACTIVE_CHANNEL",
"PENDING_OPEN_CHANNEL" "PENDING_OPEN_CHANNEL",
"FULLY_RESOLVED_CHANNEL"
], ],
"default": "OPEN_CHANNEL" "default": "OPEN_CHANNEL"
}, },
@@ -3306,6 +3307,9 @@
"pending_open_channel": { "pending_open_channel": {
"$ref": "#/definitions/lnrpcPendingUpdate" "$ref": "#/definitions/lnrpcPendingUpdate"
}, },
"fully_resolved_channel": {
"$ref": "#/definitions/lnrpcChannelPoint"
},
"type": { "type": {
"$ref": "#/definitions/ChannelEventUpdateUpdateType" "$ref": "#/definitions/ChannelEventUpdateUpdateType"
} }

View File

@@ -4062,6 +4062,19 @@ func (r *rpcServer) SubscribeChannelEvents(req *lnrpc.ChannelEventSubscription,
case channelnotifier.ActiveLinkEvent: case channelnotifier.ActiveLinkEvent:
continue continue
case channelnotifier.FullyResolvedChannelEvent:
update = &lnrpc.ChannelEventUpdate{
Type: lnrpc.ChannelEventUpdate_FULLY_RESOLVED_CHANNEL,
Channel: &lnrpc.ChannelEventUpdate_FullyResolvedChannel{
FullyResolvedChannel: &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)
} }