mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
db/bindings: rename db_bind_short_channel_id to db_bind_short_channel_id_str, add db_bind_scid.
Although it's deprecated already (because it stores as string), it's better to make the name explicit. And create a new helper which stores as BIGINT. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
63457229cb
commit
33a6b18891
3 changed files with 24 additions and 6 deletions
|
@ -159,13 +159,19 @@ void db_bind_pubkey(struct db_stmt *stmt, int pos, const struct pubkey *pk)
|
|||
db_bind_blob(stmt, pos, der, PUBKEY_CMPR_LEN);
|
||||
}
|
||||
|
||||
void db_bind_short_channel_id(struct db_stmt *stmt, int col,
|
||||
const struct short_channel_id *id)
|
||||
void db_bind_short_channel_id_str(struct db_stmt *stmt, int col,
|
||||
const struct short_channel_id *id)
|
||||
{
|
||||
char *ser = short_channel_id_to_str(stmt, id);
|
||||
db_bind_text(stmt, col, ser);
|
||||
}
|
||||
|
||||
void db_bind_scid(struct db_stmt *stmt, int col,
|
||||
const struct short_channel_id *id)
|
||||
{
|
||||
db_bind_u64(stmt, col, id->u64);
|
||||
}
|
||||
|
||||
void db_bind_short_channel_id_arr(struct db_stmt *stmt, int col,
|
||||
const struct short_channel_id *id)
|
||||
{
|
||||
|
@ -373,6 +379,12 @@ bool db_col_short_channel_id_str(struct db_stmt *stmt, const char *colname,
|
|||
return short_channel_id_from_str(source, sourcelen, dest);
|
||||
}
|
||||
|
||||
void db_col_scid(struct db_stmt *stmt, const char *colname,
|
||||
struct short_channel_id *dest)
|
||||
{
|
||||
dest->u64 = db_col_u64(stmt, colname);
|
||||
}
|
||||
|
||||
struct short_channel_id *
|
||||
db_col_short_channel_id_arr(const tal_t *ctx, struct db_stmt *stmt, const char *colname)
|
||||
{
|
||||
|
|
|
@ -37,8 +37,11 @@ void db_bind_node_id(struct db_stmt *stmt, int pos, const struct node_id *ni);
|
|||
void db_bind_node_id_arr(struct db_stmt *stmt, int col,
|
||||
const struct node_id *ids);
|
||||
void db_bind_pubkey(struct db_stmt *stmt, int pos, const struct pubkey *p);
|
||||
void db_bind_short_channel_id(struct db_stmt *stmt, int col,
|
||||
const struct short_channel_id *id);
|
||||
/* DO NOT USE, deprecated! */
|
||||
void db_bind_short_channel_id_str(struct db_stmt *stmt, int col,
|
||||
const struct short_channel_id *id);
|
||||
void db_bind_scid(struct db_stmt *stmt, int col,
|
||||
const struct short_channel_id *id);
|
||||
void db_bind_short_channel_id_arr(struct db_stmt *stmt, int col,
|
||||
const struct short_channel_id *id);
|
||||
void db_bind_signature(struct db_stmt *stmt, int col,
|
||||
|
@ -83,8 +86,11 @@ struct node_id *db_col_node_id_arr(const tal_t *ctx, struct db_stmt *stmt,
|
|||
const char *colname);
|
||||
void db_col_pubkey(struct db_stmt *stmt, const char *colname,
|
||||
struct pubkey *p);
|
||||
/* DO NOT USE: deprecated */
|
||||
bool db_col_short_channel_id_str(struct db_stmt *stmt, const char *colname,
|
||||
struct short_channel_id *dest);
|
||||
void db_col_scid(struct db_stmt *stmt, const char *colname,
|
||||
struct short_channel_id *dest);
|
||||
struct short_channel_id *
|
||||
db_col_short_channel_id_arr(const tal_t *ctx, struct db_stmt *stmt, const char *colname);
|
||||
bool db_col_signature(struct db_stmt *stmt, const char *colname,
|
||||
|
|
|
@ -1903,7 +1903,7 @@ void wallet_channel_save(struct wallet *w, struct channel *chan)
|
|||
" WHERE id=?")); // 46
|
||||
db_bind_u64(stmt, 0, chan->their_shachain.id);
|
||||
if (chan->scid)
|
||||
db_bind_short_channel_id(stmt, 1, chan->scid);
|
||||
db_bind_short_channel_id_str(stmt, 1, chan->scid);
|
||||
else
|
||||
db_bind_null(stmt, 1);
|
||||
|
||||
|
@ -3495,7 +3495,7 @@ void wallet_payment_set_failinfo(struct wallet *wallet,
|
|||
db_bind_null(stmt, 4);
|
||||
|
||||
if (failchannel) {
|
||||
db_bind_short_channel_id(stmt, 5, failchannel);
|
||||
db_bind_short_channel_id_str(stmt, 5, failchannel);
|
||||
db_bind_int(stmt, 8, faildirection);
|
||||
} else {
|
||||
db_bind_null(stmt, 5);
|
||||
|
|
Loading…
Add table
Reference in a new issue