mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
paymod: Consolidate parsing RPC results in libplugin
We handle these in a number of different ways, and regularly get the parsing and logic for optional fields wrong, so let's consolidate them here.
This commit is contained in:
@@ -254,4 +254,59 @@ void NORETURN LAST_ARG_NULL plugin_main(char *argv[],
|
||||
const struct plugin_hook *hook_subs,
|
||||
size_t num_hook_subs,
|
||||
...);
|
||||
|
||||
struct listpeers_channel {
|
||||
bool private;
|
||||
struct bitcoin_txid funding_txid;
|
||||
const char *state;
|
||||
struct short_channel_id *scid;
|
||||
int *direction;
|
||||
struct amount_msat total_msat;
|
||||
struct amount_msat spendable_msat;
|
||||
/* TODO Add fields as we need them. */
|
||||
};
|
||||
|
||||
struct listpeers_peer {
|
||||
struct node_id id;
|
||||
bool connected;
|
||||
const char **netaddr;
|
||||
struct feature_set *features;
|
||||
struct listpeers_channel **channels;
|
||||
};
|
||||
|
||||
struct listpeers_result {
|
||||
struct listpeers_peer **peers;
|
||||
};
|
||||
|
||||
struct listpeers_result *json_to_listpeers_result(const tal_t *ctx,
|
||||
const char *buffer,
|
||||
const jsmntok_t *tok);
|
||||
|
||||
struct createonion_response {
|
||||
u8 *onion;
|
||||
struct secret *shared_secrets;
|
||||
};
|
||||
|
||||
struct createonion_response *json_to_createonion_response(const tal_t *ctx,
|
||||
const char *buffer,
|
||||
const jsmntok_t *toks);
|
||||
|
||||
enum route_hop_style {
|
||||
ROUTE_HOP_LEGACY = 1,
|
||||
ROUTE_HOP_TLV = 2,
|
||||
};
|
||||
|
||||
struct route_hop {
|
||||
struct short_channel_id channel_id;
|
||||
int direction;
|
||||
struct node_id nodeid;
|
||||
struct amount_msat amount;
|
||||
u32 delay;
|
||||
struct pubkey *blinding;
|
||||
enum route_hop_style style;
|
||||
};
|
||||
|
||||
struct route_hop *json_to_route(const tal_t *ctx, const char *buffer,
|
||||
const jsmntok_t *toks);
|
||||
|
||||
#endif /* LIGHTNING_PLUGINS_LIBPLUGIN_H */
|
||||
|
||||
Reference in New Issue
Block a user