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.
This commit is contained in:
Christian Decker
2020-07-19 21:41:39 +02:00
committed by Rusty Russell
parent 7b4e70effa
commit cb20dfc59e

View File

@@ -2217,6 +2217,12 @@ static void presplit_cb(struct presplit_mod_data *d, struct payment *p)
* value. */ * value. */
root->partid++; 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 /* If we are already below the target size don't split it
* either. */ * either. */
if (amount_msat_greater(MPP_TARGET_MSAT, p->amount)) if (amount_msat_greater(MPP_TARGET_MSAT, p->amount))