MCPcopy Create free account
hub / github.com/ElementsProject/lightning / mw_after_newaddr

Function mw_after_newaddr

plugins/spender/multiwithdraw.c:516–550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

514}
515
516static struct command_result *
517mw_after_newaddr(struct command *cmd,
518 const char *buf,
519 const jsmntok_t *result,
520 struct multiwithdraw_command *mw)
521{
522 const jsmntok_t *bech32tok;
523 const u8 *script;
524
525 bech32tok = json_get_member(buf, result, "bech32");
526 if (!bech32tok
527 || json_to_address_scriptpubkey(mw, chainparams, buf, bech32tok,
528 &script) != ADDRESS_PARSE_SUCCESS)
529 plugin_err(mw->cmd->plugin,
530 "Unexpected result from newaddr: %.*s",
531 json_tok_full_len(result),
532 json_tok_full(buf, result));
533
534 plugin_log(mw->cmd->plugin, LOG_DBG,
535 "multiwithdraw %"PRIu64": change output: %.*s.",
536 mw->id,
537 json_tok_full_len(bech32tok),
538 json_tok_full(buf, bech32tok));
539
540 /* Now add the change output. */
541 struct multiwithdraw_destination change;
542 change.script = script;
543 change.amount = mw->change_amount;
544 change.all = false;
545 change.is_to_external = false;
546
547 tal_arr_expand(&mw->outputs, change);
548
549 return mw_load_outputs(mw);
550}
551
552/*-----------------------------------------------------------------------------
553PSBT Outputs Creation

Callers

nothing calls this directly

Calls 7

mw_load_outputsFunction · 0.85
json_get_memberFunction · 0.50
plugin_errFunction · 0.50
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50
plugin_logFunction · 0.50

Tested by

no test coverage detected