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

[Model] TransactionRecord decomposeTransaction refactoring #1776

Merged

Conversation

furszy
Copy link

@furszy furszy commented Jul 31, 2020

Initial step towards a cleaner and more understandable TransactionRecord::decomposeTransaction function.

No functional change. Have done mostly code refactoring with some cleanups and improvements.

@furszy furszy self-assigned this Jul 31, 2020
@furszy
Copy link
Author

furszy commented Jul 31, 2020

Updated the PR with more changes. Couldn't resist myself.

The flow now should be much more "followable" and pleasant to read. Plus, it has some more performance improvements that have found on the way.

@furszy furszy changed the title [Model] TransactionRecord decomposeTransaction refactoring (Step 1) [Model] TransactionRecord decomposeTransaction refactoring Jul 31, 2020
@Fuzzbawls Fuzzbawls added the GUI label Aug 2, 2020
@Fuzzbawls Fuzzbawls added this to the 5.0.0 milestone Aug 2, 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.

Very nice cleanup.
It can maybe squashed down to one or two commits, as it's all touching the same function.
Anyway, just a styling nit and couple questions inlined.

src/qt/transactionrecord.cpp Outdated Show resolved Hide resolved
src/qt/transactionrecord.cpp Outdated Show resolved Hide resolved
src/qt/transactionrecord.cpp Outdated Show resolved Hide resolved
@furszy furszy force-pushed the 2020_transactionRecord_initial_refactoring branch from cbf9c7c to d582531 Compare August 2, 2020 22:21
@furszy
Copy link
Author

furszy commented Aug 2, 2020

Updated per review

@furszy
Copy link
Author

furszy commented Aug 5, 2020

Updated per feedback. Added a new commit on top. Will squash them all once we complete the review process.

@random-zebra random-zebra added the Needs Backport Placeholder tag for anything needing a backport to prior version branches label Aug 5, 2020
random-zebra
random-zebra previously approved these changes Aug 11, 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.

tested ACK. Can be squashed/merged at any time for me.

@furszy furszy requested a review from Fuzzbawls August 11, 2020 18:36
Fuzzbawls
Fuzzbawls previously approved these changes Aug 12, 2020
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 9162877

…oseTransaction.

decomposeCoinStake: Moved stake output address extraction to where it's used.

decomposeCoinStake: clarity on not performing any action if tx is not a coinstake.

refactor: decouple decompose zc spend tx from TransactionRecord::decomposeTransaction

decomposeTransaction: if there is no value on the map, return an empty string instead of crashing.

decomposeTransaction: decouple cold staking related tx decomposing from the monolithic method (for now).

In the future, this code should be merged with the credit/debit tx decomposing code to be able to show each output as a different record.

decomposeTransaction: removing unneded and duplicated IsMine method call.

decomposeTransaction: decouple credit transaction decomposing into its own method.

decomposeTransaction: decouple sendToSelf tx decomposing into its own method.

decomposeTransaction: duplicate isMine on MN record removed + few compiler warnings fixed.

decomposeTransaction: decouple debit transaction decomposing into its own method

decomposeTransaction: added some comments + removed code extra spacing.

decomposeTransaction: do not recalculate the tx size on every input/output loop.

decomposeTransaction: minor methods call standardization.

decomposeCreditTransaction: clean cached tx size. If it reached to this point, then the tx has credit and at least one output from the wallet
@furszy furszy dismissed stale reviews from Fuzzbawls and random-zebra via 65a50c1 August 12, 2020 16:36
@furszy furszy force-pushed the 2020_transactionRecord_initial_refactoring branch from 9162877 to 65a50c1 Compare August 12, 2020 16:36
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.

re-utACK 65a50c1

@furszy furszy merged commit 2ad27b1 into PIVX-Project:master Aug 12, 2020
Fuzzbawls pushed a commit to Fuzzbawls/PIVX that referenced this pull request Aug 13, 2020
…oseTransaction.

decomposeCoinStake: Moved stake output address extraction to where it's used.

decomposeCoinStake: clarity on not performing any action if tx is not a coinstake.

refactor: decouple decompose zc spend tx from TransactionRecord::decomposeTransaction

decomposeTransaction: if there is no value on the map, return an empty string instead of crashing.

decomposeTransaction: decouple cold staking related tx decomposing from the monolithic method (for now).

In the future, this code should be merged with the credit/debit tx decomposing code to be able to show each output as a different record.

decomposeTransaction: removing unneded and duplicated IsMine method call.

decomposeTransaction: decouple credit transaction decomposing into its own method.

decomposeTransaction: decouple sendToSelf tx decomposing into its own method.

decomposeTransaction: duplicate isMine on MN record removed + few compiler warnings fixed.

decomposeTransaction: decouple debit transaction decomposing into its own method

decomposeTransaction: added some comments + removed code extra spacing.

decomposeTransaction: do not recalculate the tx size on every input/output loop.

decomposeTransaction: minor methods call standardization.

decomposeCreditTransaction: clean cached tx size. If it reached to this point, then the tx has credit and at least one output from the wallet

Github-Pull: PIVX-Project#1776
Rebased-From: 65a50c1
furszy added a commit that referenced this pull request Aug 18, 2020
dc0ed71 [BUG][GUI] Don't append cold-stake records twice (random-zebra)
91adcd7 masternode: CalculateScore and GetBlockHash accessing to chainActive without cs_main fix. (furszy)
eeb112f GetMasternodeInputAge: Missing cs_main lock (furszy)
52ec12d refactor: decouple decompose coinstake from TransactionRecord::decomposeTransaction. (furszy)
51a8389 [BUG] Properly copy fCoinStake memeber between CTxInUndo and CCoins Github-Pull: #1796 Rebased-From: acf757b (random-zebra)
5c3caa4 lock cs_main for Misbehaving (furszy)
5c629d8 openssl.org dependency download link changed (CryptoDev-Project)
11aa63c Do not try to resend transactions if the node is importing or in IBD. (furszy)
c59b62e [Core] Remove BIP30 check (random-zebra)
3f05eba include missing atomic to make CMake linux happy. (furszy)
f0cfd88 Make the cs_sendProcessing a LOCK instead of a TRY_LOCK (Matt Corallo)
d38e28c Split CNode::cs_vSend: message processing and message sending (Matt Corallo)
7561b18 Remove double brackets in addrman (Matt Corallo)
63c629b Fix AddrMan locking (Matt Corallo)
f78cec4 Make fDisconnect an std::atomic (Matt Corallo)
ec56cf5 net: fix a few cases where messages were sent rather than dropped upon disconnection (furszy)
7697085 Acquire cs_main lock before cs_wallet during wallet initialization (random-zebra)
c796593 Remove bogus assert on number of oubound connections. (Matt Corallo)
7521065 wallet: Ignore MarkConflict if block hash is not known (random-zebra)
72042ac Move disconnectBlocks logging to use __func__ instead of hardcoded method name. (furszy)
0f66764 Simplify DisconnectBlock arguments/return value (furszy)
cca4a8c Split logic to undo txin's off DisconnectBlock (furszy)
0f883e6 Cleaner disconnectBlock flow for coinbase and zerocoin txs. (furszy)
a7cbc46 Move UndoWriteToDisk() and UndoReadFromDisk() to anon namespace (random-zebra)
de5a405 Decouple CBlockUndo from CDiskBlockPos (jtimon)
671143c Decouple miner.o and txmempool.o from CTxUndo (random-zebra)
9419228 Decouple CCoins from CTxInUndo (jtimon)

Pull request description:

  Backports the following PRs to the `4.2` branch:

  #1746
  #1735
  #1767
  #1769
  #1781
  #1780
  #1775
  #1783
  #1750
  #1785
  #1796
  #1776
  #1791

ACKs for top commit:
  furszy:
    Added #1805. utACK dc0ed71.
  random-zebra:
    utACK dc0ed71

Tree-SHA512: 0e59c9e751597b1b6f9a419e117946cec468dffdb921c882a44e5770ecb1a36b7d3d25f8c7f97d48bb3d59f136492842c08969901512d957a17bfaec6aece449
@random-zebra random-zebra modified the milestones: 5.0.0, 4.3.0 Sep 10, 2020
@random-zebra random-zebra removed the Needs Backport Placeholder tag for anything needing a backport to prior version branches label Sep 10, 2020
@furszy furszy deleted the 2020_transactionRecord_initial_refactoring branch November 29, 2022 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants