Skip to content

Commit

Permalink
libplugin: Add parser for channel_hint from JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
cdecker committed Aug 6, 2024
1 parent ab61843 commit a8504b7
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions plugins/libplugin-pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,30 @@ static void channel_hint_to_json(const char *name, const struct channel_hint *hi
}

/**
* Notify subscribers of the `channel_hint` topic about a changed hint
* Load a channel_hint from its JSON representation.
*
* We share the channel_hints across payments, and across plugins, in order to
* maximize the context they have when performing payments.
* @return The initialized `channel_hint` or `NULL` if we encountered a parsing
* error.
*/
/*
static struct channel_hint *channel_hint_from_json(const tal_t *ctx,
const char *buffer,
const jsmntok_t *toks)
{
const char *ret;
struct channel_hint *hint = tal(ctx, struct channel_hint);
ret = json_scan(ctx, buffer, toks,
"{timestamp:%,scid:%,capacity_msat:%,enabled:%}",
JSON_SCAN(json_to_u32, &hint->timestamp),
JSON_SCAN(json_to_short_channel_id_dir, &hint->scid),
JSON_SCAN(json_to_msat, &hint->estimated_capacity),
JSON_SCAN(json_to_bool, &hint->enabled));
if (ret != NULL)
hint = tal_free(hint);
return hint;
}
*/
/**
* Notify subscribers of the `channel_hint` topic about a changed hint
*
Expand Down

0 comments on commit a8504b7

Please sign in to comment.