mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-02 18:35:00 +01:00
peer_control: remove unique_id field.
It's now completely useless. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
ffaa15c7da
commit
48cedef756
5 changed files with 2 additions and 11 deletions
|
@ -890,7 +890,6 @@ static void json_getpeers(struct command *cmd,
|
||||||
json_array_start(response, "peers");
|
json_array_start(response, "peers");
|
||||||
list_for_each(&cmd->ld->peers, p, list) {
|
list_for_each(&cmd->ld->peers, p, list) {
|
||||||
json_object_start(response, NULL);
|
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, "state", peer_state_name(p->state));
|
||||||
json_add_string(response, "netaddr",
|
json_add_string(response, "netaddr",
|
||||||
netaddr_name(response, &p->netaddr));
|
netaddr_name(response, &p->netaddr));
|
||||||
|
|
|
@ -23,9 +23,6 @@ struct peer {
|
||||||
/* Database ID of the peer */
|
/* Database ID of the peer */
|
||||||
u64 dbid;
|
u64 dbid;
|
||||||
|
|
||||||
/* Unique ID of connection (works even if we have multiple to same id) */
|
|
||||||
u64 unique_id;
|
|
||||||
|
|
||||||
/* ID of peer */
|
/* ID of peer */
|
||||||
struct pubkey id;
|
struct pubkey id;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ char *dbmigrations[] = {
|
||||||
PRIMARY KEY (shachain_id, pos));",
|
PRIMARY KEY (shachain_id, pos));",
|
||||||
"CREATE TABLE channels ("
|
"CREATE TABLE channels ("
|
||||||
" id INTEGER," /* chan->id */
|
" id INTEGER," /* chan->id */
|
||||||
" unique_id INTEGER,"
|
|
||||||
" peer_id INTEGER REFERENCES peers(id) ON DELETE CASCADE,"
|
" peer_id INTEGER REFERENCES peers(id) ON DELETE CASCADE,"
|
||||||
" short_channel_id BLOB,"
|
" short_channel_id BLOB,"
|
||||||
" channel_config_local INTEGER,"
|
" channel_config_local INTEGER,"
|
||||||
|
|
|
@ -445,7 +445,6 @@ static bool wallet_stmt2channel(struct wallet *w, sqlite3_stmt *stmt,
|
||||||
chan->peer = talz(chan, struct peer);
|
chan->peer = talz(chan, struct peer);
|
||||||
}
|
}
|
||||||
chan->id = sqlite3_column_int64(stmt, col++);
|
chan->id = sqlite3_column_int64(stmt, col++);
|
||||||
chan->peer->unique_id = sqlite3_column_int64(stmt, col++);
|
|
||||||
chan->peer->dbid = sqlite3_column_int64(stmt, col++);
|
chan->peer->dbid = sqlite3_column_int64(stmt, col++);
|
||||||
wallet_peer_load(w, chan->peer->dbid, chan->peer);
|
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;
|
col += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(col == 33);
|
assert(col == 32);
|
||||||
|
|
||||||
chan->peer->channel = chan;
|
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
|
/* List of fields to retrieve from the channels DB table, in the order
|
||||||
* that wallet_stmt2channel understands and will parse correctly */
|
* that wallet_stmt2channel understands and will parse correctly */
|
||||||
const char *channel_fields =
|
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, "
|
"channel_config_remote, state, funder, channel_flags, "
|
||||||
"minimum_depth, "
|
"minimum_depth, "
|
||||||
"next_index_local, next_index_remote, "
|
"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 */
|
/* Now do the real update */
|
||||||
ok &= db_exec(__func__, w->db, "UPDATE channels SET"
|
ok &= db_exec(__func__, w->db, "UPDATE channels SET"
|
||||||
" unique_id=%"PRIu64","
|
|
||||||
" shachain_remote_id=%"PRIu64","
|
" shachain_remote_id=%"PRIu64","
|
||||||
" short_channel_id=%s,"
|
" short_channel_id=%s,"
|
||||||
" state=%d,"
|
" state=%d,"
|
||||||
|
@ -744,7 +742,6 @@ bool wallet_channel_save(struct wallet *w, struct wallet_channel *chan){
|
||||||
" channel_config_local=%"PRIu64","
|
" channel_config_local=%"PRIu64","
|
||||||
" last_tx=%s, last_sig=%s"
|
" last_tx=%s, last_sig=%s"
|
||||||
" WHERE id=%"PRIu64,
|
" WHERE id=%"PRIu64,
|
||||||
p->unique_id,
|
|
||||||
p->their_shachain.id,
|
p->their_shachain.id,
|
||||||
p->scid?tal_fmt(tmpctx,"'%s'", short_channel_id_to_str(tmpctx, p->scid)):"null",
|
p->scid?tal_fmt(tmpctx,"'%s'", short_channel_id_to_str(tmpctx, p->scid)):"null",
|
||||||
p->state,
|
p->state,
|
||||||
|
|
|
@ -212,7 +212,6 @@ static bool test_channel_crud(const tal_t *ctx)
|
||||||
memset(&p.id, 'A', sizeof(p.id));
|
memset(&p.id, 'A', sizeof(p.id));
|
||||||
c1.peer = &p;
|
c1.peer = &p;
|
||||||
p.id = pk;
|
p.id = pk;
|
||||||
p.unique_id = 42;
|
|
||||||
p.our_msatoshi = NULL;
|
p.our_msatoshi = NULL;
|
||||||
p.last_tx = NULL;
|
p.last_tx = NULL;
|
||||||
memset(&ci.their_config, 0, sizeof(struct channel_config));
|
memset(&ci.their_config, 0, sizeof(struct channel_config));
|
||||||
|
|
Loading…
Add table
Reference in a new issue