Browse Source

Misc minor cleanups.

From doing a code walkthrough with Christian Decker; unnecessary const in
bitcoin/tx.c, an erroneous FIXME, a missing comment, and an unused struct.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 8 years ago
parent
commit
2a03af4486
  1. 7
      bitcoin/tx.c
  2. 1
      daemon/packets.c
  3. 1
      daemon/peer.c
  4. 6
      daemon/peer.h

7
bitcoin/tx.c

@ -516,7 +516,7 @@ struct bitcoin_tx *pull_bitcoin_tx(const tal_t *ctx,
struct bitcoin_tx *bitcoin_tx_from_hex(const tal_t *ctx, const char *hex,
size_t hexlen)
{
char *end;
const char *end;
u8 *linear_tx;
const u8 *p;
struct bitcoin_tx *tx;
@ -524,7 +524,7 @@ struct bitcoin_tx *bitcoin_tx_from_hex(const tal_t *ctx, const char *hex,
end = memchr(hex, '\n', hexlen);
if (!end)
end = cast_const(char *, hex) + hexlen;
end = hex + hexlen;
len = hex_data_size(end - hex);
p = linear_tx = tal_arr(ctx, u8, len);
@ -538,9 +538,6 @@ struct bitcoin_tx *bitcoin_tx_from_hex(const tal_t *ctx, const char *hex,
if (len)
goto fail_free_tx;
if (end != hex + hexlen && *end != '\n')
goto fail_free_tx;
tal_free(linear_tx);
return tx;

1
daemon/packets.c

@ -655,7 +655,6 @@ Pkt *accept_pkt_htlc_add(struct peer *peer, const Pkt *pkt)
stage.add.htlc = htlc;
add_unacked(&peer->local, &stage);
/* FIXME: Fees must be sufficient. */
return NULL;
}

1
daemon/peer.c

@ -642,6 +642,7 @@ static const struct bitcoin_tx *htlc_fulfill_tx(const struct peer *peer,
/* FIXME: Reason! */
static bool command_htlc_fail(struct peer *peer, struct htlc *htlc)
{
/* If onchain, nothing we can do. */
if (!state_can_remove_htlc(peer->state))
return false;

6
daemon/peer.h

@ -101,12 +101,6 @@ struct peer_visible_state {
struct htlc_map htlcs;
};
struct out_pkt {
Pkt *pkt;
void (*ack_cb)(struct peer *peer, void *arg);
void *ack_arg;
};
/* Off peer->outgoing_txs */
struct outgoing_tx {
struct list_node list;

Loading…
Cancel
Save