mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-05 23:24:21 +01:00
jsonrpc: Let Base58 '2..' address work on both regtest and testnet.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef LIGHTNING_LIGHTNINGD_JSONRPC_H
|
||||
#define LIGHTNING_LIGHTNINGD_JSONRPC_H
|
||||
#include "config.h"
|
||||
#include <bitcoin/chainparams.h>
|
||||
#include <ccan/autodata/autodata.h>
|
||||
#include <ccan/list/list.h>
|
||||
#include <common/json.h>
|
||||
@@ -109,11 +110,22 @@ void json_add_address(struct json_result *response, const char *fieldname,
|
||||
/* For initialization */
|
||||
void setup_jsonrpc(struct lightningd *ld, const char *rpc_filename);
|
||||
|
||||
/* Returns NULL, or bip173 network name and fills in *scriptpubkey
|
||||
* allocated off ctx
|
||||
enum address_parse_result {
|
||||
/* Not recognized as an onchain address */
|
||||
ADDRESS_PARSE_UNRECOGNIZED,
|
||||
/* Recognized as an onchain address, but targets wrong network */
|
||||
ADDRESS_PARSE_WRONG_NETWORK,
|
||||
/* Recognized and succeeds */
|
||||
ADDRESS_PARSE_SUCCESS,
|
||||
};
|
||||
/* Return result of address parsing and fills in *scriptpubkey
|
||||
* allocated off ctx if ADDRESS_PARSE_SUCCESS
|
||||
*/
|
||||
const char *json_tok_address_scriptpubkey(const tal_t *ctx, const char *buffer,
|
||||
const jsmntok_t *tok, const u8 **scriptpubkey);
|
||||
enum address_parse_result
|
||||
json_tok_address_scriptpubkey(const tal_t *ctx,
|
||||
const struct chainparams *chainparams,
|
||||
const char *buffer,
|
||||
const jsmntok_t *tok, const u8 **scriptpubkey);
|
||||
|
||||
AUTODATA_TYPE(json_command, struct json_command);
|
||||
#endif /* LIGHTNING_LIGHTNINGD_JSONRPC_H */
|
||||
|
||||
Reference in New Issue
Block a user