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:
@@ -444,7 +444,7 @@ static void handle_incmd(struct command *cmd,
|
||||
/* Don't let them buffer multiple commands: discard old. */
|
||||
if (incmd && incmd->id != idnum) {
|
||||
plugin_log(plugin, LOG_DBG, "New cmd from %s, replacing old",
|
||||
node_id_to_hexstr(tmpctx, peer));
|
||||
fmt_node_id(tmpctx, peer));
|
||||
incmd = tal_free(incmd);
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ static void handle_incmd(struct command *cmd,
|
||||
|
||||
if (!incmd->contents) {
|
||||
plugin_log(plugin, LOG_UNUSUAL, "%s: ignoring oversize request",
|
||||
node_id_to_hexstr(tmpctx, peer));
|
||||
fmt_node_id(tmpctx, peer));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -491,7 +491,7 @@ static struct command_result *handle_reply(struct node_id *peer,
|
||||
plugin_log(plugin, LOG_DBG,
|
||||
"Ignoring unexpected %s reply from %s (id %"PRIu64")",
|
||||
terminal ? "terminal" : "partial",
|
||||
node_id_to_hexstr(tmpctx, peer),
|
||||
fmt_node_id(tmpctx, peer),
|
||||
idnum);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user