Skip to content

Commit 82b7891

Browse files
committed
rpcserver: add custom channel data to pending channels
The pending force close and pending waiting close channels didn't have their custom channel data populated yet.
1 parent bab5cab commit 82b7891

File tree

1 file changed

+38
-10
lines changed

1 file changed

+38
-10
lines changed

rpcserver.go

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4028,6 +4028,13 @@ func (r *rpcServer) fetchPendingForceCloseChannels() (pendingForceClose,
40284028
historical.LocalCommitment.RemoteBalance.ToSatoshis(),
40294029
)
40304030

4031+
customChanBytes, err := encodeCustomChanData(historical)
4032+
if err != nil {
4033+
return nil, 0, fmt.Errorf("unable to encode "+
4034+
"open chan data: %w", err)
4035+
}
4036+
channel.CustomChannelData = customChanBytes
4037+
40314038
channel.Private = isPrivate(historical)
40324039
channel.Memo = string(historical.Memo)
40334040

@@ -4218,20 +4225,41 @@ func (r *rpcServer) fetchWaitingCloseChannels(
42184225
return nil, 0, err
42194226
}
42204227

4228+
customChanBytes, err := encodeCustomChanData(waitingClose)
4229+
if err != nil {
4230+
return nil, 0, fmt.Errorf("unable to encode "+
4231+
"open chan data: %w", err)
4232+
}
4233+
4234+
localCommit := waitingClose.LocalCommitment
4235+
chanStatus := waitingClose.ChanStatus()
42214236
channel := &lnrpc.PendingChannelsResponse_PendingChannel{
4222-
RemoteNodePub: hex.EncodeToString(pub),
4223-
ChannelPoint: chanPoint.String(),
4224-
Capacity: int64(waitingClose.Capacity),
4225-
LocalBalance: int64(waitingClose.LocalCommitment.LocalBalance.ToSatoshis()),
4226-
RemoteBalance: int64(waitingClose.LocalCommitment.RemoteBalance.ToSatoshis()),
4227-
LocalChanReserveSat: int64(waitingClose.LocalChanCfg.ChanReserve),
4228-
RemoteChanReserveSat: int64(waitingClose.RemoteChanCfg.ChanReserve),
4229-
Initiator: rpcInitiator(waitingClose.IsInitiator),
4230-
CommitmentType: rpcCommitmentType(waitingClose.ChanType),
4237+
RemoteNodePub: hex.EncodeToString(pub),
4238+
ChannelPoint: chanPoint.String(),
4239+
Capacity: int64(waitingClose.Capacity),
4240+
LocalBalance: int64(
4241+
localCommit.LocalBalance.ToSatoshis(),
4242+
),
4243+
RemoteBalance: int64(
4244+
localCommit.RemoteBalance.ToSatoshis(),
4245+
),
4246+
LocalChanReserveSat: int64(
4247+
waitingClose.LocalChanCfg.ChanReserve,
4248+
),
4249+
RemoteChanReserveSat: int64(
4250+
waitingClose.RemoteChanCfg.ChanReserve,
4251+
),
4252+
Initiator: rpcInitiator(
4253+
waitingClose.IsInitiator,
4254+
),
4255+
CommitmentType: rpcCommitmentType(
4256+
waitingClose.ChanType,
4257+
),
42314258
NumForwardingPackages: int64(len(fwdPkgs)),
4232-
ChanStatusFlags: waitingClose.ChanStatus().String(),
4259+
ChanStatusFlags: chanStatus.String(),
42334260
Private: isPrivate(waitingClose),
42344261
Memo: string(waitingClose.Memo),
4262+
CustomChannelData: customChanBytes,
42354263
}
42364264

42374265
var closingTxid, closingTxHex string

0 commit comments

Comments
 (0)