gossmap: move gossmap_guess_node_id to pay plugin.

This removes a point32 dependency.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-10-17 11:07:05 +10:30
parent 7745513c51
commit 82d98e4b96
8 changed files with 104 additions and 148 deletions

20
plugins/pay_point32.c Normal file
View File

@@ -0,0 +1,20 @@
#include <bitcoin/pubkey.h>
#include <common/gossmap.h>
#include <common/node_id.h>
#include <plugins/pay_point32.h>
/* There are two 33-byte pubkeys possible: choose the one which appears
* in the graph (otherwise payment will fail anyway). */
void gossmap_guess_node_id(const struct gossmap *map,
const struct point32 *point32,
struct node_id *id)
{
struct pubkey pk;
pk.pubkey = point32->pubkey;
node_id_from_pubkey(id, &pk);
/* If we don't find this, let's assume it's the alternate. */
if (!gossmap_find_node(map, id))
id->k[0] |= 1;
}