mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 06:54:30 +01:00
Use node_id everywhere for nodes.
I tried to just do gossipd, but it was uncontainable, so this ended up being a complete sweep. We didn't get much space saving in gossipd, even though we should save 24 bytes per node. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
neil saitug
parent
b4455d517c
commit
a2fa699e0e
@@ -10,6 +10,7 @@ WALLET_TEST_COMMON_OBJS := \
|
||||
common/htlc_wire.o \
|
||||
common/type_to_string.o \
|
||||
common/memleak.o \
|
||||
common/node_id.o \
|
||||
common/key_derive.o \
|
||||
common/pseudorand.o \
|
||||
common/timeout.o \
|
||||
|
||||
@@ -22,9 +22,6 @@ static void db_log_(struct log *log UNUSED, enum log_level level UNUSED, const c
|
||||
struct json_escaped *json_escaped_string_(const tal_t *ctx UNNEEDED,
|
||||
const void *bytes UNNEEDED, size_t len UNNEEDED)
|
||||
{ fprintf(stderr, "json_escaped_string_ called!\n"); abort(); }
|
||||
/* Generated stub for node_id_valid */
|
||||
bool node_id_valid(const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "node_id_valid called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
static char *db_err;
|
||||
|
||||
@@ -70,7 +70,7 @@ struct command_result *command_success(struct command *cmd UNNEEDED,
|
||||
|
||||
{ fprintf(stderr, "command_success called!\n"); abort(); }
|
||||
/* Generated stub for connect_succeeded */
|
||||
void connect_succeeded(struct lightningd *ld UNNEEDED, const struct pubkey *id UNNEEDED)
|
||||
void connect_succeeded(struct lightningd *ld UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "connect_succeeded called!\n"); abort(); }
|
||||
/* Generated stub for delay_then_reconnect */
|
||||
void delay_then_reconnect(struct channel *channel UNNEEDED, u32 seconds_delay UNNEEDED,
|
||||
@@ -95,10 +95,10 @@ bool fromwire_channel_offer_htlc_reply(const tal_t *ctx UNNEEDED, const void *p
|
||||
bool fromwire_channel_sending_commitsig(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u64 *commitnum UNNEEDED, u32 *feerate UNNEEDED, struct changed_htlc **changed UNNEEDED, struct bitcoin_signature *commit_sig UNNEEDED, secp256k1_ecdsa_signature **htlc_sigs UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_sending_commitsig called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_connect_peer_connected */
|
||||
bool fromwire_connect_peer_connected(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct pubkey *id UNNEEDED, struct wireaddr_internal *addr UNNEEDED, struct crypto_state *crypto_state UNNEEDED, u8 **globalfeatures UNNEEDED, u8 **localfeatures UNNEEDED)
|
||||
bool fromwire_connect_peer_connected(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct node_id *id UNNEEDED, struct wireaddr_internal *addr UNNEEDED, struct crypto_state *crypto_state UNNEEDED, u8 **globalfeatures UNNEEDED, u8 **localfeatures UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_connect_peer_connected called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_gossip_get_channel_peer_reply */
|
||||
bool fromwire_gossip_get_channel_peer_reply(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct pubkey **peer_id UNNEEDED)
|
||||
bool fromwire_gossip_get_channel_peer_reply(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct node_id **peer_id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_gossip_get_channel_peer_reply called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_hsm_sign_commitment_tx_reply */
|
||||
bool fromwire_hsm_sign_commitment_tx_reply(const void *p UNNEEDED, struct bitcoin_signature *sig UNNEEDED)
|
||||
@@ -234,15 +234,15 @@ void json_add_log(struct json_stream *result UNNEEDED,
|
||||
void json_add_member(struct json_stream *js UNNEEDED, const char *fieldname UNNEEDED,
|
||||
const char *fmt UNNEEDED, ...)
|
||||
{ fprintf(stderr, "json_add_member called!\n"); abort(); }
|
||||
/* Generated stub for json_add_node_id */
|
||||
void json_add_node_id(struct json_stream *response UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_node_id called!\n"); abort(); }
|
||||
/* Generated stub for json_add_num */
|
||||
void json_add_num(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
unsigned int value UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_num called!\n"); abort(); }
|
||||
/* Generated stub for json_add_pubkey */
|
||||
void json_add_pubkey(struct json_stream *response UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
const struct pubkey *key UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for json_add_short_channel_id */
|
||||
void json_add_short_channel_id(struct json_stream *response UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
@@ -299,10 +299,10 @@ int json_tok_full_len(const jsmntok_t *t UNNEEDED)
|
||||
/* Generated stub for json_tok_streq */
|
||||
bool json_tok_streq(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, const char *str UNNEEDED)
|
||||
{ fprintf(stderr, "json_tok_streq called!\n"); abort(); }
|
||||
/* Generated stub for json_to_pubkey */
|
||||
bool json_to_pubkey(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
|
||||
struct pubkey *pubkey UNNEEDED)
|
||||
{ fprintf(stderr, "json_to_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for json_to_node_id */
|
||||
bool json_to_node_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
|
||||
struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "json_to_node_id called!\n"); abort(); }
|
||||
/* Generated stub for json_to_short_channel_id */
|
||||
bool json_to_short_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
|
||||
struct short_channel_id *scid UNNEEDED,
|
||||
@@ -319,15 +319,12 @@ void log_add(struct log *log UNNEEDED, const char *fmt UNNEEDED, ...)
|
||||
void log_io(struct log *log UNNEEDED, enum log_level dir UNNEEDED, const char *comment UNNEEDED,
|
||||
const void *data UNNEEDED, size_t len UNNEEDED)
|
||||
{ fprintf(stderr, "log_io called!\n"); abort(); }
|
||||
/* Generated stub for node_id_valid */
|
||||
bool node_id_valid(const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "node_id_valid called!\n"); abort(); }
|
||||
/* Generated stub for notify_connect */
|
||||
void notify_connect(struct lightningd *ld UNNEEDED, struct pubkey *nodeid UNNEEDED,
|
||||
void notify_connect(struct lightningd *ld UNNEEDED, struct node_id *nodeid UNNEEDED,
|
||||
struct wireaddr_internal *addr UNNEEDED)
|
||||
{ fprintf(stderr, "notify_connect called!\n"); abort(); }
|
||||
/* Generated stub for notify_disconnect */
|
||||
void notify_disconnect(struct lightningd *ld UNNEEDED, struct pubkey *nodeid UNNEEDED)
|
||||
void notify_disconnect(struct lightningd *ld UNNEEDED, struct node_id *nodeid UNNEEDED)
|
||||
{ fprintf(stderr, "notify_disconnect called!\n"); abort(); }
|
||||
/* Generated stub for null_response */
|
||||
struct json_stream *null_response(struct command *cmd UNNEEDED)
|
||||
@@ -379,16 +376,18 @@ struct command_result *param_msat(struct command *cmd UNNEEDED, const char *name
|
||||
const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
|
||||
struct amount_msat **msat UNNEEDED)
|
||||
{ fprintf(stderr, "param_msat called!\n"); abort(); }
|
||||
/* Generated stub for param_node_id */
|
||||
struct command_result *param_node_id(struct command *cmd UNNEEDED,
|
||||
const char *name UNNEEDED,
|
||||
const char *buffer UNNEEDED,
|
||||
const jsmntok_t *tok UNNEEDED,
|
||||
struct node_id **id UNNEEDED)
|
||||
{ fprintf(stderr, "param_node_id called!\n"); abort(); }
|
||||
/* Generated stub for param_number */
|
||||
struct command_result *param_number(struct command *cmd UNNEEDED, const char *name UNNEEDED,
|
||||
const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
|
||||
unsigned int **num UNNEEDED)
|
||||
{ fprintf(stderr, "param_number called!\n"); abort(); }
|
||||
/* Generated stub for param_pubkey */
|
||||
struct command_result *param_pubkey(struct command *cmd UNNEEDED, const char *name UNNEEDED,
|
||||
const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
|
||||
struct pubkey **pubkey UNNEEDED)
|
||||
{ fprintf(stderr, "param_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for param_short_channel_id */
|
||||
struct command_result *param_short_channel_id(struct command *cmd UNNEEDED,
|
||||
const char *name UNNEEDED,
|
||||
@@ -504,10 +503,10 @@ u8 *towire_channel_send_shutdown(const tal_t *ctx UNNEEDED)
|
||||
u8 *towire_channel_specific_feerates(const tal_t *ctx UNNEEDED, u32 feerate_base UNNEEDED, u32 feerate_ppm UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_specific_feerates called!\n"); abort(); }
|
||||
/* Generated stub for towire_connectctl_connect_to_peer */
|
||||
u8 *towire_connectctl_connect_to_peer(const tal_t *ctx UNNEEDED, const struct pubkey *id UNNEEDED, u32 seconds_waited UNNEEDED, const struct wireaddr_internal *addrhint UNNEEDED)
|
||||
u8 *towire_connectctl_connect_to_peer(const tal_t *ctx UNNEEDED, const struct node_id *id UNNEEDED, u32 seconds_waited UNNEEDED, const struct wireaddr_internal *addrhint UNNEEDED)
|
||||
{ fprintf(stderr, "towire_connectctl_connect_to_peer called!\n"); abort(); }
|
||||
/* Generated stub for towire_connectctl_peer_disconnected */
|
||||
u8 *towire_connectctl_peer_disconnected(const tal_t *ctx UNNEEDED, const struct pubkey *id UNNEEDED)
|
||||
u8 *towire_connectctl_peer_disconnected(const tal_t *ctx UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_connectctl_peer_disconnected called!\n"); abort(); }
|
||||
/* Generated stub for towire_errorfmt */
|
||||
u8 *towire_errorfmt(const tal_t *ctx UNNEEDED,
|
||||
@@ -518,7 +517,7 @@ u8 *towire_errorfmt(const tal_t *ctx UNNEEDED,
|
||||
u8 *towire_gossip_get_channel_peer(const tal_t *ctx UNNEEDED, const struct short_channel_id *channel_id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_gossip_get_channel_peer called!\n"); abort(); }
|
||||
/* Generated stub for towire_hsm_sign_commitment_tx */
|
||||
u8 *towire_hsm_sign_commitment_tx(const tal_t *ctx UNNEEDED, const struct pubkey *peer_id UNNEEDED, u64 channel_dbid UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, const struct pubkey *remote_funding_key UNNEEDED, struct amount_sat funding_amount UNNEEDED)
|
||||
u8 *towire_hsm_sign_commitment_tx(const tal_t *ctx UNNEEDED, const struct node_id *peer_id UNNEEDED, u64 channel_dbid UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, const struct pubkey *remote_funding_key UNNEEDED, struct amount_sat funding_amount UNNEEDED)
|
||||
{ fprintf(stderr, "towire_hsm_sign_commitment_tx called!\n"); abort(); }
|
||||
/* Generated stub for towire_onchain_dev_memleak */
|
||||
u8 *towire_onchain_dev_memleak(const tal_t *ctx UNNEEDED)
|
||||
@@ -555,7 +554,7 @@ bool dev_disconnect_permanent(struct lightningd *ld UNNEEDED)
|
||||
#endif
|
||||
|
||||
/* Fake stubs to talk to hsm */
|
||||
u8 *towire_hsm_get_channel_basepoints(const tal_t *ctx UNNEEDED, const struct pubkey *peerid UNNEEDED, u64 dbid UNNEEDED)
|
||||
u8 *towire_hsm_get_channel_basepoints(const tal_t *ctx UNNEEDED, const struct node_id *peerid UNNEEDED, u64 dbid UNNEEDED)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -698,6 +697,7 @@ static bool test_wallet_outputs(struct lightningd *ld, const tal_t *ctx)
|
||||
struct wallet *w = create_test_wallet(ld, ctx);
|
||||
struct utxo u;
|
||||
struct pubkey pk;
|
||||
struct node_id id;
|
||||
struct amount_sat fee_estimate, change_satoshis;
|
||||
const struct utxo **utxos;
|
||||
CHECK(w);
|
||||
@@ -705,6 +705,7 @@ static bool test_wallet_outputs(struct lightningd *ld, const tal_t *ctx)
|
||||
memset(&u, 0, sizeof(u));
|
||||
u.amount = AMOUNT_SAT(1);
|
||||
pubkey_from_der(tal_hexdata(w, "02a1633cafcc01ebfb6d78e39f687a1f0995c62fc95f51ead10a02ee0be551b5dc", 66), 33, &pk);
|
||||
node_id_from_pubkey(&id, &pk);
|
||||
|
||||
db_begin_transaction(w->db);
|
||||
|
||||
@@ -720,7 +721,7 @@ static bool test_wallet_outputs(struct lightningd *ld, const tal_t *ctx)
|
||||
memset(&u.txid, 1, sizeof(u.txid));
|
||||
u.close_info = tal(w, struct unilateral_close_info);
|
||||
u.close_info->channel_id = 42;
|
||||
u.close_info->peer_id = pk;
|
||||
u.close_info->peer_id = id;
|
||||
u.close_info->commitment_point = pk;
|
||||
CHECK_MSG(wallet_add_utxo(w, &u, p2sh_wpkh),
|
||||
"wallet_add_utxo with close_info");
|
||||
@@ -734,7 +735,7 @@ static bool test_wallet_outputs(struct lightningd *ld, const tal_t *ctx)
|
||||
u = *utxos[1];
|
||||
CHECK(u.close_info->channel_id == 42 &&
|
||||
pubkey_eq(&u.close_info->commitment_point, &pk) &&
|
||||
pubkey_eq(&u.close_info->peer_id, &pk));
|
||||
node_id_eq(&u.close_info->peer_id, &id));
|
||||
/* Now un-reserve them for the tests below */
|
||||
tal_free(utxos);
|
||||
|
||||
@@ -826,7 +827,7 @@ static bool channelseq(struct channel *c1, struct channel *c2)
|
||||
CHECK(c1->peer->dbid == c2->peer->dbid);
|
||||
CHECK(c1->peer == c2->peer);
|
||||
CHECK(c1->their_shachain.id == c2->their_shachain.id);
|
||||
CHECK_MSG(pubkey_eq(&p1->id, &p2->id), "NodeIDs do not match");
|
||||
CHECK_MSG(node_id_eq(&p1->id, &p2->id), "NodeIDs do not match");
|
||||
CHECK((c1->scid == NULL && c2->scid == NULL)
|
||||
|| short_channel_id_eq(c1->scid, c2->scid));
|
||||
CHECK(amount_msat_eq(c1->our_msat, c2->our_msat));
|
||||
@@ -900,6 +901,7 @@ static bool test_channel_crud(struct lightningd *ld, const tal_t *ctx)
|
||||
struct channel_info *ci = &c1.channel_info;
|
||||
struct bitcoin_txid *hash = tal(w, struct bitcoin_txid);
|
||||
struct pubkey pk;
|
||||
struct node_id id;
|
||||
struct changed_htlc *last_commit;
|
||||
secp256k1_ecdsa_signature *sig = tal(w, secp256k1_ecdsa_signature);
|
||||
u8 *scriptpubkey = tal_arr(ctx, u8, 100);
|
||||
@@ -912,13 +914,14 @@ static bool test_channel_crud(struct lightningd *ld, const tal_t *ctx)
|
||||
last_commit = tal_arr(w, struct changed_htlc, 2);
|
||||
mempat(last_commit, tal_bytelen(last_commit));
|
||||
pubkey_from_der(tal_hexdata(w, "02a1633cafcc01ebfb6d78e39f687a1f0995c62fc95f51ead10a02ee0be551b5dc", 66), 33, &pk);
|
||||
node_id_from_pubkey(&id, &pk);
|
||||
ci->feerate_per_kw[LOCAL] = ci->feerate_per_kw[REMOTE] = 31337;
|
||||
mempat(scriptpubkey, tal_count(scriptpubkey));
|
||||
c1.first_blocknum = 1;
|
||||
parse_wireaddr_internal("localhost:1234", &addr, 0, false, false, false,
|
||||
NULL);
|
||||
c1.final_key_idx = 1337;
|
||||
p = new_peer(ld, 0, &pk, &addr);
|
||||
p = new_peer(ld, 0, &id, &addr);
|
||||
c1.peer = p;
|
||||
c1.dbid = wallet_get_channel_dbid(w);
|
||||
c1.state = CHANNELD_NORMAL;
|
||||
@@ -1120,7 +1123,7 @@ static bool test_payment_crud(struct lightningd *ld, const tal_t *ctx)
|
||||
struct wallet *w = create_test_wallet(ld, ctx);
|
||||
|
||||
mempat(t, sizeof(*t));
|
||||
memset(&t->destination, 1, sizeof(t->destination));
|
||||
memset(&t->destination, 2, sizeof(t->destination));
|
||||
|
||||
t->id = 0;
|
||||
t->msatoshi = AMOUNT_MSAT(100);
|
||||
@@ -1135,7 +1138,7 @@ static bool test_payment_crud(struct lightningd *ld, const tal_t *ctx)
|
||||
t2 = wallet_payment_by_hash(ctx, w, &t->payment_hash);
|
||||
CHECK(t2 != NULL);
|
||||
CHECK(t2->status == t->status);
|
||||
CHECK(pubkey_cmp(&t2->destination, &t->destination) == 0);
|
||||
CHECK(node_id_cmp(&t2->destination, &t->destination) == 0);
|
||||
CHECK(amount_msat_eq(t2->msatoshi, t->msatoshi));
|
||||
CHECK(amount_msat_eq(t2->msatoshi_sent, t->msatoshi_sent));
|
||||
CHECK(!t2->payment_preimage);
|
||||
@@ -1148,7 +1151,7 @@ static bool test_payment_crud(struct lightningd *ld, const tal_t *ctx)
|
||||
t2 = wallet_payment_by_hash(ctx, w, &t->payment_hash);
|
||||
CHECK(t2 != NULL);
|
||||
CHECK(t2->status == t->status);
|
||||
CHECK(pubkey_cmp(&t2->destination, &t->destination) == 0);
|
||||
CHECK(node_id_eq(&t2->destination, &t->destination));
|
||||
CHECK(amount_msat_eq(t2->msatoshi, t->msatoshi));
|
||||
CHECK(amount_msat_eq(t2->msatoshi_sent, t->msatoshi_sent));
|
||||
CHECK(preimage_eq(t->payment_preimage, t2->payment_preimage));
|
||||
@@ -1180,7 +1183,7 @@ int main(void)
|
||||
|
||||
/* Only elements in ld we should access */
|
||||
list_head_init(&ld->peers);
|
||||
pubkey_from_der(tal_hexdata(tmpctx, "02a1633cafcc01ebfb6d78e39f687a1f0995c62fc95f51ead10a02ee0be551b5dc", 66), 33, &ld->id);
|
||||
node_id_from_hexstr("02a1633cafcc01ebfb6d78e39f687a1f0995c62fc95f51ead10a02ee0be551b5dc", 66, &ld->id);
|
||||
/* Accessed in peer destructor sanity check */
|
||||
htlc_in_map_init(&ld->htlcs_in);
|
||||
htlc_out_map_init(&ld->htlcs_out);
|
||||
|
||||
@@ -93,7 +93,7 @@ bool wallet_add_utxo(struct wallet *w, struct utxo *utxo,
|
||||
sqlite3_bind_int(stmt, 6, utxo->keyindex);
|
||||
if (utxo->close_info) {
|
||||
sqlite3_bind_int64(stmt, 7, utxo->close_info->channel_id);
|
||||
sqlite3_bind_pubkey(stmt, 8, &utxo->close_info->peer_id);
|
||||
sqlite3_bind_node_id(stmt, 8, &utxo->close_info->peer_id);
|
||||
sqlite3_bind_pubkey(stmt, 9, &utxo->close_info->commitment_point);
|
||||
} else {
|
||||
sqlite3_bind_null(stmt, 7);
|
||||
@@ -138,7 +138,7 @@ static struct utxo *wallet_stmt2output(const tal_t *ctx, sqlite3_stmt *stmt)
|
||||
if (sqlite3_column_type(stmt, 6) != SQLITE_NULL) {
|
||||
utxo->close_info = tal(utxo, struct unilateral_close_info);
|
||||
utxo->close_info->channel_id = sqlite3_column_int64(stmt, 6);
|
||||
sqlite3_column_pubkey(stmt, 7, &utxo->close_info->peer_id);
|
||||
sqlite3_column_node_id(stmt, 7, &utxo->close_info->peer_id);
|
||||
sqlite3_column_pubkey(stmt, 8, &utxo->close_info->commitment_point);
|
||||
} else {
|
||||
utxo->close_info = NULL;
|
||||
@@ -550,7 +550,7 @@ static struct peer *wallet_peer_load(struct wallet *w, const u64 dbid)
|
||||
{
|
||||
const unsigned char *addrstr;
|
||||
struct peer *peer;
|
||||
struct pubkey id;
|
||||
struct node_id id;
|
||||
struct wireaddr_internal addr;
|
||||
|
||||
sqlite3_stmt *stmt =
|
||||
@@ -560,7 +560,7 @@ static struct peer *wallet_peer_load(struct wallet *w, const u64 dbid)
|
||||
if (!db_select_step(w->db, stmt))
|
||||
return NULL;
|
||||
|
||||
if (!sqlite3_column_pubkey(stmt, 1, &id)) {
|
||||
if (!sqlite3_column_node_id(stmt, 1, &id)) {
|
||||
db_stmt_done(stmt);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1087,7 +1087,7 @@ void wallet_channel_insert(struct wallet *w, struct channel *chan)
|
||||
if (chan->peer->dbid == 0) {
|
||||
/* Need to create the peer first */
|
||||
stmt = db_prepare(w->db, "INSERT INTO peers (node_id, address) VALUES (?, ?);");
|
||||
sqlite3_bind_pubkey(stmt, 1, &chan->peer->id);
|
||||
sqlite3_bind_node_id(stmt, 1, &chan->peer->id);
|
||||
sqlite3_bind_text(stmt, 2,
|
||||
type_to_string(tmpctx, struct wireaddr_internal, &chan->peer->addr),
|
||||
-1, SQLITE_TRANSIENT);
|
||||
@@ -1469,7 +1469,7 @@ static void fixup_hin(struct wallet *wallet, struct htlc_in *hin)
|
||||
" subsituting temporary node failure",
|
||||
hin->key.id, htlc_state_name(hin->hstate),
|
||||
type_to_string(tmpctx, struct amount_msat, &hin->msat),
|
||||
type_to_string(tmpctx, struct pubkey,
|
||||
type_to_string(tmpctx, struct node_id,
|
||||
&hin->key.channel->peer->id));
|
||||
#endif
|
||||
}
|
||||
@@ -1721,13 +1721,13 @@ void wallet_payment_store(struct wallet *wallet,
|
||||
|
||||
sqlite3_bind_int(stmt, 1, payment->status);
|
||||
sqlite3_bind_sha256(stmt, 2, &payment->payment_hash);
|
||||
sqlite3_bind_pubkey(stmt, 3, &payment->destination);
|
||||
sqlite3_bind_node_id(stmt, 3, &payment->destination);
|
||||
sqlite3_bind_amount_msat(stmt, 4, payment->msatoshi);
|
||||
sqlite3_bind_int(stmt, 5, payment->timestamp);
|
||||
sqlite3_bind_blob(stmt, 6, payment->path_secrets,
|
||||
tal_bytelen(payment->path_secrets),
|
||||
SQLITE_TRANSIENT);
|
||||
sqlite3_bind_pubkey_array(stmt, 7, payment->route_nodes);
|
||||
sqlite3_bind_node_id_array(stmt, 7, payment->route_nodes);
|
||||
sqlite3_bind_short_channel_id_array(stmt, 8,
|
||||
payment->route_channels);
|
||||
sqlite3_bind_amount_msat(stmt, 9, payment->msatoshi_sent);
|
||||
@@ -1779,7 +1779,7 @@ static struct wallet_payment *wallet_stmt2payment(const tal_t *ctx,
|
||||
payment->id = sqlite3_column_int64(stmt, 0);
|
||||
payment->status = sqlite3_column_int(stmt, 1);
|
||||
|
||||
sqlite3_column_pubkey(stmt, 2, &payment->destination);
|
||||
sqlite3_column_node_id(stmt, 2, &payment->destination);
|
||||
payment->msatoshi = sqlite3_column_amount_msat(stmt, 3);
|
||||
sqlite3_column_sha256(stmt, 4, &payment->payment_hash);
|
||||
|
||||
@@ -1793,7 +1793,7 @@ static struct wallet_payment *wallet_stmt2payment(const tal_t *ctx,
|
||||
/* Can be NULL for old db! */
|
||||
payment->path_secrets = sqlite3_column_secrets(payment, stmt, 7);
|
||||
|
||||
payment->route_nodes = sqlite3_column_pubkey_array(payment, stmt, 8);
|
||||
payment->route_nodes = sqlite3_column_node_id_array(payment, stmt, 8);
|
||||
payment->route_channels
|
||||
= sqlite3_column_short_channel_id_array(payment, stmt, 9);
|
||||
|
||||
@@ -1896,7 +1896,7 @@ void wallet_payment_get_failinfo(const tal_t *ctx,
|
||||
bool *faildestperm,
|
||||
int *failindex,
|
||||
enum onion_type *failcode,
|
||||
struct pubkey **failnode,
|
||||
struct node_id **failnode,
|
||||
struct short_channel_id **failchannel,
|
||||
u8 **failupdate,
|
||||
char **faildetail,
|
||||
@@ -1929,8 +1929,8 @@ void wallet_payment_get_failinfo(const tal_t *ctx,
|
||||
if (sqlite3_column_type(stmt, 4) == SQLITE_NULL)
|
||||
*failnode = NULL;
|
||||
else {
|
||||
*failnode = tal(ctx, struct pubkey);
|
||||
resb = sqlite3_column_pubkey(stmt, 4, *failnode);
|
||||
*failnode = tal(ctx, struct node_id);
|
||||
resb = sqlite3_column_node_id(stmt, 4, *failnode);
|
||||
assert(resb);
|
||||
}
|
||||
if (sqlite3_column_type(stmt, 5) == SQLITE_NULL)
|
||||
@@ -1962,7 +1962,7 @@ void wallet_payment_set_failinfo(struct wallet *wallet,
|
||||
bool faildestperm,
|
||||
int failindex,
|
||||
enum onion_type failcode,
|
||||
const struct pubkey *failnode,
|
||||
const struct node_id *failnode,
|
||||
const struct short_channel_id *failchannel,
|
||||
const u8 *failupdate /*tal_arr*/,
|
||||
const char *faildetail,
|
||||
@@ -1992,7 +1992,7 @@ void wallet_payment_set_failinfo(struct wallet *wallet,
|
||||
sqlite3_bind_int(stmt, 3, failindex);
|
||||
sqlite3_bind_int(stmt, 4, (int) failcode);
|
||||
if (failnode)
|
||||
sqlite3_bind_pubkey(stmt, 5, failnode);
|
||||
sqlite3_bind_node_id(stmt, 5, failnode);
|
||||
else
|
||||
sqlite3_bind_null(stmt, 5);
|
||||
if (failchannel) {
|
||||
|
||||
@@ -23,9 +23,9 @@ struct amount_msat;
|
||||
struct invoices;
|
||||
struct channel;
|
||||
struct lightningd;
|
||||
struct node_id;
|
||||
struct oneshot;
|
||||
struct peer;
|
||||
struct pubkey;
|
||||
struct timers;
|
||||
|
||||
struct wallet {
|
||||
@@ -215,14 +215,14 @@ struct wallet_payment {
|
||||
u32 timestamp;
|
||||
struct sha256 payment_hash;
|
||||
enum wallet_payment_status status;
|
||||
struct pubkey destination;
|
||||
struct node_id destination;
|
||||
struct amount_msat msatoshi;
|
||||
struct amount_msat msatoshi_sent;
|
||||
/* If and only if PAYMENT_COMPLETE */
|
||||
struct preimage *payment_preimage;
|
||||
/* Needed for recovering from routing failures. */
|
||||
struct secret *path_secrets;
|
||||
struct pubkey *route_nodes;
|
||||
struct node_id *route_nodes;
|
||||
struct short_channel_id *route_channels;
|
||||
/* bolt11 string; NULL for old payments. */
|
||||
const char *bolt11;
|
||||
@@ -900,7 +900,7 @@ void wallet_payment_get_failinfo(const tal_t *ctx,
|
||||
bool *faildestperm,
|
||||
int *failindex,
|
||||
enum onion_type *failcode,
|
||||
struct pubkey **failnode,
|
||||
struct node_id **failnode,
|
||||
struct short_channel_id **failchannel,
|
||||
u8 **failupdate,
|
||||
char **faildetail,
|
||||
@@ -915,7 +915,7 @@ void wallet_payment_set_failinfo(struct wallet *wallet,
|
||||
bool faildestperm,
|
||||
int failindex,
|
||||
enum onion_type failcode,
|
||||
const struct pubkey *failnode,
|
||||
const struct node_id *failnode,
|
||||
const struct short_channel_id *failchannel,
|
||||
const u8 *failupdate,
|
||||
const char *faildetail,
|
||||
|
||||
@@ -500,7 +500,7 @@ static struct command_result *json_listfunds(struct command *cmd,
|
||||
struct channel *c;
|
||||
list_for_each(&p->channels, c, list) {
|
||||
json_object_start(response, NULL);
|
||||
json_add_pubkey(response, "peer_id", &p->id);
|
||||
json_add_node_id(response, "peer_id", &p->id);
|
||||
if (c->scid)
|
||||
json_add_short_channel_id(response,
|
||||
"short_channel_id",
|
||||
|
||||
Reference in New Issue
Block a user