fix: name of blinded_message col in blind_signature

This commit is contained in:
thesimplekid
2025-06-26 12:28:22 +01:00
parent a2b9a793a9
commit 34d8ab763b
4 changed files with 27 additions and 9 deletions

View File

@@ -20,4 +20,5 @@ pub static MIGRATIONS: &[(&str, &str)] = &[
("20250406091754_mint_time_of_quotes.sql", include_str!(r#"./migrations/20250406091754_mint_time_of_quotes.sql"#)),
("20250406093755_mint_created_time_signature.sql", include_str!(r#"./migrations/20250406093755_mint_created_time_signature.sql"#)),
("20250415093121_drop_keystore_foreign.sql", include_str!(r#"./migrations/20250415093121_drop_keystore_foreign.sql"#)),
("20250626120251_rename_blind_message_y_to_b.sql", include_str!(r#"./migrations/20250626120251_rename_blind_message_y_to_b.sql"#)),
];

View File

@@ -0,0 +1,2 @@
-- Rename column y to b
ALTER TABLE blind_signature RENAME COLUMN y TO blinded_message;

View File

@@ -968,12 +968,12 @@ impl MintSignaturesDatabase for MintSqliteDatabase {
query(
r#"
INSERT INTO blind_signature
(y, amount, keyset_id, c, quote_id, dleq_e, dleq_s, created_time)
(blinded_message, amount, keyset_id, c, quote_id, dleq_e, dleq_s, created_time)
VALUES
(:y, :amount, :keyset_id, :c, :quote_id, :dleq_e, :dleq_s, :created_time)
(:blinded_message, :amount, :keyset_id, :c, :quote_id, :dleq_e, :dleq_s, :created_time)
"#,
)
.bind(":y", message.to_bytes().to_vec())
.bind(":blinded_message", message.to_bytes().to_vec())
.bind(":amount", u64::from(signature.amount) as i64)
.bind(":keyset_id", signature.keyset_id.to_string())
.bind(":c", signature.c.to_bytes().to_vec())
@@ -988,8 +988,7 @@ impl MintSignaturesDatabase for MintSqliteDatabase {
)
.bind(":created_time", current_time as i64)
.execute(&transaction)
.await
.expect("fasdas");
.await?;
}
transaction.commit().await?;
@@ -1008,17 +1007,17 @@ impl MintSignaturesDatabase for MintSqliteDatabase {
c,
dleq_e,
dleq_s,
y
blinded_message
FROM
blind_signature
WHERE y IN (:y)
WHERE blinded_message IN (:blinded_message)
"#,
)
.bind_vec(
":y",
":blinded_message",
blinded_messages
.iter()
.map(|y| y.to_bytes().to_vec())
.map(|b_| b_.to_bytes().to_vec())
.collect(),
)
.fetch_all(&self.pool)