global: expose all fmt_X functions for direct use, make uniform.
We have various functions to convert to a string, rename them all so we can count on fmt_X being the formatter for struct X, and make them all return `char *`. Sometimes they existed but were private, sometimes they had a different name. Most take a pointer, but simple types pass by copy: short_channel_id, amount_msat and amount_sat. The following public functions changed: 1. psbt_to_b64 -> fmt_wally_psbt. 2. pubkey_to_hexstr -> fmt_pubkey. 3. short_channel_id_to_str -> fmt_short_channel_id (scid by copy now!) 4. fmt_signature -> fmt_secp256k1_ecdsa_signature 5. fmt_amount_sat/fmt_amount_msat pass copy not pointer, return non-const char *. 6. node_id_to_hexstr -> fmt_node_id Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -768,7 +768,7 @@ static void delete_channel_from_db(struct command *cmd,
|
||||
tal_fmt(tmpctx,
|
||||
"DELETE FROM channels"
|
||||
" WHERE short_channel_id = '%s'",
|
||||
short_channel_id_to_str(tmpctx, &scid)),
|
||||
fmt_short_channel_id(tmpctx, scid)),
|
||||
NULL, NULL, &errmsg);
|
||||
if (err != SQLITE_OK)
|
||||
plugin_err(cmd->plugin, "Could not delete from channels: %s",
|
||||
@@ -904,7 +904,7 @@ static void delete_node_from_db(struct command *cmd,
|
||||
tal_fmt(tmpctx,
|
||||
"DELETE FROM nodes"
|
||||
" WHERE nodeid = X'%s'",
|
||||
node_id_to_hexstr(tmpctx, id)),
|
||||
fmt_node_id(tmpctx, id)),
|
||||
NULL, NULL, &errmsg);
|
||||
if (err != SQLITE_OK)
|
||||
plugin_err(cmd->plugin, "Could not delete from nodes: %s",
|
||||
|
||||
Reference in New Issue
Block a user