Skip to content

Commit 0244d65

Browse files
authored
Merge pull request #119 from tokatoka/fix_consensus_2
Sync the two nodes at the very last in ConsensusOracle
2 parents c43bccf + b05dc1e commit 0244d65

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

fuzzamoto-scenarios/bin/ir.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,6 @@ where
374374

375375
#[cfg(feature = "oracle_consensus")]
376376
{
377-
// Ensure the nodes are connected and eventually consistent (i.e. reach consensus
378-
// on the chain tip).
379-
if !self.second.is_connected_to(&self.inner.target) {
380-
let _ = self.second.connect_to(&self.inner.target);
381-
}
382-
383377
let consensus_oracle = ConsensusOracle::<TX, TX>::default();
384378
if let OracleResult::Fail(e) = consensus_oracle.evaluate(&mut ConsensusContext {
385379
primary: &mut self.inner.target,

fuzzamoto/src/oracles.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ impl<'a, T1, T2, TX1, TX2> Oracle<ConsensusContext<'a, T1, T2>> for ConsensusOra
7171
where
7272
TX1: Transport,
7373
TX2: Transport,
74-
T1: Target<TX1> + HasTipInfo + GenerateToAddress,
75-
T2: Target<TX2> + HasTipInfo,
74+
T1: Target<TX1> + HasTipInfo + GenerateToAddress + ConnectableTarget,
75+
T2: Target<TX2> + HasTipInfo + ConnectableTarget,
7676
{
7777
fn evaluate(&self, context: &mut ConsensusContext<'a, T1, T2>) -> OracleResult {
7878
// reset mocktime to the most future value
@@ -83,6 +83,12 @@ where
8383
.primary
8484
.generate_to_address(ADDRESS_BCRT1_P2WSH_OP_TRUE);
8585

86+
// Ensure the nodes are connected and eventually consistent (i.e. reach consensus
87+
// on the chain tip).
88+
if !context.reference.is_connected_to(context.primary) {
89+
let _ = context.reference.connect_to(context.primary);
90+
}
91+
8692
let start = Instant::now();
8793

8894
let mut primary_tip = None;

0 commit comments

Comments
 (0)