plugins/keysend: prevent leak detecting getting upset.

1. We don't keep a pointer to payments (unlike pay, which keeps a
   linked list), so mark it notleak.
2. plugin->our_features is overloaded for "features we want to set" (used by keysend)
   and then "features we have".  Create a new field, which is cleaner.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-02-26 11:20:33 +10:30
parent 6c8ea95f6e
commit b3338a174e
2 changed files with 7 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
#include <ccan/asort/asort.h>
#include <ccan/tal/str/str.h>
#include <common/json_tok.h>
#include <common/memleak.h>
#include <common/type_to_string.h>
#include <plugins/libplugin-pay.h>
#include <sodium.h>
@@ -223,7 +224,7 @@ static struct command_result *json_keysend(struct command *cmd, const char *buf,
p->label = tal_steal(p, label);
payment_start(p);
/* We're keeping this around now */
tal_steal(cmd->plugin, p);
tal_steal(cmd->plugin, notleak(p));
return command_still_pending(cmd);
}