mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-04 18:01:57 +01:00
htlcswitch/test_utils: send htlcs before waiting for result
This commit is preparation for the test added in the subsequent commit. We modify makeHoldPayment to return any failures direectly when trying to add an HTLC to the switch. This lets us know that the HTLC was indeed sent without failure when the method returns.
This commit is contained in:
@@ -1345,15 +1345,13 @@ func (n *twoHopNetwork) makeHoldPayment(sendingPeer, receivingPeer lnpeer.Peer,
|
||||
}
|
||||
|
||||
// Send payment and expose err channel.
|
||||
go func() {
|
||||
err := sender.htlcSwitch.SendHTLC(
|
||||
firstHop, pid, htlc,
|
||||
)
|
||||
if err != nil {
|
||||
paymentErr <- err
|
||||
return
|
||||
}
|
||||
err = sender.htlcSwitch.SendHTLC(firstHop, pid, htlc)
|
||||
if err != nil {
|
||||
paymentErr <- err
|
||||
return paymentErr
|
||||
}
|
||||
|
||||
go func() {
|
||||
resultChan, err := sender.htlcSwitch.GetPaymentResult(
|
||||
pid, rhash, newMockDeobfuscator(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user