Browse Source

peer_control: remove unique_id field.

It's now completely useless.

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

1
lightningd/peer_control.c

@ -890,7 +890,6 @@ static void json_getpeers(struct command *cmd,
json_array_start(response, "peers");
list_for_each(&cmd->ld->peers, p, list) {
json_object_start(response, NULL);
json_add_u64(response, "unique_id", p->unique_id);
json_add_string(response, "state", peer_state_name(p->state));
json_add_string(response, "netaddr",
netaddr_name(response, &p->netaddr));

3
lightningd/peer_control.h

@ -23,9 +23,6 @@ struct peer {
/* Database ID of the peer */
u64 dbid;
/* Unique ID of connection (works even if we have multiple to same id) */
u64 unique_id;
/* ID of peer */
struct pubkey id;

1
wallet/db.c

@ -38,7 +38,6 @@ char *dbmigrations[] = {
PRIMARY KEY (shachain_id, pos));",
"CREATE TABLE channels ("
" id INTEGER," /* chan->id */
" unique_id INTEGER,"
" peer_id INTEGER REFERENCES peers(id) ON DELETE CASCADE,"
" short_channel_id BLOB,"
" channel_config_local INTEGER,"

7
wallet/wallet.c

@ -445,7 +445,6 @@ static bool wallet_stmt2channel(struct wallet *w, sqlite3_stmt *stmt,
chan->peer = talz(chan, struct peer);
}
chan->id = sqlite3_column_int64(stmt, col++);
chan->peer->unique_id = sqlite3_column_int64(stmt, col++);
chan->peer->dbid = sqlite3_column_int64(stmt, col++);
wallet_peer_load(w, chan->peer->dbid, chan->peer);
@ -549,7 +548,7 @@ static bool wallet_stmt2channel(struct wallet *w, sqlite3_stmt *stmt,
col += 2;
}
assert(col == 33);
assert(col == 32);
chan->peer->channel = chan;
@ -559,7 +558,7 @@ static bool wallet_stmt2channel(struct wallet *w, sqlite3_stmt *stmt,
/* List of fields to retrieve from the channels DB table, in the order
* that wallet_stmt2channel understands and will parse correctly */
const char *channel_fields =
"id, unique_id, peer_id, short_channel_id, channel_config_local, "
"id, peer_id, short_channel_id, channel_config_local, "
"channel_config_remote, state, funder, channel_flags, "
"minimum_depth, "
"next_index_local, next_index_remote, "
@ -723,7 +722,6 @@ bool wallet_channel_save(struct wallet *w, struct wallet_channel *chan){
/* Now do the real update */
ok &= db_exec(__func__, w->db, "UPDATE channels SET"
" unique_id=%"PRIu64","
" shachain_remote_id=%"PRIu64","
" short_channel_id=%s,"
" state=%d,"
@ -744,7 +742,6 @@ bool wallet_channel_save(struct wallet *w, struct wallet_channel *chan){
" channel_config_local=%"PRIu64","
" last_tx=%s, last_sig=%s"
" WHERE id=%"PRIu64,
p->unique_id,
p->their_shachain.id,
p->scid?tal_fmt(tmpctx,"'%s'", short_channel_id_to_str(tmpctx, p->scid)):"null",
p->state,

1
wallet/wallet_tests.c

@ -212,7 +212,6 @@ static bool test_channel_crud(const tal_t *ctx)
memset(&p.id, 'A', sizeof(p.id));
c1.peer = &p;
p.id = pk;
p.unique_id = 42;
p.our_msatoshi = NULL;
p.last_tx = NULL;
memset(&ci.their_config, 0, sizeof(struct channel_config));

Loading…
Cancel
Save