mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 23:54:22 +01:00
libplugin-pay: incorporate gossip store.
So we can use this for routing determinations. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
#include <bitcoin/preimage.h>
|
||||
#include <ccan/array_size/array_size.h>
|
||||
#include <ccan/tal/str/str.h>
|
||||
#include <common/dijkstra.h>
|
||||
#include <common/gossmap.h>
|
||||
#include <common/json_helpers.h>
|
||||
#include <common/json_stream.h>
|
||||
#include <common/memleak.h>
|
||||
#include <common/pseudorand.h>
|
||||
#include <common/random_select.h>
|
||||
#include <common/type_to_string.h>
|
||||
#include <errno.h>
|
||||
#include <plugins/libplugin-pay.h>
|
||||
|
||||
static struct gossmap *gossmap;
|
||||
|
||||
/* BOLT #11:
|
||||
* * `c` (24): `data_length` variable.
|
||||
* `min_final_cltv_expiry` to use for the last HTLC in the route.
|
||||
@@ -23,6 +29,15 @@ struct payment *payment_new(tal_t *ctx, struct command *cmd,
|
||||
|
||||
static u64 next_id = 0;
|
||||
|
||||
/* Now we're actually creating a payment, load gossip store */
|
||||
if (!gossmap) {
|
||||
gossmap = notleak_with_children(gossmap_load(NULL,
|
||||
GOSSIP_STORE_FILENAME));
|
||||
if (!gossmap)
|
||||
plugin_err(cmd->plugin, "Could not load gossmap %s: %s",
|
||||
GOSSIP_STORE_FILENAME, strerror(errno));
|
||||
}
|
||||
|
||||
p->children = tal_arr(p, struct payment *, 0);
|
||||
p->parent = parent;
|
||||
p->modifiers = mods;
|
||||
|
||||
Reference in New Issue
Block a user