mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +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:
@@ -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
|
/* The presplitter only acts on the root and only in the first
|
||||||
* step. */
|
* step. */
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
u32 htlcs = payment_max_htlcs(p) / PRESPLIT_MAX_HTLC_SHARE;
|
u32 htlcs;
|
||||||
struct amount_msat target, amt = p->amount;
|
struct amount_msat target, amt = p->amount;
|
||||||
char *partids = tal_strdup(tmpctx, "");
|
char *partids = tal_strdup(tmpctx, "");
|
||||||
u64 target_amount = MPP_TARGET_SIZE;
|
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. */
|
* but makes debugging a bit easier. */
|
||||||
root->next_partid++;
|
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) {
|
if (htlcs == 0) {
|
||||||
p->abort = true;
|
p->abort = true;
|
||||||
return payment_fail(
|
return payment_fail(
|
||||||
|
|||||||
Reference in New Issue
Block a user