Skip to content

Commit

Permalink
persistence: fix ordering of state extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Aug 1, 2024
1 parent 77728ce commit 3263dfc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/containers/consignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ impl<const TRANSFER: bool> Consignment<TRANSFER> {
}
// TODO: check attach ids from data containers are present in operations
// TODO: validate sigs and remove untrusted
// TODO: Check that all extensions present in the consignment are used by state
// transitions

if validity != Validity::Valid {
Err((status, self))
Expand Down
7 changes: 4 additions & 3 deletions src/persistence/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ impl<P: StateProvider> State<P> {
if input.prev_out.op == *id {
*used = true;
if let Some((_, witness_ord2)) = ordered_extensions.get_mut(id) {
// TODO: Double-check this ordering
if *witness_ord2 > witness_ord {
if *witness_ord2 < witness_ord {
*witness_ord2 = witness_ord;
}
} else {
Expand All @@ -197,7 +196,9 @@ impl<P: StateProvider> State<P> {
.add_extension(extension, *witness_id, *witness_ord)
.map_err(StateError::WriteProvider)?;
}
// TODO: Do something otherwise
// Otherwise consignment includes state extensions which are not
// used in transaction graph. This must not be the case for the
// validated consignments.
}

Ok(())
Expand Down

0 comments on commit 3263dfc

Please sign in to comment.