Skip to content

Conversation

@random-zebra
Copy link

@random-zebra random-zebra commented Sep 11, 2020

Continues the budget-refactoring thread.

Remove the following classes entirely

  • CBudgetProposalBroadcast
  • CFinalizedBudgetBroadcast

Replace them with a new dastream-based constructor and a GetBroadcast function (returning the serialized stream) inside CBudgetProposal / CFinalizedBudget classes.

This allows us to get rid also of mapSeenProposals and mapSeenFinalizedBudgets and all the relative ugly code duplication (just rely on mapProposals and mapFinalizedBudgets to check for existence, and to get the broadcast messages to send).

Based on top of

Starts with [Refactoring] Introduce CFinalizedBudget/CBudgetProposal::GetBroadcast (37c629881372e492a65ea17a4b18ad02cd53ed58)

@random-zebra random-zebra added this to the 5.0.0 milestone Sep 11, 2020
@random-zebra random-zebra self-assigned this Sep 11, 2020
@random-zebra random-zebra force-pushed the 202009_budget_nuke-broadcasts branch 2 times, most recently from 5f44329 to 5045657 Compare September 12, 2020 23:10
@random-zebra random-zebra force-pushed the 202009_budget_nuke-broadcasts branch 4 times, most recently from 8de3a0c to 6034c6f Compare September 18, 2020 15:50
@random-zebra random-zebra force-pushed the 202009_budget_nuke-broadcasts branch 2 times, most recently from b8be313 to 5da20e0 Compare October 1, 2020 01:40
@random-zebra random-zebra force-pushed the 202009_budget_nuke-broadcasts branch 2 times, most recently from 26169a6 to fcff0c0 Compare October 19, 2020 09:02
@random-zebra
Copy link
Author

Rebased on master. Ready for review.

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review until b40325d (non inclusive), left purely code comments. Looking good so far

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK fcff0c0 .
Testing it now..

furszy
furszy previously approved these changes Oct 22, 2020
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with 1916, the sync is working as intended. ACK fcff0c0 .

There are issues on the superblock creation/validation now on master but it's not related to this PR.

@random-zebra random-zebra force-pushed the 202009_budget_nuke-broadcasts branch from fcff0c0 to 5004e1f Compare October 22, 2020 17:29
@random-zebra
Copy link
Author

Rebased and renamed LoadBroadcast to ParseBroadcast.

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re utACK 5004e1f .

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 5004e1f

@furszy furszy merged commit 24c9dbf into PIVX-Project:master Oct 26, 2020
random-zebra added a commit that referenced this pull request Nov 2, 2020
…ndexes

d7a1c99 [Cleanup] Extra call to CBudgetMan::SetBestHeight in reconsiderblock (random-zebra)
5d0731e [Cleanup] Remove redundant Clear in CBudgetManager constructor (random-zebra)
48b723e [Budget] Remove proposal/budgets if FeeTx block is disconnected (random-zebra)
9c6173c [Budget] Introduce mapFeeTxToProposal and mapFeeTxToBudget (random-zebra)

Pull request description:

  Based on top of:
  - [x] #1851

  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 from `DisconnectBlock` when undoing transactions, in order to remove the now-conflicted budget objects (without performing any expensive search).

ACKs for top commit:
  furszy:
    nice, code review ACK d7a1c99.
  Fuzzbawls:
    ACK d7a1c99

Tree-SHA512: 9dd8a671032f79105219b7a0e3e0514b991ff92e55834f5adad4964fb9b5c1842bbb0c0995c9b504ca79c5c86115061f4a93e9b4560a63c2beaf66aa5915c2f5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants