mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
lightningd/funding_tx: fix no-change-needed case.
We only allocate one output in that case, and changekey is undefined. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
3ab3281a4c
commit
805228b939
@ -47,12 +47,11 @@ struct bitcoin_tx *funding_tx(const tal_t *ctx,
|
||||
tx->output[0].script = scriptpubkey_p2wsh(tx, wscript);
|
||||
tal_free(wscript);
|
||||
|
||||
tx->output[1].script = scriptpubkey_p2wpkh(tx, changekey);
|
||||
|
||||
if (change_satoshis != 0) {
|
||||
const void *map[2];
|
||||
map[0] = int2ptr(0);
|
||||
map[1] = int2ptr(1);
|
||||
tx->output[1].script = scriptpubkey_p2wpkh(tx, changekey);
|
||||
tx->output[1].amount = change_satoshis;
|
||||
permute_outputs(tx->output, tal_count(tx->output), map);
|
||||
*outnum = (map[0] == int2ptr(0) ? 0 : 1);
|
||||
|
Loading…
Reference in New Issue
Block a user