Skip to content

Commit 3c447bb

Browse files
committed
Refactor block production logic to notify about new slots and handle bundle availability more gracefully
1 parent 594167c commit 3c447bb

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

test/subspace-farmerless-dev-node/src/manual_rpc.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,21 +137,18 @@ async fn produce_single_block(
137137
consensus: &mut MockConsensusNode,
138138
wait_for_bundle: bool,
139139
) -> Result<(), String> {
140+
let slot = consensus.produce_slot();
141+
140142
if wait_for_bundle {
141-
let (slot, _) = consensus
142-
.produce_slot_and_wait_for_bundle_submission()
143-
.await;
144-
consensus
145-
.produce_block_with_slot(slot)
146-
.await
147-
.map_err(|err| err.to_string())
148-
} else {
149-
let slot = consensus.produce_slot();
150-
consensus
151-
.produce_block_with_slot(slot)
152-
.await
153-
.map_err(|err| err.to_string())
143+
// Notify domain operator about the new slot and try to get a bundle
144+
// If no bundle is available, we'll produce the block anyway
145+
let _ = consensus.notify_new_slot_and_wait_for_bundle(slot).await;
154146
}
147+
148+
consensus
149+
.produce_block_with_slot(slot)
150+
.await
151+
.map_err(|err| err.to_string())
155152
}
156153

157154
async fn produce_multiple_blocks(

0 commit comments

Comments
 (0)