Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
yyforyongyu committed Dec 20, 2024
1 parent 3d0ee83 commit 5b655b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
15 changes: 11 additions & 4 deletions itest/lnd_multi-hop_force_close_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,11 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
// We'll create two random payment hashes unknown to carol, then send
// each of them by manually specifying the HTLC details.
carolPubKey := carol.PubKey[:]
dustPayHash := ht.Random32Bytes()
payHash := ht.Random32Bytes()

preimageDust := ht.RandomPreimage()
preimage := ht.RandomPreimage()
dustPayHash := preimageDust.Hash()
payHash := preimage.Hash()

// If this is a taproot channel, then we'll need to make some manual
// route hints so Alice can actually find a route.
Expand All @@ -370,7 +373,7 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
req := &routerrpc.SendPaymentRequest{
Dest: carolPubKey,
Amt: int64(dustHtlcAmt),
PaymentHash: dustPayHash,
PaymentHash: dustPayHash[:],
FinalCltvDelta: finalCltvDelta,
TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat,
Expand All @@ -381,7 +384,7 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
req = &routerrpc.SendPaymentRequest{
Dest: carolPubKey,
Amt: int64(htlcAmt),
PaymentHash: payHash,
PaymentHash: payHash[:],
FinalCltvDelta: finalCltvDelta,
TimeoutSeconds: 60,
FeeLimitMsat: noFeeLimitMsat,
Expand Down Expand Up @@ -532,6 +535,10 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
// Once this transaction has been confirmed, Bob should detect that he
// no longer has any pending channels.
ht.AssertNumPendingForceClose(bob, 0)

expectedReason := lnrpc.PaymentFailureReason_FAILURE_REASON_ERROR
ht.AssertPaymentFailureReason(alice, preimage, expectedReason)
ht.AssertPaymentFailureReason(alice, preimageDust, expectedReason)
}

// testMultiHopReceiverPreimageClaimAnchor tests
Expand Down
3 changes: 2 additions & 1 deletion lntest/harness_assertion.go
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,8 @@ func (h *HarnessTest) AssertPaymentFailureReason(hn *node.HarnessNode,
}

return fmt.Errorf("payment: %v failure reason not match, "+
"want %s got %s", payHash, reason, p.Status)
"want %s(%d) got %s(%d)", payHash, reason, reason,
p.Status, p.Status)
}, DefaultTimeout)
require.NoError(h, err, "timeout checking payment failure reason")
}
Expand Down

0 comments on commit 5b655b1

Please sign in to comment.