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
[Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck #10953
Conversation
Concept ACK |
|
Concept ACK |
@NicolasDorier seems can't do that because |
utack 3457ef1 |
@NicolasDorier VerifyScript knows nothing about transaction structure. |
woops indeed I missed it utACK 3457ef1 |
src/validation.h
Outdated
scriptPubKey(scriptPubKeyIn), amount(amountIn), | ||
ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn), error(SCRIPT_ERR_UNKNOWN_ERROR), txdata(txdataIn) { } | ||
CScriptCheck(): out(CTxOut()), ptxTo(0), nIn(0), nFlags(0), cacheStore(false), error(SCRIPT_ERR_UNKNOWN_ERROR) {} | ||
CScriptCheck(const CTxOut& outIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, bool cacheIn, PrecomputedTransactionData* txdataIn) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove CTxOut()
. Nit, class members are prefixed.
Concept ACK |
3457ef1
to
e912118
Compare
rebased |
utACK e912118. |
utACK e912118 |
1 similar comment
utACK e912118 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
src/validation.h
Outdated
@@ -355,8 +355,7 @@ bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp = null | |||
class CScriptCheck | |||
{ | |||
private: | |||
CScript scriptPubKey; | |||
CAmount amount; | |||
CTxOut out; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I know it's tedious, but can you name this according to the new style guide. In this case m_tx_out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where could I see the new style guide? And what does the "m" mean? Actually I think "prevout" is the most accurate name but the name is already used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md
Class member variables have a m_ prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually the name out
is taken from https://github.com/bitcoin/bitcoin/blob/v0.15.0.1/src/coins.h#L33 . So for consistency we have to keep it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand. That's for Coin
class member. Why does the CScriptCheck
member need to be named the same simply because it's of the same type?
scriptPubKey(scriptPubKeyIn), amount(amountIn), | ||
ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn), error(SCRIPT_ERR_UNKNOWN_ERROR), txdata(txdataIn) { } | ||
CScriptCheck(): ptxTo(nullptr), nIn(0), nFlags(0), cacheStore(false), error(SCRIPT_ERR_UNKNOWN_ERROR) {} | ||
CScriptCheck(const CTxOut& outIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, bool cacheIn, PrecomputedTransactionData* txdataIn) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style guide says that arguments should be snake case, but I think it's fine name this outIn
to match the style of the other arguments in the constructor.
… CScriptCheck 3a131b7 Rename out to m_tx_out in CScriptCheck (Johnson Lau) e912118 [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck (Johnson Lau) Pull request description: This simplifies CScriptCheck by combining scriptPubKey and amount Tree-SHA512: 6422363cf5394c6cfefb30c1709db6def63230b809cc7697887e4a2e8c684149208edf91dd139e031b9fe732776b2db59305f77c3cba6f333b11cceb39ef0cc2
…xOut in CScriptCheck 3a131b7 Rename out to m_tx_out in CScriptCheck (Johnson Lau) e912118 [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck (Johnson Lau) Pull request description: This simplifies CScriptCheck by combining scriptPubKey and amount Tree-SHA512: 6422363cf5394c6cfefb30c1709db6def63230b809cc7697887e4a2e8c684149208edf91dd139e031b9fe732776b2db59305f77c3cba6f333b11cceb39ef0cc2
…xOut in CScriptCheck 3a131b7 Rename out to m_tx_out in CScriptCheck (Johnson Lau) e912118 [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck (Johnson Lau) Pull request description: This simplifies CScriptCheck by combining scriptPubKey and amount Tree-SHA512: 6422363cf5394c6cfefb30c1709db6def63230b809cc7697887e4a2e8c684149208edf91dd139e031b9fe732776b2db59305f77c3cba6f333b11cceb39ef0cc2
…xOut in CScriptCheck 3a131b7 Rename out to m_tx_out in CScriptCheck (Johnson Lau) e912118 [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck (Johnson Lau) Pull request description: This simplifies CScriptCheck by combining scriptPubKey and amount Tree-SHA512: 6422363cf5394c6cfefb30c1709db6def63230b809cc7697887e4a2e8c684149208edf91dd139e031b9fe732776b2db59305f77c3cba6f333b11cceb39ef0cc2
…xOut in CScriptCheck 3a131b7 Rename out to m_tx_out in CScriptCheck (Johnson Lau) e912118 [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck (Johnson Lau) Pull request description: This simplifies CScriptCheck by combining scriptPubKey and amount Tree-SHA512: 6422363cf5394c6cfefb30c1709db6def63230b809cc7697887e4a2e8c684149208edf91dd139e031b9fe732776b2db59305f77c3cba6f333b11cceb39ef0cc2
…xOut in CScriptCheck 3a131b7 Rename out to m_tx_out in CScriptCheck (Johnson Lau) e912118 [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck (Johnson Lau) Pull request description: This simplifies CScriptCheck by combining scriptPubKey and amount Tree-SHA512: 6422363cf5394c6cfefb30c1709db6def63230b809cc7697887e4a2e8c684149208edf91dd139e031b9fe732776b2db59305f77c3cba6f333b11cceb39ef0cc2
…xOut in CScriptCheck 3a131b7 Rename out to m_tx_out in CScriptCheck (Johnson Lau) e912118 [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck (Johnson Lau) Pull request description: This simplifies CScriptCheck by combining scriptPubKey and amount Tree-SHA512: 6422363cf5394c6cfefb30c1709db6def63230b809cc7697887e4a2e8c684149208edf91dd139e031b9fe732776b2db59305f77c3cba6f333b11cceb39ef0cc2
… in CScriptCheck Summary: 3a131b7 Rename out to m_tx_out in CScriptCheck (Johnson Lau) e912118 [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck (Johnson Lau) Pull request description: This simplifies CScriptCheck by combining scriptPubKey and amount --- Backport of Core [[bitcoin/bitcoin#10953 | PR10953]] Test Plan: ninja check && ninja check-functional Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D6932
…CScriptCheck 2af6794 Rename out to m_tx_out in CScriptCheck (Johnson Lau) 5f6cd00 [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck (Johnson Lau) Pull request description: Straightforward. Coming from bitcoin#10953 > This simplifies CScriptCheck by combining scriptPubKey and amount ACKs for top commit: furszy: ACK 2af6794 Tree-SHA512: dbc2358315d2bbcd6313dfd41eb28c1a364e9b0b88f6b22c4b36ef3784849ccd2239fd035a784846f1ecbf90d5511d908f1df384c351c1d22d86bbb7da5d28ad
This simplifies CScriptCheck by combining scriptPubKey and amount