txprepare, withdraw: return the PSBT as well as raw tx.

In particular, txprepare gives us a nice way to get a valid PSBT for
testing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `txprepare` and `withdraw` now return a `psbt` field.
This commit is contained in:
Rusty Russell
2021-03-15 14:57:59 +10:30
parent dc44737fb8
commit 43a553f5ac
5 changed files with 14 additions and 12 deletions

View File

@@ -138,6 +138,7 @@ static struct command_result *sendpsbt_done(struct command *cmd,
out = jsonrpc_stream_success(cmd);
json_add_hex_talarr(out, "tx", linearize_wtx(tmpctx, utx->tx));
json_add_txid(out, "txid", &utx->txid);
json_add_psbt(out, "psbt", utx->psbt);
return command_finished(cmd, out);
}
@@ -222,6 +223,7 @@ static struct command_result *finish_txprepare(struct command *cmd,
out = jsonrpc_stream_success(cmd);
json_add_hex_talarr(out, "unsigned_tx", linearize_wtx(tmpctx, utx->tx));
json_add_txid(out, "txid", &utx->txid);
json_add_psbt(out, "psbt", utx->psbt);
return command_finished(cmd, out);
}