broadcast_tx: make sure callers free tx if necessary.

Now broadcast_tx() doesn't take ownership of the tx, make sure callers
free; a bit of refactoring to make it clear when we're making a new tx
vs. accessing an existing one, to make this clearer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-11-07 23:03:02 +10:30
parent 49a80ba457
commit dbd8e07924
3 changed files with 25 additions and 18 deletions

View File

@@ -276,7 +276,7 @@ void queue_pkt_close_signature(struct peer *peer)
struct signature our_close_sig;
close_signature__init(c);
close_tx = peer_create_close_tx(peer, peer->closing.our_fee);
close_tx = peer_create_close_tx(c, peer, peer->closing.our_fee);
peer_sign_mutual_close(peer, close_tx, &our_close_sig);
c->sig = signature_to_proto(c, peer->dstate->secpctx, &our_close_sig);