Skip to content

Commit 039796a

Browse files
committed
fix(block_producer): missing parent staged ledger for creating new staged ledger diff in case of race condition
1 parent d8ec4b3 commit 039796a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

node/src/block_producer/block_producer_actions.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,18 @@ impl redux::EnablingCondition<crate::State> for BlockProducerAction {
111111
|| proven_block.is_some_and(|b| Arc::ptr_eq(&b.block, &tip.block))
112112
})
113113
};
114-
this.current.won_slot_should_produce(time) && has_genesis_proven_if_needed()
114+
this.current.won_slot_should_produce(time)
115+
&& has_genesis_proven_if_needed()
116+
// don't start block production (particularly staged ledger diff creation),
117+
// if transition frontier sync commit is pending,
118+
// as in case when fork is being committed, there
119+
// is no guarantee that staged ledger for the current
120+
// best tip (chosen as a parent for the new block being produced),
121+
// will be still there, once the staged ledger
122+
// diff creation request reaches the ledger service.
123+
// So we would be trying to build on top of
124+
// non-existent staged ledger causing a failure.
125+
&& !state.transition_frontier.sync.is_commit_pending()
115126
})
116127
}
117128
BlockProducerAction::WonSlotTransactionsGet => {

0 commit comments

Comments
 (0)