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

Function mw_after_newaddr

plugins/spender/multiwithdraw.c:514–549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

json_get_memberFunction · 0.85
mw_load_outputsFunction · 0.85
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