routing: split launchShard into registerAttempt and sendAttempt

This commit removes the method `launchShard` and splits its original
functionality into two steps - first create the attempt, second send the
attempt. This enables us to have finer control over "which error is
returned from which system and how to handle it".
This commit is contained in:
yyforyongyu committed 2023-11-13 16:09:10 +08:00
1 parent 49bafc0207
commit 7209c65ccf
5 files changed
+146 -194

No files matched your search

+9
View File
@@ -800,6 +800,15 @@ func makeSettledAttempt(total, fee int,
}
}
func makeFailedAttempt(total, fee int) *channeldb.HTLCAttempt {
return &channeldb.HTLCAttempt{
HTLCAttemptInfo: makeAttemptInfo(total, total-fee),
Failure: &channeldb.HTLCFailInfo{
Reason: channeldb.HTLCFailInternal,
},
}
}
func makeAttemptInfo(total, amtForwarded int) channeldb.HTLCAttemptInfo {
hop := &route.Hop{AmtToForward: lnwire.MilliSatoshi(amtForwarded)}
return channeldb.HTLCAttemptInfo{