mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-08-24 22:29:22 +00:00
add validity window checks on privacy preserving transactions
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
use nssa_core::program::{
|
||||
AccountPostState, BlockId, ProgramInput, ProgramOutput, read_nssa_inputs,
|
||||
};
|
||||
|
||||
type Instruction = (Option<BlockId>, Option<BlockId>);
|
||||
|
||||
fn main() {
|
||||
let (
|
||||
ProgramInput {
|
||||
pre_states,
|
||||
instruction: (from_id, until_id),
|
||||
},
|
||||
instruction_words,
|
||||
) = read_nssa_inputs::<Instruction>();
|
||||
|
||||
let Ok([pre]) = <[_; 1]>::try_from(pre_states) else {
|
||||
return;
|
||||
};
|
||||
|
||||
let post = pre.account.clone();
|
||||
|
||||
let mut output = ProgramOutput::new(
|
||||
instruction_words,
|
||||
vec![pre],
|
||||
vec![AccountPostState::new(post)],
|
||||
);
|
||||
|
||||
if let Some(id) = from_id {
|
||||
output = output.valid_from_id(id);
|
||||
}
|
||||
if let Some(id) = until_id {
|
||||
output = output.valid_until_id(id);
|
||||
}
|
||||
|
||||
output.write();
|
||||
}
|
||||
Reference in New Issue
Block a user