Skip to content

Commit

Permalink
Fix submitted typo
Browse files Browse the repository at this point in the history
  • Loading branch information
tomyrd committed Jun 10, 2024
1 parent 0481715 commit 8f304f8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
16 changes: 8 additions & 8 deletions src/store/note_record/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub enum NoteStatus {
/// Note has been consumed locally but not yet nullified on chain
Processing {
consumer_account_id: AccountId,
submited_at: u64,
submitted_at: u64,
},
/// Note has been nullified on chain
Consumed {
Expand All @@ -83,9 +83,9 @@ impl Serializable for NoteStatus {
target.write_u8(1);
target.write_u64(*block_height);
},
NoteStatus::Processing { consumer_account_id, submited_at } => {
NoteStatus::Processing { consumer_account_id, submitted_at } => {
target.write_u8(2);
target.write_u64(*submited_at);
target.write_u64(*submitted_at);
consumer_account_id.write_into(target);
},
NoteStatus::Consumed { consumer_account_id, block_height } => {
Expand All @@ -110,9 +110,9 @@ impl Deserializable for NoteStatus {
Ok(NoteStatus::Committed { block_height })
},
2 => {
let submited_at = source.read_u64()?;
let submitted_at = source.read_u64()?;
let consumer_account_id = AccountId::read_from(source)?;
Ok(NoteStatus::Processing { consumer_account_id, submited_at })
Ok(NoteStatus::Processing { consumer_account_id, submitted_at })
},
3 => {
let block_height = source.read_u64()?;
Expand All @@ -138,11 +138,11 @@ impl Display for NoteStatus {
NoteStatus::Committed { block_height } => {
write!(f, "{NOTE_STATUS_COMMITTED} (at block height {block_height})")
},
NoteStatus::Processing { consumer_account_id, submited_at } => write!(
NoteStatus::Processing { consumer_account_id, submitted_at } => write!(
f,
"{NOTE_STATUS_PROCESSING} (submited at {} by account {})",
"{NOTE_STATUS_PROCESSING} (submitted at {} by account {})",
Local
.timestamp_opt(*submited_at as i64, 0)
.timestamp_opt(*submitted_at as i64, 0)
.single()
.expect("timestamp should be valid"),
consumer_account_id.to_hex()
Expand Down
38 changes: 19 additions & 19 deletions src/store/sqlite_store/notes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::{
fn insert_note_query(table_name: NoteTable) -> String {
format!("\
INSERT INTO {table_name}
(note_id, assets, recipient, status, metadata, details, inclusion_proof, consumer_transaction_id, created_at)
(note_id, assets, recipient, status, metadata, details, inclusion_proof, consumer_transaction_id, created_at)
VALUES (:note_id, :assets, :recipient, :status, json(:metadata), json(:details), json(:inclusion_proof), :consumer_transaction_id, unixepoch(current_timestamp));",
table_name = table_name)
}
Expand Down Expand Up @@ -108,21 +108,21 @@ impl<'a> NoteFilter<'a> {
/// Returns a [String] containing the query for this Filter
fn to_query(&self, notes_table: NoteTable) -> String {
let base = format!(
"SELECT
note.assets,
note.details,
"SELECT
note.assets,
note.details,
note.recipient,
note.status,
note.metadata,
note.inclusion_proof,
script.serialized_note_script,
tx.account_id,
note.created_at,
note.submited_at,
note.submitted_at,
note.nullifier_height
from {notes_table} AS note
from {notes_table} AS note
LEFT OUTER JOIN notes_scripts AS script
ON note.details IS NOT NULL AND
ON note.details IS NOT NULL AND
json_extract(note.details, '$.script_hash') = script.script_hash
LEFT OUTER JOIN transactions AS tx
ON note.consumer_transaction_id IS NOT NULL AND
Expand Down Expand Up @@ -346,26 +346,26 @@ pub fn update_note_consumer_tx_id(
note_id: NoteId,
consumer_tx_id: TransactionId,
) -> Result<(), StoreError> {
const UPDATE_INPUT_NOTES_QUERY: &str = "UPDATE input_notes SET consumer_transaction_id = :consumer_transaction_id, submited_at = :submited_at WHERE note_id = :note_id;";
const UPDATE_INPUT_NOTES_QUERY: &str = "UPDATE input_notes SET consumer_transaction_id = :consumer_transaction_id, submitted_at = :submitted_at WHERE note_id = :note_id;";

tx.execute(
UPDATE_INPUT_NOTES_QUERY,
named_params! {
":note_id": note_id.inner().to_string(),
":consumer_transaction_id": consumer_tx_id.to_string(),
":submited_at": Utc::now().timestamp(),
":submitted_at": Utc::now().timestamp(),
},
)
.map_err(|err| StoreError::QueryError(err.to_string()))?;

const UPDATE_OUTPUT_NOTES_QUERY: &str = "UPDATE output_notes SET consumer_transaction_id = :consumer_transaction_id, submited_at = :submited_at WHERE note_id = :note_id;";
const UPDATE_OUTPUT_NOTES_QUERY: &str = "UPDATE output_notes SET consumer_transaction_id = :consumer_transaction_id, submitted_at = :submitted_at WHERE note_id = :note_id;";

tx.execute(
UPDATE_OUTPUT_NOTES_QUERY,
named_params! {
":note_id": note_id.inner().to_string(),
":consumer_transaction_id": consumer_tx_id.to_string(),
":submited_at": Utc::now().timestamp(),
":submitted_at": Utc::now().timestamp(),
},
)
.map_err(|err| StoreError::QueryError(err.to_string()))?;
Expand All @@ -386,7 +386,7 @@ fn parse_input_note_columns(
let serialized_note_script: Vec<u8> = row.get(6)?;
let consumer_account_id: Option<i64> = row.get(7)?;
let created_at: u64 = row.get(8)?;
let submited_at: Option<u64> = row.get(9)?;
let submitted_at: Option<u64> = row.get(9)?;
let nullifier_height: Option<u64> = row.get(10)?;

Ok((
Expand All @@ -399,7 +399,7 @@ fn parse_input_note_columns(
serialized_note_script,
consumer_account_id,
created_at,
submited_at,
submitted_at,
nullifier_height,
))
}
Expand All @@ -418,7 +418,7 @@ fn parse_input_note(
serialized_note_script,
consumer_account_id,
created_at,
submited_at,
submitted_at,
nullifier_height,
) = serialized_input_note_parts;

Expand Down Expand Up @@ -469,7 +469,7 @@ fn parse_input_note(
if let Some(consumer_account_id) = consumer_account_id {
NoteStatus::Processing {
consumer_account_id,
submited_at: submited_at.unwrap_or(0),
submitted_at: submitted_at.unwrap_or(0),
}
} else {
NoteStatus::Committed {
Expand Down Expand Up @@ -573,7 +573,7 @@ fn parse_output_note_columns(
let serialized_note_script: Option<Vec<u8>> = row.get(6)?;
let consumer_account_id: Option<i64> = row.get(7)?;
let created_at: u64 = row.get(8)?;
let submited_at: Option<u64> = row.get(9)?;
let submitted_at: Option<u64> = row.get(9)?;
let nullifier_height: Option<u64> = row.get(10)?;

Ok((
Expand All @@ -586,7 +586,7 @@ fn parse_output_note_columns(
serialized_note_script,
consumer_account_id,
created_at,
submited_at,
submitted_at,
nullifier_height,
))
}
Expand All @@ -605,7 +605,7 @@ fn parse_output_note(
serialized_note_script,
consumer_account_id,
created_at,
submited_at,
submitted_at,
nullifier_height,
) = serialized_output_note_parts;

Expand Down Expand Up @@ -659,7 +659,7 @@ fn parse_output_note(
if let Some(consumer_account_id) = consumer_account_id {
NoteStatus::Processing {
consumer_account_id,
submited_at: submited_at.unwrap_or(0),
submitted_at: submitted_at.unwrap_or(0),
}
} else {
NoteStatus::Committed {
Expand Down
4 changes: 2 additions & 2 deletions src/store/sqlite_store/store.sql
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ CREATE TABLE input_notes (
-- serial_num -- the note serial number
consumer_transaction_id BLOB NULL, -- the transaction ID of the transaction that consumed the note
created_at UNSIGNED BIG INT NOT NULL, -- timestamp of the note creation/import
submited_at UNSIGNED BIG INT NULL, -- timestamp of the note submission to node
submitted_at UNSIGNED BIG INT NULL, -- timestamp of the note submission to node
nullifier_height UNSIGNED BIG INT NULL, -- block height when the nullifier arrived
FOREIGN KEY (consumer_transaction_id) REFERENCES transactions(id)
PRIMARY KEY (note_id)
Expand Down Expand Up @@ -140,7 +140,7 @@ CREATE TABLE output_notes (
-- serial_num -- the note serial number
consumer_transaction_id BLOB NULL, -- the transaction ID of the transaction that consumed the note
created_at UNSIGNED BIG INT NOT NULL, -- timestamp of the note creation/import
submited_at UNSIGNED BIG INT NULL, -- timestamp of the note submission to node
submitted_at UNSIGNED BIG INT NULL, -- timestamp of the note submission to node
nullifier_height UNSIGNED BIG INT NULL, -- block height when the nullifier arrived
FOREIGN KEY (consumer_transaction_id) REFERENCES transactions(id)
PRIMARY KEY (note_id)
Expand Down

0 comments on commit 8f304f8

Please sign in to comment.