mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-12 14:12:27 +02:00
htlcswitch+invoices: fail mpp timeouts with FailMPPTimeout
This commit adds a getResolutionFailure function which returns an appropriate wire failure based on the outcome of a htlc resolution. It also updates the MissionControlStore test to ensure that lnd can handle failures which occur due to mpp timeout.
This commit is contained in:
@ -16,8 +16,12 @@ import (
|
||||
|
||||
const testMaxRecords = 2
|
||||
|
||||
// TestMissionControlStore tests the recording of payment failure events
|
||||
// in mission control. It tests encoding and decoding of differing lnwire
|
||||
// failures (FailIncorrectDetails and FailMppTimeout), pruning of results
|
||||
// and idempotent writes.
|
||||
func TestMissionControlStore(t *testing.T) {
|
||||
// Set time zone explictly to keep test deterministic.
|
||||
// Set time zone explicitly to keep test deterministic.
|
||||
time.Local = time.UTC
|
||||
|
||||
file, err := ioutil.TempFile("", "*.db")
|
||||
@ -115,11 +119,12 @@ func TestMissionControlStore(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Add a newer result.
|
||||
// Add a newer result which failed due to mpp timeout.
|
||||
result3 := result1
|
||||
result3.timeReply = result1.timeReply.Add(2 * time.Hour)
|
||||
result3.timeFwd = result1.timeReply.Add(2 * time.Hour)
|
||||
result3.id = 3
|
||||
result3.failure = &lnwire.FailMPPTimeout{}
|
||||
|
||||
err = store.AddResult(&result3)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user