Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion lightning_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3121,19 +3121,33 @@ func (s *lightningClient) OpenChannelStream(ctx context.Context,
type CloseChannelUpdate interface {
// CloseTxid returns the closing txid of the channel.
CloseTxid() chainhash.Hash

// NumberOfPendingHtlcs is the number of pending htlcs that we have
// present while a channel close with the NoWait option was in progress.
NumberOfPendingHtlcs() int32
}

// PendingCloseUpdate indicates that our closing transaction has been broadcast.
type PendingCloseUpdate struct {
// CloseTx is the closing transaction id.
CloseTx chainhash.Hash

// NumPendingHtlcs is the number of pending htlcs that we have
// present while a channel close with the NoWait option was in progress.
NumPendingHtlcs int32
}

// CloseTxid returns the closing txid of the channel.
func (p *PendingCloseUpdate) CloseTxid() chainhash.Hash {
return p.CloseTx
}

// NumberOfPendingHtlcs returns the number of pending htlcs on a pending close
// channel.
func (p *PendingCloseUpdate) NumberOfPendingHtlcs() int32 {
return p.NumPendingHtlcs
}

// ChannelClosedUpdate indicates that our channel close has confirmed on chain.
type ChannelClosedUpdate struct {
// CloseTx is the closing transaction id.
Expand All @@ -3149,6 +3163,12 @@ func (p *ChannelClosedUpdate) CloseTxid() chainhash.Hash {
return p.CloseTx
}

// NumberOfPendingHtlcs returns the number of pending htlcs on a pending close
// channel.
func (p *ChannelClosedUpdate) NumberOfPendingHtlcs() int32 {
return p.NumPendingHtlcs
}

// CloseChannelOption is a functional type for an option that modifies a
// CloseChannelRequest.
type CloseChannelOption func(r *lnrpc.CloseChannelRequest)
Expand Down Expand Up @@ -3305,7 +3325,7 @@ func (s *lightningClient) CloseChannel(ctx context.Context,
}

numPendingHtlcs := instantUpdate.NumPendingHtlcs
closeUpdate := &ChannelClosedUpdate{
closeUpdate := &PendingCloseUpdate{
NumPendingHtlcs: numPendingHtlcs,
}
sendUpdate(closeUpdate)
Expand Down