drk: move coin_blind to the correct position

This commit is contained in:
zero
2024-01-30 13:11:13 +01:00
parent 5876e97d20
commit 42a6b92ec6
2 changed files with 10 additions and 12 deletions

View File

@@ -367,32 +367,31 @@ impl Drk {
};
let is_spent = is_spent > 0;
// 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 coin_blind: pallas::Base = deserialize(coin_blind_bytes)?;
let Value::Blob(ref value_bytes) = row[3] else {
let Value::Blob(ref value_bytes) = row[2] else {
return Err(Error::ParseFailed("[get_coins] Value bytes parsing failed"))
};
let value: u64 = deserialize(value_bytes)?;
let Value::Blob(ref token_id_bytes) = row[4] else {
let Value::Blob(ref token_id_bytes) = row[3] else {
return Err(Error::ParseFailed("[get_coins] Token ID bytes parsing failed"))
};
let token_id: TokenId = deserialize(token_id_bytes)?;
let Value::Blob(ref spend_hook_bytes) = row[5] else {
let Value::Blob(ref spend_hook_bytes) = row[4] else {
return Err(Error::ParseFailed("[get_coins] Spend hook bytes parsing failed"))
};
let spend_hook: pallas::Base = deserialize(spend_hook_bytes)?;
let Value::Blob(ref user_data_bytes) = row[6] else {
let Value::Blob(ref user_data_bytes) = row[5] else {
return Err(Error::ParseFailed("[get_coins] User data bytes parsing failed"))
};
let user_data: pallas::Base = deserialize(user_data_bytes)?;
let Value::Blob(ref coin_blind_bytes) = row[6] else {
return Err(Error::ParseFailed("[get_coins] Coin blind bytes parsing failed"))
};
let coin_blind: pallas::Base = deserialize(coin_blind_bytes)?;
let Value::Blob(ref value_blind_bytes) = row[7] else {
return Err(Error::ParseFailed("[get_coins] Value blind bytes parsing failed"))
};

View File

@@ -24,12 +24,11 @@ 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,
-- 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,
user_data BLOB NOT NULL,
coin_blind BLOB NOT NULL,
value_blind BLOB NOT NULL,
token_blind BLOB NOT NULL,
secret BLOB NOT NULL,