diff --git a/channeld/channel.c b/channeld/channel.c index 862b87aad..393893f30 100644 --- a/channeld/channel.c +++ b/channeld/channel.c @@ -346,7 +346,7 @@ static void send_temporary_announcement(struct peer *peer) return; msg = towire_gossip_local_add_channel( - tmpctx, &peer->short_channel_ids[LOCAL], &peer->chain_hash, + NULL, &peer->short_channel_ids[LOCAL], &peer->chain_hash, &peer->node_ids[REMOTE], peer->cltv_delta, peer->conf[REMOTE].htlc_minimum_msat, peer->fee_base, peer->fee_per_satoshi); @@ -409,7 +409,7 @@ static void send_announcement_signatures(struct peer *peer) billboard_update(peer); msg = towire_announcement_signatures( - tmpctx, &peer->channel_id, &peer->short_channel_ids[LOCAL], + NULL, &peer->channel_id, &peer->short_channel_ids[LOCAL], &peer->announcement_node_sigs[LOCAL], &peer->announcement_bitcoin_sigs[LOCAL]); enqueue_peer_msg(peer, take(msg)); @@ -512,12 +512,12 @@ static void handle_peer_funding_locked(struct peer *peer, const u8 *msg) peer->funding_locked[REMOTE] = true; wire_sync_write(MASTER_FD, - take(towire_channel_got_funding_locked(peer, + take(towire_channel_got_funding_locked(NULL, &peer->remote_per_commit))); if (peer->funding_locked[LOCAL]) { wire_sync_write(MASTER_FD, - take(towire_channel_normal_operation(peer))); + take(towire_channel_normal_operation(NULL))); } billboard_update(peer); @@ -765,11 +765,11 @@ static void maybe_send_shutdown(struct peer *peer) /* Send a disable channel_update so others don't try to route * over us */ - msg = create_channel_update(peer, peer, true); + msg = create_channel_update(NULL, peer, true); wire_sync_write(GOSSIP_FD, msg); enqueue_peer_msg(peer, take(msg)); - msg = towire_shutdown(peer, &peer->channel_id, peer->final_scriptpubkey); + msg = towire_shutdown(NULL, &peer->channel_id, peer->final_scriptpubkey); enqueue_peer_msg(peer, take(msg)); peer->send_shutdown = false; peer->shutdown_sent[LOCAL] = true; @@ -974,7 +974,7 @@ static void send_commit(struct peer *peer) " (vs max %u)", feerate, max); - msg = towire_update_fee(peer, &peer->channel_id, feerate); + msg = towire_update_fee(NULL, &peer->channel_id, feerate); enqueue_peer_msg(peer, take(msg)); } @@ -999,7 +999,7 @@ static void send_commit(struct peer *peer) status_trace("Telling master we're about to commit..."); /* Tell master to save this next commit to database, then wait. */ - msg = sending_commitsig_msg(tmpctx, peer->next_index[REMOTE], + msg = sending_commitsig_msg(NULL, peer->next_index[REMOTE], channel_feerate(peer->channel, REMOTE), changed_htlcs, &peer->next_commit_sigs->commit_sig, @@ -1013,7 +1013,7 @@ static void send_commit(struct peer *peer) peer->next_index[REMOTE]++; - msg = towire_commitment_signed(peer, &peer->channel_id, + msg = towire_commitment_signed(NULL, &peer->channel_id, &peer->next_commit_sigs->commit_sig, peer->next_commit_sigs->htlc_sigs); enqueue_peer_msg(peer, take(msg)); @@ -1276,7 +1276,7 @@ static void handle_peer_commit_sig(struct peer *peer, const u8 *msg) tal_count(htlc_sigs)); /* Tell master daemon, then wait for ack. */ - msg = got_commitsig_msg(tmpctx, peer->next_index[LOCAL], + msg = got_commitsig_msg(NULL, peer->next_index[LOCAL], channel_feerate(peer->channel, LOCAL), &commit_sig, htlc_sigs, changed_htlcs, txs[0]); @@ -1366,7 +1366,7 @@ static void handle_peer_revoke_and_ack(struct peer *peer, const u8 *msg) status_trace("No commits outstanding after recv revoke_and_ack"); /* Tell master about things this locks in, wait for response */ - msg = got_revoke_msg(tmpctx, peer->revocations_received++, + msg = got_revoke_msg(NULL, peer->revocations_received++, &old_commit_secret, &next_per_commit, changed_htlcs); master_wait_sync_reply(tmpctx, peer, take(msg), @@ -1544,7 +1544,7 @@ static void handle_pong(struct peer *peer, const u8 *pong) "%s", err); wire_sync_write(MASTER_FD, - take(towire_channel_ping_reply(pong, tal_len(pong)))); + take(towire_channel_ping_reply(NULL, tal_len(pong)))); } static void handle_peer_shutdown(struct peer *peer, const u8 *shutdown) @@ -1552,7 +1552,7 @@ static void handle_peer_shutdown(struct peer *peer, const u8 *shutdown) struct channel_id channel_id; u8 *scriptpubkey, *msg; - msg = create_channel_update(peer, peer, true); + msg = create_channel_update(NULL, peer, true); wire_sync_write(GOSSIP_FD, take(msg)); if (!fromwire_shutdown(peer, shutdown, &channel_id, &scriptpubkey)) @@ -1564,7 +1564,7 @@ static void handle_peer_shutdown(struct peer *peer, const u8 *shutdown) /* Tell master: we don't have to wait because on reconnect other end * will re-send anyway. */ wire_sync_write(MASTER_FD, - take(towire_channel_got_shutdown(peer, scriptpubkey))); + take(towire_channel_got_shutdown(NULL, scriptpubkey))); peer->shutdown_sent[REMOTE] = true; /* BOLT #2: @@ -1663,7 +1663,7 @@ static void peer_conn_broken(struct peer *peer) { /* If we have signatures, send an update to say we're disabled. */ if (peer->have_sigs[LOCAL] && peer->have_sigs[REMOTE]) { - u8 *cupdate = create_channel_update(peer, peer, true); + u8 *cupdate = create_channel_update(NULL, peer, true); wire_sync_write(GOSSIP_FD, take(cupdate)); } @@ -1684,14 +1684,14 @@ static void send_fail_or_fulfill(struct peer *peer, const struct htlc *h) struct sha256 sha256_of_onion; sha256(&sha256_of_onion, h->routing, tal_len(h->routing)); - msg = towire_update_fail_malformed_htlc(peer, &peer->channel_id, + msg = towire_update_fail_malformed_htlc(NULL, &peer->channel_id, h->id, &sha256_of_onion, h->malformed); } else if (h->fail) { - msg = towire_update_fail_htlc(peer, &peer->channel_id, h->id, + msg = towire_update_fail_htlc(NULL, &peer->channel_id, h->id, h->fail); } else if (h->r) { - msg = towire_update_fulfill_htlc(peer, &peer->channel_id, h->id, + msg = towire_update_fulfill_htlc(NULL, &peer->channel_id, h->id, h->r); } else peer_failed(&peer->cs, @@ -1748,14 +1748,14 @@ static void resend_commitment(struct peer *peer, const struct changed_htlc *last /* Make sure they have the correct fee. */ if (peer->channel->funder == LOCAL) { - msg = towire_update_fee(peer, &peer->channel_id, + msg = towire_update_fee(NULL, &peer->channel_id, channel_feerate(peer->channel, REMOTE)); enqueue_peer_msg(peer, take(msg)); } /* Re-send the commitment_signed itself. */ commit_sigs = calc_commitsigs(peer, peer, peer->next_index[REMOTE]-1); - msg = towire_commitment_signed(peer, &peer->channel_id, + msg = towire_commitment_signed(NULL, &peer->channel_id, &commit_sigs->commit_sig, commit_sigs->htlc_sigs); enqueue_peer_msg(peer, take(msg)); @@ -1811,7 +1811,7 @@ static void peer_reconnect(struct peer *peer) * commitment number of the next `revoke_and_ack` message it expects * to receive. */ - msg = towire_channel_reestablish(peer, &peer->channel_id, + msg = towire_channel_reestablish(NULL, &peer->channel_id, peer->next_index[LOCAL], peer->revocations_received); if (!sync_crypto_write(&peer->cs, PEER_FD, take(msg))) @@ -1852,7 +1852,7 @@ static void peer_reconnect(struct peer *peer) /* Contains per commit point #1, for first post-opening commit */ per_commit_point(&peer->shaseed, &next_per_commit_point, 1); - msg = towire_funding_locked(peer, + msg = towire_funding_locked(NULL, &peer->channel_id, &next_per_commit_point); enqueue_peer_msg(peer, take(msg)); @@ -1963,7 +1963,7 @@ static void peer_reconnect(struct peer *peer) /* Reenable channel by sending a channel_update without the * disable flag */ - cupdate = create_channel_update(peer, peer, false); + cupdate = create_channel_update(NULL, peer, false); wire_sync_write(GOSSIP_FD, cupdate); enqueue_peer_msg(peer, take(cupdate)); @@ -1993,14 +1993,14 @@ static void handle_funding_locked(struct peer *peer, const u8 *msg) status_trace("funding_locked: sending commit index %"PRIu64": %s", peer->next_index[LOCAL], type_to_string(tmpctx, struct pubkey, &next_per_commit_point)); - msg = towire_funding_locked(peer, + msg = towire_funding_locked(NULL, &peer->channel_id, &next_per_commit_point); enqueue_peer_msg(peer, take(msg)); peer->funding_locked[LOCAL] = true; if (peer->funding_locked[REMOTE]) { wire_sync_write(MASTER_FD, - take(towire_channel_normal_operation(peer))); + take(towire_channel_normal_operation(NULL))); } billboard_update(peer); @@ -2051,14 +2051,14 @@ static void handle_offer_htlc(struct peer *peer, const u8 *inmsg) switch (e) { case CHANNEL_ERR_ADD_OK: /* Tell the peer. */ - msg = towire_update_add_htlc(peer, &peer->channel_id, + msg = towire_update_add_htlc(NULL, &peer->channel_id, peer->htlc_id, amount_msat, &payment_hash, cltv_expiry, onion_routing_packet); enqueue_peer_msg(peer, take(msg)); start_commit_timer(peer); /* Tell the master. */ - msg = towire_channel_offer_htlc_reply(inmsg, peer->htlc_id, + msg = towire_channel_offer_htlc_reply(NULL, peer->htlc_id, 0, NULL); wire_sync_write(MASTER_FD, take(msg)); peer->htlc_id++; @@ -2098,7 +2098,7 @@ static void handle_offer_htlc(struct peer *peer, const u8 *inmsg) failed: /* Note: tal_fmt doesn't set tal_len() to exact length, so fix here. */ tal_resize(&failmsg, strlen(failmsg)+1); - msg = towire_channel_offer_htlc_reply(inmsg, 0, failcode, (u8*)failmsg); + msg = towire_channel_offer_htlc_reply(NULL, 0, failcode, (u8*)failmsg); wire_sync_write(MASTER_FD, take(msg)); } @@ -2142,7 +2142,7 @@ static void handle_preimage(struct peer *peer, const u8 *inmsg) switch (channel_fulfill_htlc(peer->channel, REMOTE, id, &preimage)) { case CHANNEL_ERR_REMOVE_OK: - msg = towire_update_fulfill_htlc(peer, &peer->channel_id, + msg = towire_update_fulfill_htlc(NULL, &peer->channel_id, id, &preimage); enqueue_peer_msg(peer, take(msg)); start_commit_timer(peer); @@ -2167,7 +2167,7 @@ static u8 *foreign_channel_update(const tal_t *ctx, { u8 *msg, *update; - msg = towire_gossip_get_update(tmpctx, scid); + msg = towire_gossip_get_update(NULL, scid); msg = gossipd_wait_sync_reply(tmpctx, peer, take(msg), WIRE_GOSSIP_GET_UPDATE_REPLY); if (!fromwire_gossip_get_update_reply(ctx, msg, &update)) @@ -2337,7 +2337,7 @@ static void handle_ping_cmd(struct peer *peer, const u8 *inmsg) if (!fromwire_channel_ping(inmsg, &num_pong_bytes, &ping_len)) master_badmsg(WIRE_CHANNEL_PING, inmsg); - ping = make_ping(peer, num_pong_bytes, ping_len); + ping = make_ping(NULL, num_pong_bytes, ping_len); if (tal_len(ping) > 65535) status_failed(STATUS_FAIL_MASTER_IO, "Oversize channel_ping"); @@ -2354,7 +2354,7 @@ static void handle_ping_cmd(struct peer *peer, const u8 *inmsg) */ if (num_pong_bytes >= 65532) wire_sync_write(MASTER_FD, - take(towire_channel_ping_reply(peer, 0))); + take(towire_channel_ping_reply(NULL, 0))); else peer->num_pings_outstanding++; } @@ -2376,7 +2376,7 @@ static void handle_dev_reenable_commit(struct peer *peer) start_commit_timer(peer); status_trace("dev_reenable_commit"); wire_sync_write(MASTER_FD, - take(towire_channel_dev_reenable_commit_reply(peer))); + take(towire_channel_dev_reenable_commit_reply(NULL))); } #endif @@ -2601,7 +2601,7 @@ static void send_shutdown_complete(struct peer *peer) /* Now we can tell master shutdown is complete. */ wire_sync_write(MASTER_FD, - take(towire_channel_shutdown_complete(peer, + take(towire_channel_shutdown_complete(NULL, &peer->cs, peer->gossip_index))); fdpass_send(MASTER_FD, PEER_FD); diff --git a/closingd/closing.c b/closingd/closing.c index 57a2e13a0..c3cf7959e 100644 --- a/closingd/closing.c +++ b/closingd/closing.c @@ -98,7 +98,7 @@ static void do_reconnect(struct crypto_state *cs, * `next_remote_revocation_number` to the commitment number of the * next `revoke_and_ack` message it expects to receive. */ - msg = towire_channel_reestablish(tmpctx, channel_id, + msg = towire_channel_reestablish(NULL, channel_id, next_index[LOCAL], revocations_received); if (!sync_crypto_write(cs, PEER_FD, take(msg))) @@ -185,7 +185,7 @@ static void send_offer(struct crypto_state *cs, status_trace("sending fee offer %"PRIu64, fee_to_offer); - msg = towire_closing_signed(tmpctx, channel_id, fee_to_offer, &our_sig); + msg = towire_closing_signed(NULL, channel_id, fee_to_offer, &our_sig); if (!sync_crypto_write(cs, PEER_FD, take(msg))) peer_failed_connection_lost(); } @@ -575,7 +575,7 @@ int main(int argc, char *argv[]) /* We're done! */ wire_sync_write(REQ_FD, - take(towire_closing_complete(ctx, gossip_index))); + take(towire_closing_complete(NULL, gossip_index))); tal_free(ctx); tal_free(tmpctx); diff --git a/common/read_peer_msg.c b/common/read_peer_msg.c index 33a972595..94717bbf8 100644 --- a/common/read_peer_msg.c +++ b/common/read_peer_msg.c @@ -24,7 +24,7 @@ static void handle_ping(const u8 *msg, if (!check_ping_make_pong(msg, msg, &pong)) { send_reply(cs, peer_fd, - take(towire_errorfmt(msg, channel, + take(towire_errorfmt(NULL, channel, "Bad ping %s", tal_hex(msg, msg))), arg); io_error(arg); @@ -97,9 +97,9 @@ u8 *read_peer_msg_(const tal_t *ctx, && !structeq(&chanid, channel)) { status_trace("Rejecting %s for unknown channel_id %s", wire_type_name(fromwire_peektype(msg)), - type_to_string(msg, struct channel_id, &chanid)); + type_to_string(tmpctx, struct channel_id, &chanid)); if (!send_reply(cs, peer_fd, - take(towire_errorfmt(msg, &chanid, + take(towire_errorfmt(NULL, &chanid, "Multiple channels" " unsupported")), arg)) diff --git a/gossipd/gossip.c b/gossipd/gossip.c index 15e9408ed..f24058948 100644 --- a/gossipd/gossip.c +++ b/gossipd/gossip.c @@ -415,7 +415,7 @@ static struct io_plan *init_new_peer(struct io_conn *conn, * Each node MUST send `init` as the first lightning message for any * connection. */ - initmsg = towire_init(peer, + initmsg = towire_init(NULL, daemon->globalfeatures, daemon->localfeatures); return peer_write_message(conn, &peer->local->pcs, take(initmsg), read_init); @@ -467,7 +467,7 @@ static void send_node_announcement(struct daemon *daemon) nannounce = create_node_announcement(tmpctx, daemon, NULL, timestamp); - if (!wire_sync_write(HSM_FD, take(towire_hsm_node_announcement_sig_req(tmpctx, nannounce)))) + if (!wire_sync_write(HSM_FD, take(towire_hsm_node_announcement_sig_req(NULL, nannounce)))) status_failed(STATUS_FAIL_MASTER_IO, "Could not write to HSM: %s", strerror(errno)); msg = wire_sync_read(tmpctx, HSM_FD); @@ -477,7 +477,7 @@ static void send_node_announcement(struct daemon *daemon) /* We got the signature for out provisional node_announcement back * from the HSM, create the real announcement and forward it to * gossipd so it can take care of forwarding it. */ - nannounce = create_node_announcement(tmpctx, daemon, &sig, timestamp); + nannounce = create_node_announcement(NULL, daemon, &sig, timestamp); err = handle_node_announcement(daemon->rstate, take(nannounce)); if (err) status_failed(STATUS_FAIL_INTERNAL_ERROR, @@ -543,7 +543,7 @@ static void handle_pong(struct peer *peer, const u8 *pong) } daemon_conn_send(&peer->daemon->master, - take(towire_gossip_ping_reply(pong, true, + take(towire_gossip_ping_reply(NULL, true, tal_len(pong)))); } @@ -551,7 +551,7 @@ static void handle_pong(struct peer *peer, const u8 *pong) * dies while we're waiting for it to finish IO */ static void fail_release(struct peer *peer) { - u8 *msg = towire_gossipctl_release_peer_replyfail(peer); + u8 *msg = towire_gossipctl_release_peer_replyfail(NULL); daemon_conn_send(&peer->daemon->master, take(msg)); } @@ -778,7 +778,7 @@ static void handle_get_update(struct peer *peer, const u8 *msg) type_to_string(tmpctx, struct short_channel_id, &scid), update ? "got" : "no"); - msg = towire_gossip_get_update_reply(msg, update); + msg = towire_gossip_get_update_reply(NULL, update); daemon_conn_send(peer->remote, take(msg)); } @@ -931,7 +931,7 @@ static bool nonlocal_dump_gossip(struct io_conn *conn, struct daemon_conn *dc) peer->gossip_sync = false; return false; } else { - u8 *msg = towire_gossip_send_gossip(conn, + u8 *msg = towire_gossip_send_gossip(NULL, peer->broadcast_index, next); daemon_conn_send(peer->remote, take(msg)); @@ -1046,13 +1046,13 @@ static struct io_plan *disconnect_peer(struct io_conn *conn, struct daemon *daem if (peer && peer->local) { /* This peer is local to this (gossipd) dameon */ io_close(peer->local->conn); - msg = towire_gossipctl_peer_disconnect_reply(msg); + msg = towire_gossipctl_peer_disconnect_reply(NULL); daemon_conn_send(&daemon->master, take(msg)); } else { status_trace("disconnect_peer: peer %s %s", type_to_string(tmpctx, struct pubkey, &id), !peer ? "not connected" : "not gossiping"); - msg = towire_gossipctl_peer_disconnect_replyfail(msg, peer ? true : false); + msg = towire_gossipctl_peer_disconnect_replyfail(NULL, peer ? true : false); daemon_conn_send(&daemon->master, take(msg)); } return daemon_conn_read_next(conn, &daemon->master); @@ -1075,7 +1075,7 @@ static struct io_plan *release_peer(struct io_conn *conn, struct daemon *daemon, !peer ? "not found" : peer->local ? "already releasing" : "not local"); - msg = towire_gossipctl_release_peer_replyfail(msg); + msg = towire_gossipctl_release_peer_replyfail(NULL); daemon_conn_send(&daemon->master, take(msg)); } else { peer->local->return_to_master = true; @@ -1181,7 +1181,7 @@ static struct io_plan *getchannels_req(struct io_conn *conn, struct daemon *daem } } - out = towire_gossip_getchannels_reply(daemon, entries); + out = towire_gossip_getchannels_reply(NULL, entries); daemon_conn_send(&daemon->master, take(out)); return daemon_conn_read_next(conn, &daemon->master); } @@ -1231,7 +1231,7 @@ static struct io_plan *getnodes(struct io_conn *conn, struct daemon *daemon, n = node_map_next(daemon->rstate->nodes, &i); } } - out = towire_gossip_getnodes_reply(daemon, nodes); + out = towire_gossip_getnodes_reply(NULL, nodes); daemon_conn_send(&daemon->master, take(out)); return daemon_conn_read_next(conn, &daemon->master); } @@ -1250,7 +1250,7 @@ static struct io_plan *ping_req(struct io_conn *conn, struct daemon *daemon, peer = find_peer(daemon, &id); if (!peer) { daemon_conn_send(&daemon->master, - take(towire_gossip_ping_reply(peer, false, 0))); + take(towire_gossip_ping_reply(NULL, false, 0))); goto out; } @@ -1270,7 +1270,7 @@ static struct io_plan *ping_req(struct io_conn *conn, struct daemon *daemon, */ if (num_pong_bytes >= 65532) daemon_conn_send(&daemon->master, - take(towire_gossip_ping_reply(peer, true, 0))); + take(towire_gossip_ping_reply(NULL, true, 0))); else peer->local->num_pings_outstanding++; @@ -1572,7 +1572,7 @@ static struct io_plan *resolve_channel_req(struct io_conn *conn, type_to_string(tmpctx, struct pubkey, &keys[1])); } daemon_conn_send(&daemon->master, - take(towire_gossip_resolve_channel_reply(msg, keys))); + take(towire_gossip_resolve_channel_reply(NULL, keys))); return daemon_conn_read_next(conn, &daemon->master); } @@ -1612,7 +1612,7 @@ static void connect_failed(struct io_conn *conn, struct reaching *reach) daemon_conn_send( &reach->daemon->master, take(towire_gossip_peer_connection_failed( - conn, &reach->id, diff, reach->attempts, false))); + NULL, &reach->id, diff, reach->attempts, false))); tal_free(reach); } else { status_trace("Failed connected out for %s, will try again", @@ -1684,7 +1684,7 @@ static void try_connect(struct reaching *reach) daemon_conn_send( &reach->daemon->master, take(towire_gossip_peer_connection_failed( - reach, &reach->id, + NULL, &reach->id, time_now().ts.tv_sec - reach->first_attempt, reach->attempts, true))); tal_free(reach); @@ -1767,7 +1767,7 @@ static struct io_plan *reach_peer(struct io_conn *conn, /* Master can't check this itself, because that's racy. */ if (try_reach_peer(daemon, &id)) { daemon_conn_send(&daemon->master, - take(towire_gossip_peer_already_connected(conn, + take(towire_gossip_peer_already_connected(NULL, &id))); } @@ -1826,7 +1826,7 @@ static struct io_plan *get_peers(struct io_conn *conn, } daemon_conn_send(&daemon->master, - take(towire_gossip_getpeers_reply(conn, id, wireaddr, nodes))); + take(towire_gossip_getpeers_reply(NULL, id, wireaddr, nodes))); return daemon_conn_read_next(conn, &daemon->master); } diff --git a/hsmd/hsm.c b/hsmd/hsm.c index 8152931fe..9d2d0b0f1 100644 --- a/hsmd/hsm.c +++ b/hsmd/hsm.c @@ -125,7 +125,7 @@ static struct io_plan *handle_ecdh(struct io_conn *conn, struct daemon_conn *dc) if (!fromwire_hsm_ecdh_req(dc->msg_in, &point)) { daemon_conn_send(c->master, - take(towire_hsmstatus_client_bad_request(c, + take(towire_hsmstatus_client_bad_request(NULL, &c->id, dc->msg_in))); return io_close(conn); @@ -137,13 +137,13 @@ static struct io_plan *handle_ecdh(struct io_conn *conn, struct daemon_conn *dc) status_broken("secp256k1_ecdh fail for client %s", type_to_string(tmpctx, struct pubkey, &c->id)); daemon_conn_send(c->master, - take(towire_hsmstatus_client_bad_request(c, + take(towire_hsmstatus_client_bad_request(NULL, &c->id, dc->msg_in))); return io_close(conn); } - daemon_conn_send(dc, take(towire_hsm_ecdh_resp(c, &ss))); + daemon_conn_send(dc, take(towire_hsm_ecdh_resp(NULL, &ss))); return daemon_conn_read_next(conn, dc); } @@ -178,7 +178,7 @@ static struct io_plan *handle_cannouncement_sig(struct io_conn *conn, sign_hash(&node_pkey, &hash, &node_sig); - reply = towire_hsm_cannouncement_sig_reply(ca, &node_sig); + reply = towire_hsm_cannouncement_sig_reply(NULL, &node_sig); daemon_conn_send(dc, take(reply)); return daemon_conn_read_next(conn, dc); @@ -230,7 +230,7 @@ static struct io_plan *handle_channel_update_sig(struct io_conn *conn, cltv_expiry_delta, htlc_minimum_msat, fee_base_msat, fee_proportional_mill); - daemon_conn_send(dc, take(towire_hsm_cupdate_sig_reply(tmpctx, cu))); + daemon_conn_send(dc, take(towire_hsm_cupdate_sig_reply(NULL, cu))); return daemon_conn_read_next(conn, dc); } @@ -284,7 +284,7 @@ static struct io_plan *handle_client(struct io_conn *conn, status_broken("Client does not have the required capability to run %d", t); daemon_conn_send(c->master, take(towire_hsmstatus_client_bad_request( - c, &c->id, dc->msg_in))); + NULL, &c->id, dc->msg_in))); return io_close(conn); } @@ -337,7 +337,7 @@ static struct io_plan *handle_client(struct io_conn *conn, } daemon_conn_send(c->master, - take(towire_hsmstatus_client_bad_request(c, + take(towire_hsmstatus_client_bad_request(NULL, &c->id, dc->msg_in))); return io_close(conn); @@ -366,7 +366,7 @@ static void send_init_response(struct daemon_conn *master) hsm_peer_secret_base(&peer_seed); node_key(NULL, &node_id); - msg = towire_hsm_init_reply(master, &node_id, &peer_seed, + msg = towire_hsm_init_reply(NULL, &node_id, &peer_seed, &secretstuff.bip32); daemon_conn_send(master, take(msg)); } @@ -543,7 +543,7 @@ static void pass_client_hsmfd(struct daemon_conn *master, const u8 *msg) new_client(master, &id, capabilities, handle_client, fds[0]); daemon_conn_send(master, - take(towire_hsm_client_hsmfd_reply(master))); + take(towire_hsm_client_hsmfd_reply(NULL))); daemon_conn_send_fd(master, fds[1]); } @@ -662,7 +662,7 @@ static void sign_funding_tx(struct daemon_conn *master, const u8 *msg) tx->input[i].script = scriptSigs[i]; daemon_conn_send(master, - take(towire_hsm_sign_funding_reply(tmpctx, tx))); + take(towire_hsm_sign_funding_reply(NULL, tx))); } /** @@ -733,7 +733,7 @@ static void sign_withdrawal_tx(struct daemon_conn *master, const u8 *msg) tx->input[i].script = scriptSigs[i]; daemon_conn_send(master, - take(towire_hsm_sign_withdrawal_reply(tmpctx, tx))); + take(towire_hsm_sign_withdrawal_reply(NULL, tx))); } /** @@ -775,7 +775,7 @@ static void sign_invoice(struct daemon_conn *master, const u8 *msg) } daemon_conn_send(master, - take(towire_hsm_sign_invoice_reply(tmpctx, &rsig))); + take(towire_hsm_sign_invoice_reply(NULL, &rsig))); } static void sign_node_announcement(struct daemon_conn *master, const u8 *msg) @@ -806,7 +806,7 @@ static void sign_node_announcement(struct daemon_conn *master, const u8 *msg) sign_hash(&node_pkey, &hash, &sig); - reply = towire_hsm_node_announcement_sig_reply(msg, &sig); + reply = towire_hsm_node_announcement_sig_reply(NULL, &sig); daemon_conn_send(master, take(reply)); } diff --git a/lightningd/bitcoind.c b/lightningd/bitcoind.c index d9154a49e..08ea518b8 100644 --- a/lightningd/bitcoind.c +++ b/lightningd/bitcoind.c @@ -613,7 +613,7 @@ static bool process_getblockhash_for_txout(struct bitcoin_cli *bcli) start_bitcoin_cli(bcli->bitcoind, NULL, process_getblock, false, cb, go, "getblock", - take(tal_strndup(go, bcli->output,bcli->output_bytes)), + take(tal_strndup(NULL, bcli->output,bcli->output_bytes)), NULL); return true; } @@ -635,7 +635,7 @@ void bitcoind_getoutput_(struct bitcoind *bitcoind, /* We may not have topology ourselves that far back, so ask bitcoind */ start_bitcoin_cli(bitcoind, NULL, process_getblockhash_for_txout, true, cb, go, - "getblockhash", take(tal_fmt(go, "%u", blocknum)), + "getblockhash", take(tal_fmt(NULL, "%u", blocknum)), NULL); /* Looks like a leak, but we free it in process_getblock */ diff --git a/lightningd/channel.c b/lightningd/channel.c index 775821386..cd74f650b 100644 --- a/lightningd/channel.c +++ b/lightningd/channel.c @@ -293,7 +293,7 @@ void channel_fail_permanent(struct channel *channel, const char *fmt, ...) va_end(ap); if (channel->scid) { - msg = towire_gossip_disable_channel(channel, + msg = towire_gossip_disable_channel(NULL, channel->scid, channel->peer->direction, false); @@ -390,7 +390,7 @@ void channel_fail_transient(struct channel *channel, const char *fmt, ...) if (ld->no_reconnect) return; #endif /* DEVELOPER */ - u8 *msg = towire_gossipctl_reach_peer(channel, + u8 *msg = towire_gossipctl_reach_peer(NULL, &channel->peer->id); subd_send_msg(ld->gossip, take(msg)); }