forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refactoring] Budget, round 5: proposals/budgets FeeTX indexes #1858
Merged
random-zebra
merged 4 commits into
PIVX-Project:master
from
random-zebra:202009_budget_disconnectFeeTx
Nov 2, 2020
Merged
[Refactoring] Budget, round 5: proposals/budgets FeeTX indexes #1858
random-zebra
merged 4 commits into
PIVX-Project:master
from
random-zebra:202009_budget_disconnectFeeTx
Nov 2, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 task
random-zebra
force-pushed
the
202009_budget_disconnectFeeTx
branch
2 times, most recently
from
October 1, 2020 02:12
3e3b18b
to
7ed5090
Compare
Merged
2 tasks
random-zebra
force-pushed
the
202009_budget_disconnectFeeTx
branch
2 times, most recently
from
October 20, 2020 10:40
1bc9855
to
64f0a33
Compare
random-zebra
force-pushed
the
202009_budget_disconnectFeeTx
branch
from
October 26, 2020 20:37
64f0a33
to
7d10926
Compare
Rebased, ready for review. |
random-zebra
force-pushed
the
202009_budget_disconnectFeeTx
branch
from
October 28, 2020 16:35
7d10926
to
c55c513
Compare
Keep track of the collateral txid for current proposals/budgets. Update in AddProposal/AddFinalizedBudget - CheckAndRemove and database it with CBudgetManager. Also rename mapCollateralTxids to mapUnconfirmedFeeTx to avoid confusion
random-zebra
force-pushed
the
202009_budget_disconnectFeeTx
branch
from
October 30, 2020 11:13
c55c513
to
d7a1c99
Compare
furszy
approved these changes
Oct 31, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, code review ACK d7a1c99.
Fuzzbawls
approved these changes
Nov 2, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK d7a1c99
furszy
added a commit
that referenced
this pull request
Nov 6, 2020
…ized budgets 5c0d2aa [Refactor] Fix styling (random-zebra) bcc7d7c [Cleanup] Remove not needed comparator (random-zebra) 8cf2ef0 [Trivial] Pass references to vote constructors (random-zebra) 56f176a [Trivial] Pass manager object to DumpBudgets (random-zebra) 7a5c02a [Refactor] Don't re-hash proposals in CFinalizedBudget::CheckProposals (random-zebra) b454d60 [Refactor] GetBudget() return proposal copies instead of pointers (random-zebra) b6af31c [Cleanup] Don't lock cs_budgets before CBudgetManager::SubmitVote (random-zebra) cbc6583 [Refactor] Check finalized budget inside CBudgetManager::SubmitVote (random-zebra) 9eceb21 [Refactor] Move finalized budget vote submission to budget-manager (random-zebra) 001f15d [Trivial] Rename global budget object to g_budgetman (random-zebra) Pull request description: Based on top of - [x] #1858 Starting with `[Trivial] Rename global budget object to g_budgetman` (64f0840) This refactors `CFinalizedBudget::SubmitVote`, moving it to the budget manager (`VoteOnFinalizedBudgets`), and removing the nested locking issues. It also does some trivial cleanup: - rename the global budget manager `g_budgetman` - pass const references to `CBudgetVote`/`CFinalizedBudget` constructors - pass the manager externally to `DumpBudgets` (instead of using the global one) ACKs for top commit: furszy: utACK 5c0d2aa after rebase for 1916 and merging.. Tree-SHA512: 0d12ca38f177e6fd5b1013f118375ca37a498593076cdc1877f5fb0e9329dd8e7292beee866600bc98b002476b3d9d44dac1d2cb2adbaa7276b52d97c5702119
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on top of:
Starting with
[Budget] Introduce mapFeeTxToProposal and mapFeeTxToBudget
(0eb9e45)Since #1845 we no longer check repeatedly the active chain, when updating a budget object, we just save the height of the block including the collateral tx (ref #1845), when we first add the proposal/budget to the map.
Therefore we need to handle the case where said block is disconnected from the chain.
In order to do so efficiently, this PR adds two indexes (
mapFeeTxToBudget
/mapFeeTxToProposal
), mapping collateral txids to the relative budget objects (while such objects are stored in the map).A simple function
CBudgetManager::RemoveByFeeTxId()
can then be called fromDisconnectBlock
when undoing transactions, in order to remove the now-conflicted budget objects (without performing any expensive search).