mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
bitcoind: allow commands to be registered by different plugins
An strmap is convenient to get a plugin given a method. Populate it while checking commands.
This commit is contained in:
@@ -1011,6 +1011,7 @@ static bool process_getblockchaininfo(struct bitcoin_cli *bcli)
|
||||
|
||||
static void destroy_bitcoind(struct bitcoind *bitcoind)
|
||||
{
|
||||
strmap_clear(&bitcoind->pluginsmap);
|
||||
/* Suppresses the callbacks from bcli_finished as we free conns. */
|
||||
bitcoind->shutdown = true;
|
||||
}
|
||||
@@ -1146,6 +1147,7 @@ struct bitcoind *new_bitcoind(const tal_t *ctx,
|
||||
{
|
||||
struct bitcoind *bitcoind = tal(ctx, struct bitcoind);
|
||||
|
||||
strmap_init(&bitcoind->pluginsmap);
|
||||
bitcoind->cli = NULL;
|
||||
bitcoind->datadir = NULL;
|
||||
bitcoind->ld = ld;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <bitcoin/tx.h>
|
||||
#include <ccan/list/list.h>
|
||||
#include <ccan/short_types/short_types.h>
|
||||
#include <ccan/strmap/strmap.h>
|
||||
#include <ccan/tal/tal.h>
|
||||
#include <ccan/time/time.h>
|
||||
#include <ccan/typesafe_cb/typesafe_cb.h>
|
||||
@@ -61,6 +62,10 @@ struct bitcoind {
|
||||
char *rpcuser, *rpcpass, *rpcconnect, *rpcport;
|
||||
|
||||
struct list_head pending_getfilteredblock;
|
||||
|
||||
/* Map each method to a plugin, so we can have multiple plugins
|
||||
* handling different functionalities. */
|
||||
STRMAP(struct plugin *) pluginsmap;
|
||||
};
|
||||
|
||||
/* A single outpoint in a filtered block */
|
||||
|
||||
Reference in New Issue
Block a user