diff --git a/daemon/packets.c b/daemon/packets.c index 7d0742425..28d3cd50a 100644 --- a/daemon/packets.c +++ b/daemon/packets.c @@ -72,7 +72,7 @@ static void queue_pkt(struct peer *peer, Pkt__PktCase type, const void *msg) queue_raw_pkt(peer, make_pkt(peer, type, msg)); } -void queue_pkt_open(struct peer *peer, OpenChannel__AnchorOffer anchor) +void queue_pkt_open(struct peer *peer, bool offer_anchor) { OpenChannel *o = tal(peer, OpenChannel); @@ -88,14 +88,10 @@ void queue_pkt_open(struct peer *peer, OpenChannel__AnchorOffer anchor) o->delay->locktime_case = LOCKTIME__LOCKTIME_BLOCKS; o->delay->blocks = rel_locktime_to_blocks(&peer->local.locktime); o->initial_fee_rate = peer->local.commit_fee_rate; - if (anchor == OPEN_CHANNEL__ANCHOR_OFFER__WILL_CREATE_ANCHOR) - assert(peer->local.offer_anchor); - else { - assert(anchor == OPEN_CHANNEL__ANCHOR_OFFER__WONT_CREATE_ANCHOR); - assert(!peer->local.offer_anchor); - } - - o->anch = anchor; + if (offer_anchor) + o->anch = OPEN_CHANNEL__ANCHOR_OFFER__WILL_CREATE_ANCHOR; + else + o->anch = OPEN_CHANNEL__ANCHOR_OFFER__WONT_CREATE_ANCHOR; o->min_depth = peer->local.mindepth; queue_pkt(peer, PKT__PKT_OPEN, o); } diff --git a/daemon/packets.h b/daemon/packets.h index 9e34c017c..811c70d41 100644 --- a/daemon/packets.h +++ b/daemon/packets.h @@ -10,7 +10,7 @@ struct bitcoin_signature; struct commit_info; /* Send various kinds of packets */ -void queue_pkt_open(struct peer *peer, OpenChannel__AnchorOffer anchor); +void queue_pkt_open(struct peer *peer, bool offer_anchor); void queue_pkt_anchor(struct peer *peer); void queue_pkt_open_commit_sig(struct peer *peer); void queue_pkt_open_complete(struct peer *peer); diff --git a/daemon/peer.c b/daemon/peer.c index 61f4e3784..993407bfe 100644 --- a/daemon/peer.c +++ b/daemon/peer.c @@ -2555,8 +2555,6 @@ static struct io_plan *peer_send_init(struct io_conn *conn, struct peer *peer) /* Crypto is on, we are live. */ static struct io_plan *peer_crypto_on(struct io_conn *conn, struct peer *peer) { - OpenChannel__AnchorOffer anchor; - peer_secrets_init(peer); peer_get_revocation_hash(peer, 0, &peer->local.next_revocation_hash); @@ -2566,10 +2564,6 @@ static struct io_plan *peer_crypto_on(struct io_conn *conn, struct peer *peer) set_peer_state(peer, STATE_OPEN_WAIT_FOR_OPENPKT, __func__, false); /* FIXME: Start timeout, and close peer if they don't progress! */ - if (peer->local.offer_anchor) - anchor = OPEN_CHANNEL__ANCHOR_OFFER__WILL_CREATE_ANCHOR; - else - anchor = OPEN_CHANNEL__ANCHOR_OFFER__WONT_CREATE_ANCHOR; /* FIXME: Delay db write until we have something to keep, or handle * reconnect with STATE_INIT state. */ @@ -2582,7 +2576,7 @@ static struct io_plan *peer_crypto_on(struct io_conn *conn, struct peer *peer) peer->local.commit->revocation_hash = peer->local.next_revocation_hash; peer_get_revocation_hash(peer, 1, &peer->local.next_revocation_hash); - queue_pkt_open(peer, anchor); + queue_pkt_open(peer, peer->local.offer_anchor); return peer_send_init(conn,peer); }