Skip to content

Commit 6c37eae

Browse files
committed
Merge bitcoin/bitcoin#24404: refactor: Remove confusing P1008R1 violation in ATMPArgs
faa1aec 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 2813b62..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 faa1aec glozow: code review ACK faa1aec Tree-SHA512: 16db2c9959a1996eafbfa533dc4d1483761b9d28295aed5a82b86abd7268da37c51c59ddc67c205165ecb415dbe637b12a0e1b3234d50ab0b3b79de66d7bd73e
2 parents 4f5d3ce + faa1aec commit 6c37eae

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/validation.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,26 @@ class MemPoolAccept
528528
/* m_package_submission */ true,
529529
};
530530
}
531-
// No default ctor to avoid exposing details to clients and allowing the possibility of
531+
532+
private:
533+
// Private ctor to avoid exposing details to clients and allowing the possibility of
532534
// mixing up the order of the arguments. Use static functions above instead.
533-
ATMPArgs() = delete;
535+
ATMPArgs(const CChainParams& chainparams,
536+
int64_t accept_time,
537+
bool bypass_limits,
538+
std::vector<COutPoint>& coins_to_uncache,
539+
bool test_accept,
540+
bool allow_bip125_replacement,
541+
bool package_submission)
542+
: m_chainparams{chainparams},
543+
m_accept_time{accept_time},
544+
m_bypass_limits{bypass_limits},
545+
m_coins_to_uncache{coins_to_uncache},
546+
m_test_accept{test_accept},
547+
m_allow_bip125_replacement{allow_bip125_replacement},
548+
m_package_submission{package_submission}
549+
{
550+
}
534551
};
535552

536553
// Single transaction acceptance

0 commit comments

Comments
 (0)