mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 14:22:37 +01:00
lnrpc: add commitment_type to listchannels
This commit is contained in:
parent
4cb518c174
commit
7d305fdc46
4 changed files with 810 additions and 714 deletions
1458
lnrpc/rpc.pb.go
1458
lnrpc/rpc.pb.go
File diff suppressed because it is too large
Load diff
|
@ -1283,6 +1283,29 @@ message HTLC {
|
|||
uint32 expiration_height = 4;
|
||||
}
|
||||
|
||||
enum CommitmentType {
|
||||
/**
|
||||
A channel using the legacy commitment format having tweaked to_remote
|
||||
keys.
|
||||
*/
|
||||
LEGACY = 0;
|
||||
|
||||
/**
|
||||
A channel that uses the modern commitment format where the key in the
|
||||
output of the remote party does not change each state. This makes back
|
||||
up and recovery easier as when the channel is closed, the funds go
|
||||
directly to that key.
|
||||
*/
|
||||
STATIC_REMOTE_KEY = 1;
|
||||
|
||||
/**
|
||||
A channel that uses a commitment format that has anchor outputs on the
|
||||
commitments, allowing fee bumping after a force close transaction has
|
||||
been broadcast.
|
||||
*/
|
||||
ANCHORS = 2;
|
||||
}
|
||||
|
||||
message Channel {
|
||||
/// Whether this channel is active or not
|
||||
bool active = 1;
|
||||
|
@ -1377,13 +1400,11 @@ message Channel {
|
|||
*/
|
||||
int64 remote_chan_reserve_sat = 21;
|
||||
|
||||
/**
|
||||
If true, then this channel uses the modern commitment format where the key
|
||||
in the output of the remote party does not change each state. This makes
|
||||
back up and recovery easier as when the channel is closed, the funds go
|
||||
directly to that key.
|
||||
*/
|
||||
bool static_remote_key = 22;
|
||||
/// Deprecated. Use commitment_type.
|
||||
bool static_remote_key = 22 [deprecated = true];
|
||||
|
||||
/// The commitment type used by this channel.
|
||||
CommitmentType commitment_type = 26;
|
||||
|
||||
/**
|
||||
The number of seconds that the channel has been monitored by the channel
|
||||
|
@ -3336,4 +3357,4 @@ message ChannelUpdate {
|
|||
network in a forwards compatible manner.
|
||||
*/
|
||||
bytes extra_opaque_data = 12;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1935,7 +1935,11 @@
|
|||
"static_remote_key": {
|
||||
"type": "boolean",
|
||||
"format": "boolean",
|
||||
"description": "*\nIf true, then this channel uses the modern commitment format where the key\nin the output of the remote party does not change each state. This makes\nback up and recovery easier as when the channel is closed, the funds go\ndirectly to that key."
|
||||
"description": "/ Deprecated. Use commitment_type."
|
||||
},
|
||||
"commitment_type": {
|
||||
"$ref": "#/definitions/lnrpcCommitmentType",
|
||||
"description": "/ The commitment type used by this channel."
|
||||
},
|
||||
"lifetime": {
|
||||
"type": "string",
|
||||
|
@ -2402,6 +2406,16 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"lnrpcCommitmentType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"LEGACY",
|
||||
"STATIC_REMOTE_KEY",
|
||||
"ANCHORS"
|
||||
],
|
||||
"default": "LEGACY",
|
||||
"description": " - LEGACY: *\nA channel using the legacy commitment format having tweaked to_remote\nkeys.\n - STATIC_REMOTE_KEY: *\nA channel that uses the modern commitment format where the key in the\noutput of the remote party does not change each state. This makes back\nup and recovery easier as when the channel is closed, the funds go\ndirectly to that key.\n - ANCHORS: *\nA channel that uses a commitment format that has anchor outputs on the\ncommitments, allowing fee bumping after a force close transaction has\nbeen broadcast."
|
||||
},
|
||||
"lnrpcConnectPeerRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
13
rpcserver.go
13
rpcserver.go
|
@ -3058,6 +3058,16 @@ func createRPCOpenChannel(r *rpcServer, graph *channeldb.ChannelGraph,
|
|||
}
|
||||
externalCommitFee := dbChannel.Capacity - sumOutputs
|
||||
|
||||
// Extract the commitment type from the channel type flags. We must
|
||||
// first check whether it has anchors, since in that case it would also
|
||||
// be tweakless.
|
||||
commitmentType := lnrpc.CommitmentType_LEGACY
|
||||
if dbChannel.ChanType.HasAnchors() {
|
||||
commitmentType = lnrpc.CommitmentType_ANCHORS
|
||||
} else if dbChannel.ChanType.IsTweakless() {
|
||||
commitmentType = lnrpc.CommitmentType_STATIC_REMOTE_KEY
|
||||
}
|
||||
|
||||
channel := &lnrpc.Channel{
|
||||
Active: isActive,
|
||||
Private: !isPublic,
|
||||
|
@ -3079,7 +3089,8 @@ func createRPCOpenChannel(r *rpcServer, graph *channeldb.ChannelGraph,
|
|||
ChanStatusFlags: dbChannel.ChanStatus().String(),
|
||||
LocalChanReserveSat: int64(dbChannel.LocalChanCfg.ChanReserve),
|
||||
RemoteChanReserveSat: int64(dbChannel.RemoteChanCfg.ChanReserve),
|
||||
StaticRemoteKey: dbChannel.ChanType.IsTweakless(),
|
||||
StaticRemoteKey: commitmentType == lnrpc.CommitmentType_STATIC_REMOTE_KEY,
|
||||
CommitmentType: commitmentType,
|
||||
}
|
||||
|
||||
for i, htlc := range localCommit.Htlcs {
|
||||
|
|
Loading…
Add table
Reference in a new issue