-
Notifications
You must be signed in to change notification settings - Fork 37
/
mod.rs
41 lines (33 loc) · 946 Bytes
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use std::{collections::BTreeMap, sync::Arc};
use async_trait::async_trait;
use miden_objects::Digest;
use crate::{block::Block, SharedProvenTx};
#[derive(Debug, PartialEq)]
pub enum TxInputsError {
Dummy,
}
#[derive(Debug, PartialEq)]
pub enum ApplyBlockError {
Dummy,
}
#[async_trait]
pub trait ApplyBlock: Send + Sync + 'static {
async fn apply_block(
&self,
block: Arc<Block>,
) -> Result<(), ApplyBlockError>;
}
/// Information needed from the store to verify a transaction
pub struct TxInputs {
/// The account hash in the store corresponding to tx's account ID
pub account_hash: Option<Digest>,
/// Maps each consumed notes' nullifier to whether the note is already consumed
pub nullifiers: BTreeMap<Digest, bool>,
}
#[async_trait]
pub trait Store: ApplyBlock {
async fn get_tx_inputs(
&self,
proven_tx: SharedProvenTx,
) -> Result<TxInputs, TxInputsError>;
}