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:
parent
5a057de5c4
commit
68d1753dcb
@ -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,
|
||||
)
|
||||
err = sender.htlcSwitch.SendHTLC(firstHop, pid, htlc)
|
||||
if err != nil {
|
||||
paymentErr <- err
|
||||
return
|
||||
return paymentErr
|
||||
}
|
||||
|
||||
go func() {
|
||||
resultChan, err := sender.htlcSwitch.GetPaymentResult(
|
||||
pid, rhash, newMockDeobfuscator(),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user