IIRC this was actually intentional (and maybe even in response to a review comment); it being a pointer makes it more clear that the object will store the passed-in argument, making it less likely that someone would accidentally pass in a temporary that would not outlive the constructed object.
Maybe this deserves the use of lifetimebound as introduced by #19387.
DrahtBot added the label
Refactoring
on Jul 1, 2020
DrahtBot added the label
RPC/REST/ZMQ
on Jul 1, 2020
DrahtBot added the label
Tests
on Jul 1, 2020
theuni
commented at 6:32 pm on July 1, 2020:
member
The nonnull attribute could be helpful as well, if this is kept as a pointer.
MarcoFalke removed the label
RPC/REST/ZMQ
on Jul 1, 2020
MarcoFalke removed the label
Tests
on Jul 1, 2020
practicalswift
commented at 10:06 pm on July 1, 2020:
contributor
Concept ACK for making the implicit precondition (non-null mut-tx) explicit by the suggested change.
Concept super ACK for also adding lifetime annotations as suggested by @sipa to make the currently not entirely obvious lifetime hint explicit :)
Rationale in both cases:
explicit is better than implicit
compiler enforced is better than “try to remember”-enforced
See this list of similar cases that we may want to convert if reference + lifetimebound attribute is the direction we’re going in: #19387 (comment)
DrahtBot
commented at 1:41 am on July 2, 2020:
contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
Reviewers, this pull request conflicts with the following ones:
#22793 (Simplify BaseSignatureChecker virtual functions and GenericTransactionSignatureChecker constructors by achow101)
#21702 (Implement BIP-119 Validation (CheckTemplateVerify) by JeremyRubin)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
MarcoFalke force-pushed
on Nov 25, 2020
MarcoFalke marked this as ready for review
on Nov 25, 2020
MarcoFalke
commented at 2:29 pm on November 25, 2020:
member
Maybe this deserves the use of lifetimebound
thx, done
MarcoFalke force-pushed
on Dec 21, 2020
MarcoFalke
commented at 12:44 pm on December 21, 2020:
member
Rebased
MarcoFalke
commented at 12:45 pm on December 21, 2020:
member
Closing for now due to lack of interest
MarcoFalke closed this
on Dec 21, 2020
MarcoFalke deleted the branch
on Dec 21, 2020
bitcoin locked this
on Feb 15, 2022
MarcoFalke restored the branch
on May 4, 2022
bitcoin unlocked this
on May 4, 2022
refactor: Change * to & in MutableTransactionSignatureCreatorfac6cfc50f
MarcoFalke reopened this
on May 4, 2022
MarcoFalke force-pushed
on May 4, 2022
MarcoFalke
commented at 9:51 am on May 4, 2022:
member
Rebased
theStack approved
theStack
commented at 11:59 am on May 4, 2022:
contributor
Checked that the newly introduced [[clang::lifetimebound]] attribute for the first parameter applies by compiling with clang 13.0.0 and the following patch:
0diff --git a/src/test/txvalidationcache_tests.cpp b/src/test/txvalidationcache_tests.cpp
1index d41b54af2..dd995a445 100644
2--- a/src/test/txvalidationcache_tests.cpp
3+++ b/src/test/txvalidationcache_tests.cpp
4@@ -361,6 +361,8 @@ BOOST_FIXTURE_TEST_CASE(checkinputs_test, Dersig100Setup)
5 UpdateInput(tx.vin[i], sigdata);
6 }
7 8+ auto mtxsig = MutableTransactionSignatureCreator(CMutableTransaction(), 0, 0, SIGHASH_ALL);
9+
10 // This should be valid under all script flags
11 ValidateCheckInputsForAllFlags(CTransaction(tx), 0, true, m_node.chainman->ActiveChainstate().CoinsTip());
leading to the following warning:
0 CXX test/test_bitcoin-txvalidationcache_tests.o
1test/txvalidationcache_tests.cpp:364:58: warning: temporary whose address is used as value of local variable 'mtxsig' will be destroyed at the end of the full-expression [-Wdangling]
2 auto mtxsig = MutableTransactionSignatureCreator(CMutableTransaction(), 0, 0, SIGHASH_ALL);
3^~~~~~~~~~~~~~~~~~~~~41 warning generated.
jonatack
commented at 8:27 am on May 5, 2022:
contributor
ACKfac6cfc50f65c610f2df9af3ec2efff5eade6661
MarcoFalke merged this
on May 6, 2022
MarcoFalke closed this
on May 6, 2022
MarcoFalke deleted the branch
on May 6, 2022
sidhujag referenced this in commit
072bb30765
on May 9, 2022
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2024-11-17 03:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me