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 100 101 102 103 104 105
// Copyright (C) 2019-2023 Aleo Systems Inc.
// This file is part of the snarkVM library.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use super::*;
impl<N: Network, C: ConsensusStorage<N>> Ledger<N, C> {
/// Returns `true` if the given state root exists.
pub fn contains_state_root(&self, state_root: &N::StateRoot) -> Result<bool> {
self.vm.block_store().contains_state_root(state_root)
}
/// Returns `true` if the given block height exists.
pub fn contains_block_height(&self, height: u32) -> Result<bool> {
self.vm.block_store().contains_block_height(height)
}
/// Returns `true` if the given block hash exists.
pub fn contains_block_hash(&self, block_hash: &N::BlockHash) -> Result<bool> {
self.vm.block_store().contains_block_hash(block_hash)
}
/// Returns `true` if the given puzzle commitment exists.
pub fn contains_puzzle_commitment(&self, puzzle_commitment: &PuzzleCommitment<N>) -> Result<bool> {
self.vm.block_store().contains_puzzle_commitment(puzzle_commitment)
}
/// Returns `true` if the given program ID exists.
pub fn contains_program_id(&self, program_id: &ProgramID<N>) -> Result<bool> {
self.vm.transaction_store().contains_program_id(program_id)
}
/// Returns `true` if the given transaction ID exists.
pub fn contains_transaction_id(&self, transaction_id: &N::TransactionID) -> Result<bool> {
self.vm.transaction_store().contains_transaction_id(transaction_id)
}
/* Transition */
/// Returns `true` if the given transition ID exists.
pub fn contains_transition_id(&self, transition_id: &N::TransitionID) -> Result<bool> {
self.vm.transition_store().contains_transition_id(transition_id)
}
/* Input */
/// Returns `true` if the given input ID exists.
pub fn contains_input_id(&self, input_id: &Field<N>) -> Result<bool> {
self.vm.transition_store().contains_input_id(input_id)
}
/// Returns `true` if the given serial number exists.
pub fn contains_serial_number(&self, serial_number: &Field<N>) -> Result<bool> {
self.vm.transition_store().contains_serial_number(serial_number)
}
/// Returns `true` if the given tag exists.
pub fn contains_tag(&self, tag: &Field<N>) -> Result<bool> {
self.vm.transition_store().contains_tag(tag)
}
/* Output */
/// Returns `true` if the given output ID exists.
pub fn contains_output_id(&self, output_id: &Field<N>) -> Result<bool> {
self.vm.transition_store().contains_output_id(output_id)
}
/// Returns `true` if the given commitment exists.
pub fn contains_commitment(&self, commitment: &Field<N>) -> Result<bool> {
self.vm.transition_store().contains_commitment(commitment)
}
/// Returns `true` if the given checksum exists.
pub fn contains_checksum(&self, checksum: &Field<N>) -> bool {
self.vm.transition_store().contains_checksum(checksum)
}
/// Returns `true` if the given nonce exists.
pub fn contains_nonce(&self, nonce: &Group<N>) -> Result<bool> {
self.vm.transition_store().contains_nonce(nonce)
}
/* Metadata */
/// Returns `true` if the given transition public key exists.
pub fn contains_tpk(&self, tpk: &Group<N>) -> Result<bool> {
self.vm.transition_store().contains_tpk(tpk)
}
/// Returns `true` if the given transition commitment exists.
pub fn contains_tcm(&self, tcm: &Field<N>) -> Result<bool> {
self.vm.transition_store().contains_tcm(tcm)
}
}