Merge pull request #3238 from breez/chan_reserve_fields

rpc: add channel reserve fields in RPC responses.
This commit is contained in:
Wilmer Paulino 2019-07-10 16:30:33 -07:00 committed by GitHub
commit f9816330c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 585 additions and 502 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1161,6 +1161,14 @@ message Channel {
/// A set of flags showing the current state of the channel.
string chan_status_flags = 19 [json_name = "chan_status_flags"];
/// The minimum satoshis this node is required to reserve in its balance.
int64 local_chan_reserve_sat = 20 [json_name = "local_chan_reserve_sat"];
/**
The minimum satoshis the other node is required to reserve in its balance.
*/
int64 remote_chan_reserve_sat = 21 [json_name = "remote_chan_reserve_sat"];
}
@ -1468,6 +1476,15 @@ message PendingChannelsResponse {
int64 local_balance = 4 [ json_name = "local_balance" ];
int64 remote_balance = 5 [ json_name = "remote_balance" ];
/// The minimum satoshis this node is required to reserve in its balance.
int64 local_chan_reserve_sat = 6 [json_name = "local_chan_reserve_sat"];
/**
The minimum satoshis the other node is required to reserve in its
balance.
*/
int64 remote_chan_reserve_sat = 7 [json_name = "remote_chan_reserve_sat"];
}
message PendingOpenChannel {

View File

@ -1407,6 +1407,16 @@
"remote_balance": {
"type": "string",
"format": "int64"
},
"local_chan_reserve_sat": {
"type": "string",
"format": "int64",
"description": "/ The minimum satoshis this node is required to reserve in its balance."
},
"remote_chan_reserve_sat": {
"type": "string",
"format": "int64",
"description": "*\nThe minimum satoshis the other node is required to reserve in its\nbalance."
}
}
},
@ -1626,6 +1636,16 @@
"chan_status_flags": {
"type": "string",
"description": "/ A set of flags showing the current state of the channel."
},
"local_chan_reserve_sat": {
"type": "string",
"format": "int64",
"description": "/ The minimum satoshis this node is required to reserve in its balance."
},
"remote_chan_reserve_sat": {
"type": "string",
"format": "int64",
"description": "*\nThe minimum satoshis the other node is required to reserve in its balance."
}
}
},

View File

@ -2232,11 +2232,13 @@ func (r *rpcServer) PendingChannels(ctx context.Context,
resp.PendingOpenChannels[i] = &lnrpc.PendingChannelsResponse_PendingOpenChannel{
Channel: &lnrpc.PendingChannelsResponse_PendingChannel{
RemoteNodePub: hex.EncodeToString(pub),
ChannelPoint: pendingChan.FundingOutpoint.String(),
Capacity: int64(pendingChan.Capacity),
LocalBalance: int64(localCommitment.LocalBalance.ToSatoshis()),
RemoteBalance: int64(localCommitment.RemoteBalance.ToSatoshis()),
RemoteNodePub: hex.EncodeToString(pub),
ChannelPoint: pendingChan.FundingOutpoint.String(),
Capacity: int64(pendingChan.Capacity),
LocalBalance: int64(localCommitment.LocalBalance.ToSatoshis()),
RemoteBalance: int64(localCommitment.RemoteBalance.ToSatoshis()),
LocalChanReserveSat: int64(pendingChan.LocalChanCfg.ChanReserve),
RemoteChanReserveSat: int64(pendingChan.RemoteChanCfg.ChanReserve),
},
CommitWeight: commitWeight,
CommitFee: int64(localCommitment.CommitFee),
@ -2647,6 +2649,8 @@ func createRPCOpenChannel(r *rpcServer, graph *channeldb.ChannelGraph,
CsvDelay: uint32(dbChannel.LocalChanCfg.CsvDelay),
Initiator: dbChannel.IsInitiator,
ChanStatusFlags: dbChannel.ChanStatus().String(),
LocalChanReserveSat: int64(dbChannel.LocalChanCfg.ChanReserve),
RemoteChanReserveSat: int64(dbChannel.RemoteChanCfg.ChanReserve),
}
for i, htlc := range localCommit.Htlcs {