Skip to content
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

Make CBlock a vector of shared_ptr of CTransactions #1815

Merged
merged 3 commits into from
Sep 24, 2020

Conversation

furszy
Copy link

@furszy furszy commented Aug 22, 2020

Inspired on bitcoin#9125 (with many more adaptations), preparation for bitcoin#8580. Ant work 🐜

Establishing the bases for the work, we will need to continue migrating CTransaction to std::shared_ptr<const CTransaction> where is possible. Example bitcoin#8126 (can find more in #1726 list).

TODO:

  • back port final CTransactionRef implementation commit.

EDIT:
This is now depending on #1816 .

@furszy furszy self-assigned this Aug 22, 2020
@furszy furszy force-pushed the 2020_block_to_shared_txs_pinter branch 2 times, most recently from 3cbe588 to 3009701 Compare August 24, 2020 05:45
@furszy furszy force-pushed the 2020_block_to_shared_txs_pinter branch from 3009701 to b1b7de0 Compare August 24, 2020 23:21
random-zebra added a commit that referenced this pull request Sep 6, 2020
… clean up.

063401c PoS miner: add height to the first input scriptSig of the coinstake tx + remove unneded IncrementExtraNonce call in PoS blocks. (furszy)
7fc4680 Do not calculate the block value twice for the same block. (furszy)
7893818 Removing not needed CBlock::payee member. (furszy)
3e07280 Remove unused zPIVStake argument in FillBlockPayee. (furszy)
f702628 miner: decouple coinbase transaction creation into its own function. (furszy)
377f87e FillBlockPayee: reworked to not require chainActive.Tip redundant access. (furszy)
920652b miner: remove FillBlockPayee unneded fee argument + refactor coinbase tx creation to be in one single place and not dispersed across the CreateNewBlock method. (furszy)

Pull request description:

  Another step forward improving the miner `CreateNewBlock` function.
  This time, have unified the coinbase tx creation flow that was previously dispersed over the function and having some redundant initializations/sets.
  Plus, cleaned up some unused and/or unneeded fields and function arguments.

  This is a preparation for #1815 work.  It will not be possible to modify any of the elements of a transaction once them are appended to a block, thus why the transaction needs (more than ever) to be crafted in one single place and not all over the sources.

ACKs for top commit:
  Fuzzbawls:
    ACK 063401c
  random-zebra:
    utACK 063401c and merging...

Tree-SHA512: c32cd87f82d9b31dedf9d47063a67978ef683bf35ff625823d6ece1a2d2904599dcbf15791682ffc1deb412082b1ecc24d11b364e300d4ceb259c65e65b0e9f6
@furszy furszy force-pushed the 2020_block_to_shared_txs_pinter branch from b1b7de0 to 14243da Compare September 7, 2020 02:33
@furszy
Copy link
Author

furszy commented Sep 7, 2020

rebased

@random-zebra
Copy link

Needs another rebase, due to a minor conflict with #1835 just merged.

@furszy furszy force-pushed the 2020_block_to_shared_txs_pinter branch from 14243da to 3b65314 Compare September 7, 2020 16:49
@furszy furszy changed the title [WIP] Make CBlock a vector of shared_ptr of CTransactions Make CBlock a vector of shared_ptr of CTransactions Sep 7, 2020
@furszy
Copy link
Author

furszy commented Sep 7, 2020

rebased again.

@random-zebra random-zebra added this to the 5.0.0 milestone Sep 19, 2020
random-zebra
random-zebra previously approved these changes Sep 19, 2020
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

Needs another rebase. Otherwise tested ACK

@furszy
Copy link
Author

furszy commented Sep 19, 2020

done, rebased.

Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

ACK 911e31c

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 911e31c

@Fuzzbawls
Copy link
Collaborator

Note-to-self: This conflicts with #1869

@furszy furszy merged commit 7b2b9d0 into PIVX-Project:master Sep 24, 2020
random-zebra added a commit that referenced this pull request Sep 27, 2020
9d8b8a2 BugFix: CMutableTransaction following the same sapling nVersion rules as CTransaction. (furszy)
1ca1b89 PeerLogicValidation missing destructor declaration warning fix. (furszy)
093a766 Introduce convenience type CTransactionRef (furszy)
8345a87 Refactor: make the read function simpler (gnuser)

Pull request description:

  PR solving the current master's syncing issue (syncing process not passing through block 5840), solved in 9d8b8a2.

  Essentially, when we merged #1815, we moved from using the default transaction constructor and the ser/unser template methods (`SerializationOp`) to be using, inside the templated serialization puzzle, the deserializing constructor (`CTransaction(deserialize_type, Stream& s)`) which internally creates a `CMutableTransaction` which wasn't having the same sapling tx version guard as `CTransaction` ser/unser method. So, in other words, it was trying to parse the shielded transaction data from an old version two transaction (yes, we already have version two transaction in our network.. first one is in block 5840).

  Plus, i took the mischief of not only including the bugfix, have added:

  * stream::read function readability improvement coming from bitcoin#11221.
  * a pretty straightforward adaptation of upstream's b4e4ba4  (missing last commit not included in #1815).
  * a `PeerLogicValidation` class compiler warning fix 1ca1b89

ACKs for top commit:
  random-zebra:
    ACK 9d8b8a2
  Fuzzbawls:
    ACK 9d8b8a2

Tree-SHA512: ffb60001160d177d20da3d9198f73910921ec521e6cae1ccbf9f6359dc96e3e4fdbbcaabb85331ce2a8b839c07ab34b3981c69d83aa6990aa79e134588539f48
@furszy furszy deleted the 2020_block_to_shared_txs_pinter branch November 29, 2022 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Block Generation Mining/Staking related issues Refactoring Upstream
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants