Added json_tok_sha256 (#1779)

Added json_tok_sha256

Converted json_tok_tok over a few places.

[ Folded: fixed spacing ]
Signed-off-by: Mark Beckwith <wythe@intrig.com>
This commit is contained in:
Mark Beckwith
2018-07-30 23:11:01 -05:00
committed by Rusty Russell
parent d3edfc8028
commit 1fca7ab562
5 changed files with 17 additions and 36 deletions

View File

@@ -158,6 +158,14 @@ bool json_tok_bool(const char *buffer, const jsmntok_t *tok, bool *b)
return false;
}
bool json_tok_sha256(const char *buffer, const jsmntok_t * tok,
struct sha256 *hash)
{
return hex_decode(buffer + tok->start,
tok->end - tok->start,
hash, sizeof(*hash));
}
bool json_tok_tok(const char *buffer, const jsmntok_t * tok,
const jsmntok_t **out)
{