Skip to content

Commit

Permalink
fix(conditional compilation): audit flag
Browse files Browse the repository at this point in the history
  • Loading branch information
cong-or committed Jul 27, 2023
1 parent eb6d4b5 commit ba6ef47
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/audit/src/lib/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,7 @@ pub fn find_vote(jormungandr_database: &Path, voting_key: String) -> Result<Vec<
}
};

let caster_address = Address(
Discrimination::Production,
Kind::Account(voting_key.clone()),
);
let caster_address = Address(Discrimination::Production, Kind::Account(voting_key));

// Tag should be present
let tip_id = db.get_tag(MAIN_TAG)?.unwrap();
Expand Down
5 changes: 2 additions & 3 deletions src/audit/src/lib/offline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ pub fn ledger_before_tally(
all_fragments: Vec<Fragment>,
block0: Block,
) -> Result<Vec<VotePlanStatus>, Report> {
let without_tally_fragments: Vec<Fragment> = all_fragments
let without_tally_fragments = all_fragments
.into_iter()
.filter(|f| !matches!(f, Fragment::VoteTally(_)))
.collect();
.filter(|f| !matches!(f, Fragment::VoteTally(_)));

let (ledger, failed) =
recover_ledger_from_fragments(&block0, without_tally_fragments.into_iter())?;
Expand Down
1 change: 1 addition & 0 deletions src/audit/src/lib/recover.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[allow(clippy::result_large_err)]
use chain_addr::{Discrimination, Kind};
use chain_core::property::Fragment as _;
use chain_crypto::{Ed25519Extended, SecretKey};
Expand Down
4 changes: 3 additions & 1 deletion src/chain-libs/chain-impl-mockchain/src/vote/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,9 @@ impl VotePlanManager {
where
F: FnMut(&VoteAction),
{
if !cfg!(feature = "audit") && !self.can_committee(block_date) {
if cfg!(feature = "audit") {
// audit feature enabled - fragment replay has no concept of time. Skip check.
} else if !self.can_committee(block_date) {
return Err(VoteError::NotCommitteeTime {
start: self.plan().committee_start(),
end: self.plan().committee_end(),
Expand Down

0 comments on commit ba6ef47

Please sign in to comment.