mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
plugin/pay: prevent presplitter from dividing if max already tiny.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
05a3be15a3
commit
d4def7e73a
@ -3446,7 +3446,7 @@ static void presplit_cb(struct presplit_mod_data *d, struct payment *p)
|
||||
/* The presplitter only acts on the root and only in the first
|
||||
* step. */
|
||||
size_t count = 0;
|
||||
u32 htlcs = payment_max_htlcs(p) / PRESPLIT_MAX_HTLC_SHARE;
|
||||
u32 htlcs;
|
||||
struct amount_msat target, amt = p->amount;
|
||||
char *partids = tal_strdup(tmpctx, "");
|
||||
u64 target_amount = MPP_TARGET_SIZE;
|
||||
@ -3471,6 +3471,11 @@ static void presplit_cb(struct presplit_mod_data *d, struct payment *p)
|
||||
* but makes debugging a bit easier. */
|
||||
root->next_partid++;
|
||||
|
||||
htlcs = payment_max_htlcs(p);
|
||||
/* Divide it up if we can, but it might be v low already */
|
||||
if (htlcs >= PRESPLIT_MAX_HTLC_SHARE)
|
||||
htlcs /= PRESPLIT_MAX_HTLC_SHARE;
|
||||
|
||||
if (htlcs == 0) {
|
||||
p->abort = true;
|
||||
return payment_fail(
|
||||
|
Loading…
Reference in New Issue
Block a user