196cc33c1c
There is a race when initiating multiple lightning payments concurrently (e.g. when doing a reverse swap with prepayment + swap payment). suggest_splits might overallocate split amounts for a channel as the splitting of both invoice amounts runs concurrently and before acutal htlcs that reduce the channels balance have been added to the channel yet. This results in a "not enough balance" PaymentFailure once we try to send the htlcs and the other payment attempt already reduced the available balance of the channel. This fix takes a lock from splitting the amount until the htlcs are put on the channel, so suggest_splits always acts on the correct channel balance.