mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 07:34:21 +01:00
wallet: Hook into the hsm_funding_sig to extract change outputs
This is the step where we broadcast the transaction to the network and a nice place to extract the change from the transaction. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
d14c9d30cd
commit
fa13190595
@@ -1378,6 +1378,7 @@ static void opening_got_hsm_funding_sig(struct funding_channel *fc,
|
||||
{
|
||||
secp256k1_ecdsa_signature *sigs;
|
||||
struct bitcoin_tx *tx = fc->funding_tx;
|
||||
u64 change_satoshi;
|
||||
size_t i;
|
||||
|
||||
if (!fromwire_hsmctl_sign_funding_reply(fc, resp, NULL, &sigs))
|
||||
@@ -1407,6 +1408,9 @@ static void opening_got_hsm_funding_sig(struct funding_channel *fc,
|
||||
watch_tx(fc->peer, fc->peer->ld->topology, fc->peer, tx,
|
||||
funding_lockin_cb, NULL);
|
||||
|
||||
/* Extract the change output and add it to the DB */
|
||||
wallet_extract_owned_outputs(fc->peer->ld->wallet, tx, &change_satoshi);
|
||||
|
||||
/* FIXME: Remove arg from cb? */
|
||||
watch_txo(fc->peer, fc->peer->ld->topology, fc->peer,
|
||||
fc->peer->funding_txid, fc->peer->funding_outnum,
|
||||
|
||||
Reference in New Issue
Block a user