mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
common: hoist param_bitcoin_address where plugins can use it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -107,29 +107,3 @@ json_tok_channel_id(const char *buffer, const jsmntok_t *tok,
|
||||
return hex_decode(buffer + tok->start, tok->end - tok->start,
|
||||
cid, sizeof(*cid));
|
||||
}
|
||||
|
||||
struct command_result *param_bitcoin_address(struct command *cmd,
|
||||
const char *name,
|
||||
const char *buffer,
|
||||
const jsmntok_t *tok,
|
||||
const u8 **scriptpubkey)
|
||||
{
|
||||
/* Parse address. */
|
||||
switch (json_to_address_scriptpubkey(cmd,
|
||||
chainparams,
|
||||
buffer, tok,
|
||||
scriptpubkey)) {
|
||||
case ADDRESS_PARSE_UNRECOGNIZED:
|
||||
return command_fail(cmd, LIGHTNINGD,
|
||||
"Could not parse destination address, "
|
||||
"%s should be a valid address",
|
||||
name ? name : "address field");
|
||||
case ADDRESS_PARSE_WRONG_NETWORK:
|
||||
return command_fail(cmd, LIGHTNINGD,
|
||||
"Destination address is not on network %s",
|
||||
chainparams->network_name);
|
||||
case ADDRESS_PARSE_SUCCESS:
|
||||
return NULL;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user