diff --git a/db/bindings.c b/db/bindings.c index df8b3827c..2f3546a2b 100644 --- a/db/bindings.c +++ b/db/bindings.c @@ -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) { diff --git a/db/bindings.h b/db/bindings.h index 298dc6d48..74febcf83 100644 --- a/db/bindings.h +++ b/db/bindings.h @@ -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, diff --git a/wallet/wallet.c b/wallet/wallet.c index 4e88bc5fe..9a457d09f 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -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);