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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
use snarkvm_algorithms::{merkle_tree::*, traits::LoadableMerkleParameters};
use snarkvm_dpc::{Block, LedgerScheme, TransactionScheme};
use std::{marker::PhantomData, path::Path, sync::Arc};
pub struct EmptyLedger<T: TransactionScheme, P: LoadableMerkleParameters> {
parameters: Arc<P>,
_transaction: PhantomData<T>,
}
impl<T: TransactionScheme, P: LoadableMerkleParameters> LedgerScheme for EmptyLedger<T, P> {
type Block = Block<Self::Transaction>;
type Commitment = T::Commitment;
type MerkleParameters = P;
type MerklePath = MerklePath<Self::MerkleParameters>;
type MerkleTreeDigest = MerkleTreeDigest<Self::MerkleParameters>;
type SerialNumber = T::SerialNumber;
type Transaction = T;
fn new(
_path: Option<&Path>,
parameters: Arc<Self::MerkleParameters>,
_genesis_block: Self::Block,
) -> anyhow::Result<Self> {
Ok(Self {
parameters,
_transaction: PhantomData,
})
}
fn len(&self) -> usize {
0
}
fn parameters(&self) -> &Arc<Self::MerkleParameters> {
&self.parameters
}
fn digest(&self) -> Option<Self::MerkleTreeDigest> {
None
}
fn validate_digest(&self, _digest: &Self::MerkleTreeDigest) -> bool {
true
}
fn contains_cm(&self, _cm: &Self::Commitment) -> bool {
false
}
fn contains_sn(&self, _sn: &Self::SerialNumber) -> bool {
false
}
fn contains_memo(&self, _memo: &<Self::Transaction as TransactionScheme>::Memorandum) -> bool {
false
}
fn prove_cm(&self, _cm: &Self::Commitment) -> anyhow::Result<Self::MerklePath> {
unimplemented!()
}
fn verify_cm(
_parameters: &Arc<Self::MerkleParameters>,
_digest: &Self::MerkleTreeDigest,
_cm: &Self::Commitment,
_witness: &Self::MerklePath,
) -> bool {
true
}
}