Skip to content

Conversation

xdustinface
Copy link

@xdustinface xdustinface commented Aug 29, 2020

Backport bitcoin#9680

Construct CWalletTx objects in CWallet::CommitTransaction, instead of having
callers do it. This ensures CWalletTx objects are constructed in a uniform way
and all fields are set.

This also makes it possible to avoid confusing and wasteful CWalletTx copies in
bitcoin#9381

There is no change in behavior.
No change in behavior in the normal case. But buggy mapWallet lookups with
invalid txids will now throw exceptions instead of inserting dummy entries into
the map, and potentially causing segfaults and other failures.

This also makes it a compiler error to use the mapWallet[hash] syntax which
could create dummy entries.
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

ACK

@UdjinM6 UdjinM6 added this to the 17 milestone Sep 3, 2020
@@ -1035,7 +1035,7 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
CAmount GetNormalizedAnonymizedBalance() const;
CAmount GetDenominatedBalance(bool unconfirmed=false) const;

bool GetBudgetSystemCollateralTX(CTransactionRef tx, uint256 hash, CAmount amount, const COutPoint& outpoint=COutPoint()/*defaults null*/);
bool GetBudgetSystemCollateralTX(CTransactionRef& tx, uint256 hash, CAmount amount, const COutPoint& outpoint=COutPoint()/*defaults null*/);
Copy link
Member

Choose a reason for hiding this comment

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

What's the point of making this a reference reference?

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

utACK, changes look good. Please update spreadsheet when merged: https://docs.google.com/spreadsheets/d/1DnKxat0S0H62CJOzXpKGPXTa8hgoVOjGYZzoClmGSB8/edit?usp=sharing

Also, please avoid mixing dash changes in the same commit as backport when possible. When it's in the same file, and it's clear what's happening, that's cool, but the changes to the privatesend code/governance code here should be done in a separate commit imo to enable an easier review of the main part of the backport

@UdjinM6 UdjinM6 merged commit ebe7e80 into dashpay:develop Sep 21, 2020
xdustinface pushed a commit that referenced this pull request Mar 26, 2021
* Fix extra line break in CommitTransaction log message

Introduced in #3680 ebe7e80#diff-b2bb174788c7409b671c46ccc86034bdR4113

* doc: Fix `quorum sign` help

* doc: Add `getdata` to quorum commands list help

* doc: Drop "P2WSH" from signrawtransactionwithkey help

* trivial: Replace "push_back(Pair(..))" with "pushKV"

* trivial: Reorder wallet cmd-line options

* git: Add macos debug simbols to .gitignore

* trivial: Fix typos and whitespaces, drop unused stuff
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Mar 8, 2022
* [wallet] Construct CWalletTx objects in CommitTransaction

Construct CWalletTx objects in CWallet::CommitTransaction, instead of having
callers do it. This ensures CWalletTx objects are constructed in a uniform way
and all fields are set.

This also makes it possible to avoid confusing and wasteful CWalletTx copies in
bitcoin#9381

There is no change in behavior.

* [wallet] Get rid of CWalletTx default constructor

No change in behavior in the normal case. But buggy mapWallet lookups with
invalid txids will now throw exceptions instead of inserting dummy entries into
the map, and potentially causing segfaults and other failures.

This also makes it a compiler error to use the mapWallet[hash] syntax which
could create dummy entries.

* Apply suggestions from code review

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>

Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Mar 15, 2022
* Fix extra line break in CommitTransaction log message

Introduced in dashpay#3680 dashpay@ebe7e80#diff-b2bb174788c7409b671c46ccc86034bdR4113

* doc: Fix `quorum sign` help

* doc: Add `getdata` to quorum commands list help

* doc: Drop "P2WSH" from signrawtransactionwithkey help

* trivial: Replace "push_back(Pair(..))" with "pushKV"

* trivial: Reorder wallet cmd-line options

* git: Add macos debug simbols to .gitignore

* trivial: Fix typos and whitespaces, drop unused stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants