Browse Source

Misc feedback minor fixes.

Reported-by: Christian Decker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 8 years ago
parent
commit
7d3e074863
  1. 4
      daemon/peer.c
  2. 2
      lightningd/channel.h
  3. 17
      lightningd/peer_control.c

4
daemon/peer.c

@ -4365,7 +4365,9 @@ struct bitcoin_tx *peer_create_close_tx(const tal_t *ctx,
peer->anchor.index,
peer->anchor.satoshis,
cstate.side[LOCAL].pay_msat / 1000,
cstate.side[REMOTE].pay_msat / 1000, 0);
cstate.side[REMOTE].pay_msat / 1000,
/* FIXME: Real dust limit! */
0);
}
/* Sets up the initial cstate and commit tx for both nodes: false if

2
lightningd/channel.h

@ -372,7 +372,7 @@ bool channel_sending_revoke_and_ack(struct channel *channel);
bool channel_awaiting_revoke_and_ack(const struct channel *channel);
/**
* channel_has_htlcs: are there any HTLCs at all in channel?
* channel_has_htlcs: are there any (live) HTLCs at all in channel?
* @channel: the channel
*/
bool channel_has_htlcs(const struct channel *channel);

17
lightningd/peer_control.c

@ -191,6 +191,20 @@ static struct io_plan *send_error(struct io_conn *conn,
return peer_write_message(conn, pcs, pcs->peer->error, (void *)io_close_cb);
}
/* FIXME:
*
* This is a lot of code duplication! We should turn gossipd into welcomed(?):
*
* 1. gossipd listens to the socket for new connections, and also
* handles outgoing, absorbing handshaked.
*
* 2. gossipd thus knows who we're trying to connect to, and knows to
* return them immediately.
*
* That unifies the paths nicely and removes all this code. When
* gossipd hands a connection to us, it gives us the gossip fd for
* that peer, and it's all good.
*/
struct getting_gossip_fd {
struct pubkey id;
int peer_fd;
@ -1281,7 +1295,8 @@ static int peer_closing_complete(struct peer *peer, const u8 *msg)
* The amounts for each output MUST BE rounded down to whole satoshis.
*/
out_amounts[LOCAL] = *peer->our_msatoshi / 1000;
out_amounts[REMOTE] = peer->funding_satoshi - *peer->our_msatoshi / 1000;
out_amounts[REMOTE] = peer->funding_satoshi
- (*peer->our_msatoshi / 1000);
out_amounts[peer->funder] -= peer->closing_fee_received;
derive_basepoints(peer->seed, &local_funding_pubkey, NULL, NULL, NULL);

Loading…
Cancel
Save