diff options
author | fanquake <fanquake@gmail.com> | 2022-03-10 13:39:20 +0000 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2022-03-10 13:57:36 +0000 |
commit | 6c37eae0ad9430c6a7e0c4818b94305f271b19e2 (patch) | |
tree | 42a2440d036be02b940b4c93346b7b7be9cc5a13 | |
parent | 4f5d3ce5a059218ec03cf0b0d12e3e4026dc9939 (diff) | |
parent | faa1aec26b3f354c832e6b995323c9429b178931 (diff) |
Merge bitcoin/bitcoin#24404: refactor: Remove confusing P1008R1 violation in ATMPArgs
faa1aec26b3f354c832e6b995323c9429b178931 Remove confusing P1008R1 violation in ATMPArgs (MarcoFalke)
Pull request description:
The `= delete` doesn't achieve the stated goal and it is also redundant, since it is not possible to default construct the `ATMPArgs` type.
This can be tested with:
```diff
diff --git a/src/validation.cpp b/src/validation.cpp
index 2813b62462..1c939c0b8a 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -519,6 +519,7 @@ public:
/** Parameters for child-with-unconfirmed-parents package validation. */
static ATMPArgs PackageChildWithParents(const CChainParams& chainparams, int64_t accept_time,
std::vector<COutPoint>& coins_to_uncache) {
+ ATMPArgs{};
return ATMPArgs{/* m_chainparams */ chainparams,
/* m_accept_time */ accept_time,
/* m_bypass_limits */ false,
```
Which fails on current master *and* this pull with the following error:
```
validation.cpp:525:22: error: reference member of type 'const CChainParams &' uninitialized
ATMPArgs{};
~^
validation.cpp:470:29: note: uninitialized reference member is here
const CChainParams& m_chainparams;
^
1 error generated.
```
Further reading (optional):
* http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p1008r1.pdf
ACKs for top commit:
achow101:
ACK faa1aec26b3f354c832e6b995323c9429b178931
glozow:
code review ACK faa1aec26b3f354c832e6b995323c9429b178931
Tree-SHA512: 16db2c9959a1996eafbfa533dc4d1483761b9d28295aed5a82b86abd7268da37c51c59ddc67c205165ecb415dbe637b12a0e1b3234d50ab0b3b79de66d7bd73e
-rw-r--r-- | src/validation.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index d80e2576d2..a7360e4b64 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -528,9 +528,26 @@ public: /* m_package_submission */ true, }; } - // No default ctor to avoid exposing details to clients and allowing the possibility of + + private: + // Private ctor to avoid exposing details to clients and allowing the possibility of // mixing up the order of the arguments. Use static functions above instead. - ATMPArgs() = delete; + ATMPArgs(const CChainParams& chainparams, + int64_t accept_time, + bool bypass_limits, + std::vector<COutPoint>& coins_to_uncache, + bool test_accept, + bool allow_bip125_replacement, + bool package_submission) + : m_chainparams{chainparams}, + m_accept_time{accept_time}, + m_bypass_limits{bypass_limits}, + m_coins_to_uncache{coins_to_uncache}, + m_test_accept{test_accept}, + m_allow_bip125_replacement{allow_bip125_replacement}, + m_package_submission{package_submission} + { + } }; // Single transaction acceptance |