Skip to content

Commit ad1e9a2

Browse files
committed
[Refactoring] Cache block height of proposals collateral
- Introduce a new variable nBlockFeeTx, set during CheckCollateral caching the height of the block holding the collateral tx - Call CheckCollateral (setting proposals/budgets height/time) only from one place (AddProposal/AddFinalizedBudgets) without cs_main held. - only check for confirmations inside UpdateValid (using the cached value of nBlockFeeTx). - remove fCheckCollateral from UpdateValid In those two cases where we haven't submitted the collateral tx yet, don't add the proposal/budget to the map. Only check that it's well formed. This ultimately removes the locking-order issue between cs_main and cs_budgets/cs_proposals. Changes to the serialization will invalidate the previous DB, and force the node to recreate the map (calling AddProposal and setting the block height). TODO: Remove proposals/budgets from maps if the block is disconnected.
1 parent d4bedbd commit ad1e9a2

File tree

3 files changed

+94
-157
lines changed

3 files changed

+94
-157
lines changed

0 commit comments

Comments
 (0)