drk: update for changes to serial renamed to coin_blind

This commit is contained in:
zero
2024-01-30 12:22:07 +01:00
parent 0738b42b1c
commit 85cbf1f152
3 changed files with 10 additions and 8 deletions

View File

@@ -367,10 +367,11 @@ impl Drk {
};
let is_spent = is_spent > 0;
let Value::Blob(ref serial_bytes) = row[2] else {
return Err(Error::ParseFailed("[get_coins] Serial bytes parsing failed"))
// TODO: this is in the wrong position. It should be moved after user_data.
let Value::Blob(ref coin_blind_bytes) = row[2] else {
return Err(Error::ParseFailed("[get_coins] Coin blind bytes parsing failed"))
};
let serial: pallas::Base = deserialize(serial_bytes)?;
let coin_blind: pallas::Base = deserialize(coin_blind_bytes)?;
let Value::Blob(ref value_bytes) = row[3] else {
return Err(Error::ParseFailed("[get_coins] Value bytes parsing failed"))
@@ -422,11 +423,11 @@ impl Drk {
};
let note = MoneyNote {
serial,
value,
token_id,
spend_hook,
user_data,
coin_blind,
value_blind,
token_blind,
memo: memo.clone(),
@@ -655,7 +656,7 @@ impl Drk {
coin,
note: note.clone(),
secret: *secret,
nullifier: Nullifier::from(poseidon_hash([secret.inner(), note.serial])),
nullifier: Nullifier::from(poseidon_hash([secret.inner(), coin.inner()])),
leaf_position,
};
@@ -699,7 +700,7 @@ impl Drk {
let params = rusqlite::params![
serialize(&owncoin.coin),
0, // <-- is_spent
serialize(&owncoin.note.serial),
serialize(&owncoin.note.coin_blind),
serialize(&owncoin.note.value),
serialize(&owncoin.note.token_id),
serialize(&owncoin.note.spend_hook),

View File

@@ -361,7 +361,7 @@ impl Drk {
pub_y,
pallas::Base::from(note.value),
note.token_id.inner(),
note.serial,
note.coin_blind,
]));
if coin == params.outputs[output_idx].coin {

View File

@@ -24,7 +24,8 @@ CREATE TABLE IF NOT EXISTS money_keys (
CREATE TABLE IF NOT EXISTS money_coins (
coin BLOB PRIMARY KEY NOT NULL,
is_spent INTEGER NOT NULL,
serial BLOB NOT NULL,
-- TODO: move this after user_data
coin_blind BLOB NOT NULL,
value BLOB NOT NULL,
token_id BLOB NOT NULL,
spend_hook BLOB NOT NULL,