From cb20dfc59e7d9be4cd9d07b708494d1a921f0441 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Sun, 19 Jul 2020 21:41:39 +0200 Subject: [PATCH] paymod: Do not duplicate partids When using mpp we need to always have partids>0, since we bumped the partid for the root, but not the next_id we'd end up with partid=1 being duplicated. Not a big problem since we never ended up sending the root to lightningd, instead skipping it, but it was confusing me while trying to trace sub-payment's ancestry. --- plugins/libplugin-pay.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index b97ad6d9e..ef682f2d3 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -2217,6 +2217,12 @@ static void presplit_cb(struct presplit_mod_data *d, struct payment *p) * value. */ root->partid++; + /* Bump the next_partid as well so we don't have duplicate + * partids. Not really necessary since the root payment whose + * id could be reused will never reach the `sendonion` step, + * but makes debugging a bit easier. */ + root->next_partid++; + /* If we are already below the target size don't split it * either. */ if (amount_msat_greater(MPP_TARGET_MSAT, p->amount))