File tree Expand file tree Collapse file tree 4 files changed +20
-3
lines changed
transaction_pool/candidate Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ impl LedgerWriteState {
39
39
} )
40
40
. flatten ( )
41
41
}
42
+
43
+ pub fn is_busy ( & self ) -> bool {
44
+ self . pending_requests ( ) . peekable ( ) . peek ( ) . is_some ( )
45
+ }
42
46
}
43
47
44
48
impl Default for LedgerWriteState {
Original file line number Diff line number Diff line change @@ -113,8 +113,14 @@ impl redux::EnablingCondition<crate::State> for TransactionPoolCandidateAction {
113
113
. is_some ( ) ,
114
114
TransactionPoolCandidateAction :: Libp2pTransactionsReceived { .. } => true ,
115
115
TransactionPoolCandidateAction :: VerifyNext => {
116
- // TODO: if a block is being applied or produced, skip this action too
117
- state. transition_frontier . sync . is_synced ( )
116
+ // Don't continue if we are producing a block, or we never synced yet
117
+ // or if the ledger service is busy.
118
+ !state. block_producer . is_producing ( )
119
+ && state
120
+ . transition_frontier
121
+ . best_tip ( )
122
+ . is_some_and ( |b| !b. is_genesis ( ) )
123
+ && !state. ledger . write . is_busy ( )
118
124
}
119
125
TransactionPoolCandidateAction :: VerifyPending {
120
126
peer_id,
Original file line number Diff line number Diff line change @@ -99,6 +99,11 @@ impl RustNodeTestingConfig {
99
99
self
100
100
}
101
101
102
+ pub fn initial_time ( mut self , time : redux:: Timestamp ) -> Self {
103
+ self . initial_time = time;
104
+ self
105
+ }
106
+
102
107
pub fn with_peer_id ( mut self , bytes : [ u8 ; 32 ] ) -> Self {
103
108
self . peer_id = TestPeerId :: Bytes ( bytes) ;
104
109
self
Original file line number Diff line number Diff line change @@ -18,7 +18,9 @@ pub struct P2pReceiveMessage;
18
18
19
19
impl P2pReceiveMessage {
20
20
pub async fn run ( self , mut runner : ClusterRunner < ' _ > ) {
21
- let config = RustNodeTestingConfig :: devnet_default ( ) . initial_peers ( hosts:: devnet ( ) ) ;
21
+ let config = RustNodeTestingConfig :: devnet_default ( )
22
+ . initial_peers ( hosts:: devnet ( ) )
23
+ . initial_time ( redux:: Timestamp :: global_now ( ) ) ;
22
24
23
25
let retransmitter_openmina_node = runner. add_rust_node ( config) ;
24
26
You can’t perform that action at this time.
0 commit comments