Browse Source

lightningd: remove num_revocations_received.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
1396cf6249
  1. 12
      lightningd/peer_control.c
  2. 1
      lightningd/peer_control.h
  3. 3
      lightningd/peer_htlcs.c
  4. 1
      wallet/db.c
  5. 8
      wallet/wallet.c

12
lightningd/peer_control.c

@ -601,8 +601,7 @@ void add_peer(struct lightningd *ld, u64 unique_id,
peer->remote_shutdown_scriptpubkey = NULL;
peer->local_shutdown_idx = -1;
peer->next_index[LOCAL]
= peer->next_index[REMOTE]
= peer->num_revocations_received = 0;
= peer->next_index[REMOTE] = 0;
peer->next_htlc_id = 0;
peer->htlcs = tal_arr(peer, struct htlc_stub, 0);
wallet_shachain_init(ld->wallet, &peer->their_shachain);
@ -1532,7 +1531,6 @@ static void peer_start_closingd(struct peer *peer,
num_revocations
= revocations_received(&peer->their_shachain.chain);
assert(num_revocations == peer->num_revocations_received);
/* BOLT #3:
*
@ -1724,14 +1722,6 @@ static bool peer_start_channeld(struct peer *peer,
shutdown_scriptpubkey = NULL;
num_revocations = revocations_received(&peer->their_shachain.chain);
log_debug(peer->log, "peer->num_revocations_received = %"PRIu64
" min_index = %"PRIu64
" revocations_received() = %"PRIu64,
peer->num_revocations_received,
num_revocations,
peer->their_shachain.chain.min_index);
assert(num_revocations == peer->num_revocations_received);
initmsg = towire_channel_init(tmpctx,
&peer->ld->chainparams->genesis_blockhash,

1
lightningd/peer_control.h

@ -65,7 +65,6 @@ struct peer {
/* Tracking commitment transaction numbers. */
u64 next_index[NUM_SIDES];
u64 num_revocations_received;
u64 next_htlc_id;
/* Funding txid and amounts (once known) */

3
lightningd/peer_htlcs.c

@ -1135,8 +1135,6 @@ int peer_got_revoke(struct peer *peer, const u8 *msg)
return -1;
}
assert(revocations_received(&peer->their_shachain.chain)
== peer->num_revocations_received);
if (revokenum != revocations_received(&peer->their_shachain.chain)) {
peer_internal_error(peer, "got_revoke: expected %"PRIu64
" got %"PRIu64,
@ -1163,7 +1161,6 @@ int peer_got_revoke(struct peer *peer, const u8 *msg)
/* FIXME: Check per_commitment_secret -> per_commit_point */
update_per_commit_point(peer, &next_per_commitment_point);
peer->num_revocations_received++;
/* FIXME: Commit shachain and next_per_commit_point to db */

1
wallet/db.c

@ -50,7 +50,6 @@ char *dbmigrations[] = {
" minimum_depth INTEGER,"
" next_index_local INTEGER,"
" next_index_remote INTEGER,"
" num_revocations_received INTEGER,"
" next_htlc_id INTEGER, "
" funding_tx_id BLOB,"
" funding_tx_outnum INTEGER,"

8
wallet/wallet.c

@ -463,8 +463,6 @@ static bool wallet_stmt2channel(struct wallet *w, sqlite3_stmt *stmt,
chan->peer->minimum_depth = sqlite3_column_int(stmt, col++);
chan->peer->next_index[LOCAL] = sqlite3_column_int64(stmt, col++);
chan->peer->next_index[REMOTE] = sqlite3_column_int64(stmt, col++);
chan->peer->num_revocations_received =
sqlite3_column_int64(stmt, col++);
chan->peer->next_htlc_id = sqlite3_column_int64(stmt, col++);
if (sqlite3_column_hexval(stmt, col++, &temphash, sizeof(temphash))) {
@ -548,7 +546,7 @@ static bool wallet_stmt2channel(struct wallet *w, sqlite3_stmt *stmt,
col += 2;
}
assert(col == 34);
assert(col == 33);
chan->peer->channel = chan;
@ -561,7 +559,7 @@ const char *channel_fields =
"id, unique_id, peer_id, short_channel_id, channel_config_local, "
"channel_config_remote, state, funder, channel_flags, "
"minimum_depth, "
"next_index_local, next_index_remote, num_revocations_received, "
"next_index_local, next_index_remote, "
"next_htlc_id, funding_tx_id, funding_tx_outnum, funding_satoshi, "
"funding_locked_remote, push_msatoshi, msatoshi_local, "
"fundingkey_remote, revocation_basepoint_remote, "
@ -731,7 +729,6 @@ bool wallet_channel_save(struct wallet *w, struct wallet_channel *chan){
" minimum_depth=%d,"
" next_index_local=%"PRIu64","
" next_index_remote=%"PRIu64","
" num_revocations_received=%"PRIu64","
" next_htlc_id=%"PRIu64","
" funding_tx_id=%s,"
" funding_tx_outnum=%d,"
@ -753,7 +750,6 @@ bool wallet_channel_save(struct wallet *w, struct wallet_channel *chan){
p->minimum_depth,
p->next_index[LOCAL],
p->next_index[REMOTE],
p->num_revocations_received,
p->next_htlc_id,
p->funding_txid?tal_fmt(tmpctx, "'%s'", tal_hexstr(tmpctx, p->funding_txid, sizeof(struct sha256_double))):"null",
p->funding_outnum,

Loading…
Cancel
Save