routing/test: add test for stuck payment with in-flight htlcs

Add an additional stuck-payment case, where our payment gets
a terminal error while it has other htlcs in-flight, and a
shard fails with ErrTerminalPayment. This payment also falls in
our class of expected errors, but is not currently handled. The
mock is updated accordingly, using the same ordering as in our
real RegisterAttempt implementation.
This commit is contained in:
carla
2021-04-23 08:39:45 +02:00
parent 80451afe48
commit 12136a97a9
2 changed files with 54 additions and 0 deletions

View File

@@ -333,6 +333,10 @@ func (m *mockControlTower) RegisterAttempt(phash lntypes.Hash,
return channeldb.ErrPaymentAlreadyFailed
}
if settled || failed {
return channeldb.ErrPaymentTerminal
}
// Add attempt to payment.
p.attempts = append(p.attempts, channeldb.HTLCAttempt{
HTLCAttemptInfo: *a,