Skip to content

Commit 988ca0f

Browse files
authored
Merge pull request #244 from hieblmi/no-wait-update
lndclient: handle CloseInstant update
2 parents 8ddc90c + f9c8a9b commit 988ca0f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lightning_client.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3138,6 +3138,10 @@ func (p *PendingCloseUpdate) CloseTxid() chainhash.Hash {
31383138
type ChannelClosedUpdate struct {
31393139
// CloseTx is the closing transaction id.
31403140
CloseTx chainhash.Hash
3141+
3142+
// NumPendingHtlcs is the number of pending htlcs that we have
3143+
// present while a channel close with the NoWait option was in progress.
3144+
NumPendingHtlcs int32
31413145
}
31423146

31433147
// CloseTxid returns the closing txid of the channel.
@@ -3291,6 +3295,21 @@ func (s *lightningClient) CloseChannel(ctx context.Context,
32913295
}
32923296
sendUpdate(closeUpdate)
32933297

3298+
case *lnrpc.CloseStatusUpdate_CloseInstant:
3299+
instantUpdate := update.CloseInstant
3300+
if instantUpdate == nil {
3301+
sendErr(errors.New("instant update " +
3302+
"unavailable"))
3303+
3304+
return
3305+
}
3306+
3307+
numPendingHtlcs := instantUpdate.NumPendingHtlcs
3308+
closeUpdate := &ChannelClosedUpdate{
3309+
NumPendingHtlcs: numPendingHtlcs,
3310+
}
3311+
sendUpdate(closeUpdate)
3312+
32943313
default:
32953314
sendErr(fmt.Errorf("unknown channel close "+
32963315
"update: %T", resp.Update))

0 commit comments

Comments
 (0)