contractcourt: Cancel dust htlcs prematurely
We will now cancel dust htlcs on the local/remote commits after we decided to go onchain. This can be done because dust cannot be enforced onchain and therefore there is no way to also reveil the preimage onchain.
This commit is contained in:
2 files changed
+75
-45
No files matched your search
@@ -931,6 +931,24 @@ func TestChannelArbitratorLocalForceClosePendingHtlc(t *testing.T) {
|
||||
t.Fatalf("no response received")
|
||||
}
|
||||
|
||||
// We expect an immediate resolution message for the outgoing dust htlc.
|
||||
// It is not resolvable on-chain and it can be canceled back even before
|
||||
// the commitment transaction confirmed.
|
||||
select {
|
||||
case msgs := <-chanArbCtx.resolutions:
|
||||
if len(msgs) != 1 {
|
||||
t.Fatalf("expected 1 message, instead got %v",
|
||||
len(msgs))
|
||||
}
|
||||
|
||||
if msgs[0].HtlcIndex != outgoingDustHtlc.HtlcIndex {
|
||||
t.Fatalf("wrong htlc index: expected %v, got %v",
|
||||
outgoingDustHtlc.HtlcIndex, msgs[0].HtlcIndex)
|
||||
}
|
||||
case <-time.After(defaultTimeout):
|
||||
t.Fatalf("resolution msgs not sent")
|
||||
}
|
||||
|
||||
// Now notify about the local force close getting confirmed.
|
||||
closeTx := &wire.MsgTx{
|
||||
TxIn: []*wire.TxIn{
|
||||
@@ -993,22 +1011,6 @@ func TestChannelArbitratorLocalForceClosePendingHtlc(t *testing.T) {
|
||||
StateWaitingFullResolution,
|
||||
)
|
||||
|
||||
// We expect an immediate resolution message for the outgoing dust htlc.
|
||||
// It is not resolvable on-chain.
|
||||
select {
|
||||
case msgs := <-chanArbCtx.resolutions:
|
||||
if len(msgs) != 1 {
|
||||
t.Fatalf("expected 1 message, instead got %v", len(msgs))
|
||||
}
|
||||
|
||||
if msgs[0].HtlcIndex != outgoingDustHtlc.HtlcIndex {
|
||||
t.Fatalf("wrong htlc index: expected %v, got %v",
|
||||
outgoingDustHtlc.HtlcIndex, msgs[0].HtlcIndex)
|
||||
}
|
||||
case <-time.After(defaultTimeout):
|
||||
t.Fatalf("resolution msgs not sent")
|
||||
}
|
||||
|
||||
// We'll grab the old notifier here as our resolvers are still holding
|
||||
// a reference to this instance, and a new one will be created when we
|
||||
// restart the channel arb below.
|
||||
|
||||
Reference in new issue
Block a user