routing: stop tracking totalAmount in paymentLifecycle

This commit removes the field `totalAmount` from `paymentLifecycle` and
only reads it from the channeldb payment.
This commit is contained in:
yyforyongyu
2022-06-10 01:34:22 +08:00
parent e3bc4f4cc9
commit 8d49dfb07e
5 changed files with 33 additions and 21 deletions

View File

@@ -3421,7 +3421,9 @@ func TestSendMPPaymentSucceed(t *testing.T) {
// The following mocked methods are called inside resumePayment. Note
// that the payment object below will determine the state of the
// paymentLifecycle.
payment := &channeldb.MPPayment{}
payment := &channeldb.MPPayment{
Info: &channeldb.PaymentCreationInfo{Value: paymentAmt},
}
controlTower.On("FetchPayment", identifier).Return(payment, nil)
// Create a route that can send 1/4 of the total amount. This value
@@ -3588,7 +3590,9 @@ func TestSendMPPaymentSucceedOnExtraShards(t *testing.T) {
// The following mocked methods are called inside resumePayment. Note
// that the payment object below will determine the state of the
// paymentLifecycle.
payment := &channeldb.MPPayment{}
payment := &channeldb.MPPayment{
Info: &channeldb.PaymentCreationInfo{Value: paymentAmt},
}
controlTower.On("FetchPayment", identifier).Return(payment, nil)
// Create a route that can send 1/4 of the total amount. This value
@@ -3800,7 +3804,9 @@ func TestSendMPPaymentFailed(t *testing.T) {
// The following mocked methods are called inside resumePayment. Note
// that the payment object below will determine the state of the
// paymentLifecycle.
payment := &channeldb.MPPayment{}
payment := &channeldb.MPPayment{
Info: &channeldb.PaymentCreationInfo{Value: paymentAmt},
}
controlTower.On("FetchPayment", identifier).Return(payment, nil)
// Create a route that can send 1/4 of the total amount. This value
@@ -4004,7 +4010,9 @@ func TestSendMPPaymentFailedWithShardsInFlight(t *testing.T) {
// The following mocked methods are called inside resumePayment. Note
// that the payment object below will determine the state of the
// paymentLifecycle.
payment := &channeldb.MPPayment{}
payment := &channeldb.MPPayment{
Info: &channeldb.PaymentCreationInfo{Value: paymentAmt},
}
controlTower.On("FetchPayment", identifier).Return(payment, nil)
// Create a route that can send 1/4 of the total amount. This value