mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
json: reverse parse a coin_mvt tag back into an enum
This commit is contained in:
@@ -108,6 +108,22 @@ bool json_to_channel_id(const char *buffer, const jsmntok_t *tok,
|
||||
cid, sizeof(*cid));
|
||||
}
|
||||
|
||||
|
||||
bool json_to_coin_mvt_tag(const char *buffer, const jsmntok_t *tok,
|
||||
enum mvt_tag *tag)
|
||||
{
|
||||
enum mvt_tag i_tag;
|
||||
for (size_t i = 0; i < NUM_MVT_TAGS; i++) {
|
||||
i_tag = (enum mvt_tag) i;
|
||||
if (json_tok_streq(buffer, tok, mvt_tag_str(i_tag))) {
|
||||
*tag = i_tag;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool split_tok(const char *buffer, const jsmntok_t *tok,
|
||||
char split,
|
||||
jsmntok_t *a,
|
||||
|
||||
Reference in New Issue
Block a user