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
No known key found for this signature in database
GPG key ID: 8E4256593F177720
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 inactive_channel = 4;
PendingUpdate pending_open_channel = 6;
ChannelPoint fully_resolved_channel = 7;
}
enum UpdateType {
@ -2257,6 +2258,7 @@ message ChannelEventUpdate {
ACTIVE_CHANNEL = 2;
INACTIVE_CHANNEL = 3;
PENDING_OPEN_CHANNEL = 4;
FULLY_RESOLVED_CHANNEL = 5;
}
UpdateType type = 5;

View file

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

View file

@ -4062,6 +4062,19 @@ func (r *rpcServer) SubscribeChannelEvents(req *lnrpc.ChannelEventSubscription,
case channelnotifier.ActiveLinkEvent:
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:
return fmt.Errorf("unexpected channel event update: %v", event)
}