mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-12 23:28:31 +01:00
multi: make GetPaymentResult take payment hash
Used for logging in the switch, and when we remove the pending payments, only the router will have the hash stored across restarts.
This commit is contained in:
@@ -52,7 +52,8 @@ func (m *mockPaymentAttemptDispatcher) SendHTLC(firstHop lnwire.ShortChannelID,
|
||||
}
|
||||
|
||||
func (m *mockPaymentAttemptDispatcher) GetPaymentResult(paymentID uint64,
|
||||
_ htlcswitch.ErrorDecrypter) (<-chan *htlcswitch.PaymentResult, error) {
|
||||
_ lntypes.Hash, _ htlcswitch.ErrorDecrypter) (
|
||||
<-chan *htlcswitch.PaymentResult, error) {
|
||||
|
||||
c := make(chan *htlcswitch.PaymentResult, 1)
|
||||
res, ok := m.results[paymentID]
|
||||
@@ -139,8 +140,8 @@ func (m *mockPayer) SendHTLC(_ lnwire.ShortChannelID,
|
||||
|
||||
}
|
||||
|
||||
func (m *mockPayer) GetPaymentResult(paymentID uint64, _ htlcswitch.ErrorDecrypter) (
|
||||
<-chan *htlcswitch.PaymentResult, error) {
|
||||
func (m *mockPayer) GetPaymentResult(paymentID uint64, _ lntypes.Hash,
|
||||
_ htlcswitch.ErrorDecrypter) (<-chan *htlcswitch.PaymentResult, error) {
|
||||
|
||||
select {
|
||||
case res := <-m.paymentResult:
|
||||
|
||||
@@ -95,7 +95,7 @@ func (p *paymentLifecycle) resumePayment() ([32]byte, *route.Route, error) {
|
||||
// Now ask the switch to return the result of the payment when
|
||||
// available.
|
||||
resultChan, err := p.router.cfg.Payer.GetPaymentResult(
|
||||
p.attempt.PaymentID, errorDecryptor,
|
||||
p.attempt.PaymentID, p.payment.PaymentHash, errorDecryptor,
|
||||
)
|
||||
switch {
|
||||
|
||||
|
||||
@@ -138,7 +138,8 @@ type PaymentAttemptDispatcher interface {
|
||||
// HTLC is guaranteed to no longer be in flight. The switch shutting
|
||||
// down is signaled by closing the channel. If the paymentID is
|
||||
// unknown, ErrPaymentIDNotFound will be returned.
|
||||
GetPaymentResult(paymentID uint64, deobfuscator htlcswitch.ErrorDecrypter) (
|
||||
GetPaymentResult(paymentID uint64, paymentHash lntypes.Hash,
|
||||
deobfuscator htlcswitch.ErrorDecrypter) (
|
||||
<-chan *htlcswitch.PaymentResult, error)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user