-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow transactions with "mixed" token types
these are introduced at block version 3 the token type of every pseudo output and real output must be listed in `pseudo_output_token_ids` and `output_token_ids` in the `SignatureRctBulletproofs` object
- Loading branch information
Showing
14 changed files
with
452 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//! A simple generator cache | ||
use super::{generators, PedersenGens}; | ||
use crate::TokenId; | ||
use alloc::collections::BTreeMap; | ||
|
||
/// GeneratorCache is a simple object which caches computations of | ||
/// generator: TokenId -> RistrettoPoint | ||
/// | ||
/// This is intended just to be used in the scope of a single transaction, | ||
/// and we therefore don't require it to be constant-time. | ||
#[derive(Default, Clone)] | ||
pub struct GeneratorCache { | ||
cache: BTreeMap<TokenId, PedersenGens>, | ||
} | ||
|
||
impl GeneratorCache { | ||
/// Get (and if necessary, cache) the Pedersen Generators corresponding to | ||
/// a particular token id. | ||
pub fn get(&mut self, token_id: TokenId) -> &PedersenGens { | ||
self.cache | ||
.entry(token_id) | ||
.or_insert_with(|| generators(*token_id)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.