Browse Source

peer.c, packets.c: make more functions static.

This also has to re-order functions, so it looks worse than it is. 

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 8 years ago
parent
commit
08f7ade80f
  1. 3
      daemon/packets.h
  2. 1111
      daemon/peer.c
  3. 35
      daemon/peer.h
  4. 21
      state.h

3
daemon/packets.h

@ -9,9 +9,6 @@ struct sha256;
struct bitcoin_signature;
struct commit_info;
/* Inform peer have an unexpected packet. */
void peer_unexpected_pkt(struct peer *peer, const Pkt *pkt);
/* Send various kinds of packets */
void queue_pkt_open(struct peer *peer, OpenChannel__AnchorOffer anchor);
void queue_pkt_anchor(struct peer *peer);

1111
daemon/peer.c

File diff suppressed because it is too large

35
daemon/peer.h

@ -224,35 +224,9 @@ struct peer *find_peer(struct lightningd_state *dstate, const struct pubkey *id)
/* Populates very first peer->{local,remote}.commit->{tx,cstate} */
bool setup_first_commit(struct peer *peer);
/* Set up timer: we have something we can commit. */
void remote_changes_pending(struct peer *peer);
/* Add this unacked change */
void add_unacked(struct peer_visible_state *which,
const union htlc_staging *stage);
/* These unacked changes are now acked; add them to acked set. */
void add_acked_changes(union htlc_staging **acked,
const union htlc_staging *changes);
/* Both sides are committed to these changes they proposed. */
void peer_both_committed_to(struct peer *peer,
const union htlc_staging *changes, enum channel_side side);
/* Allocate a new commit_info struct. */
struct commit_info *new_commit_info(const tal_t *ctx);
struct state_table {
enum htlc_state from, to;
};
bool htlcs_changestate(struct peer *peer,
const struct state_table *table, size_t n);
void apply_changeset(struct peer *peer,
struct peer_visible_state *which,
enum channel_side side,
const union htlc_staging *changes,
size_t num_changes);
/* Freeing removes from map, too */
struct htlc *peer_new_htlc(struct peer *peer,
u64 id,
@ -270,19 +244,12 @@ struct htlc *command_htlc_add(struct peer *peer, u64 msatoshis,
struct htlc *src,
const u8 *route);
/* Peer has recieved revocation. */
void peer_update_complete(struct peer *peer);
void peer_unexpected_pkt(struct peer *peer, const Pkt *pkt);
/* Peer has completed open, or problem (if non-NULL). */
void peer_open_complete(struct peer *peer, const char *problem);
struct bitcoin_tx *peer_create_close_tx(struct peer *peer, u64 fee);
uint64_t commit_tx_fee(const struct bitcoin_tx *commit,
uint64_t anchor_satoshis);
void our_htlc_fulfilled(struct peer *peer, struct htlc *htlc,
const struct rval *preimage);
void cleanup_peers(struct lightningd_state *dstate);
#endif /* LIGHTNING_DAEMON_PEER_H */

21
state.h

@ -115,29 +115,14 @@ void peer_unwatch_anchor_depth(struct peer *peer,
enum state_input depthok,
enum state_input timeout);
/**
* peer_calculate_close_fee: figure out what the fee for closing is.
* @peer: the state data for this peer.
*/
void peer_calculate_close_fee(struct peer *peer);
/* Start creation of the bitcoin anchor tx. */
void bitcoin_create_anchor(struct peer *peer, enum state_input done);
/* We didn't end up broadcasting the anchor: release the utxos.
* If done != INPUT_NONE, remove existing create_anchor too. */
void bitcoin_release_anchor(struct peer *peer, enum state_input done);
/* Get the bitcoin anchor tx. */
const struct bitcoin_tx *bitcoin_anchor(struct peer *peer);
/* Create a bitcoin close tx. */
const struct bitcoin_tx *bitcoin_close(struct peer *peer);
/* Create a bitcoin spend tx (to spend our commit's outputs) */
const struct bitcoin_tx *bitcoin_spend_ours(struct peer *peer);
/* Create our commit tx */
const struct bitcoin_tx *bitcoin_commit(struct peer *peer);
/* We didn't end up broadcasting the anchor: release the utxos.
* If done != INPUT_NONE, remove existing create_anchor too. */
void bitcoin_release_anchor(struct peer *peer, enum state_input done);
#endif /* LIGHTNING_STATE_H */

Loading…
Cancel
Save