Skip to content
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

Merged
merged 2 commits into from Sep 22, 2017

Conversation

jl2012
Copy link
Contributor

@jl2012 jl2012 commented Jul 30, 2017

This simplifies CScriptCheck by combining scriptPubKey and amount

@sipa
Copy link
Member

sipa commented Jul 30, 2017

Concept ACK

@NicolasDorier
Copy link
Contributor

VerifyScript shouldn't have TxOut as well instead of 2 different params ?

@TheBlueMatt
Copy link
Contributor

Concept ACK

@jl2012
Copy link
Contributor Author

jl2012 commented Jul 30, 2017

@NicolasDorier seems can't do that because scriptPubKey and nValue go to different places.

@Christewart
Copy link
Contributor

utack 3457ef1

@sipa
Copy link
Member

sipa commented Jul 31, 2017

@NicolasDorier VerifyScript knows nothing about transaction structure.

@NicolasDorier
Copy link
Contributor

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) :
Copy link
Member

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.

@afk11
Copy link
Contributor

afk11 commented Aug 6, 2017

Concept ACK

@jl2012
Copy link
Contributor Author

jl2012 commented Aug 30, 2017

rebased

@promag
Copy link
Member

promag commented Aug 30, 2017

utACK e912118.

@theuni
Copy link
Member

theuni commented Aug 31, 2017

utACK e912118

1 similar comment
@jtimon
Copy link
Contributor

jtimon commented Sep 6, 2017

utACK e912118

Copy link
Contributor

@jnewbery jnewbery left a 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;
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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.

Copy link
Contributor

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) :
Copy link
Contributor

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.

@TheBlueMatt
Copy link
Contributor

utACK e912118 (modulo it would be nice to use m_out or m_tx_out as @jnewbery suggested in CScriptCheck).

@sipa sipa merged commit 3a131b7 into bitcoin:master Sep 22, 2017
sipa added a commit that referenced this pull request Sep 22, 2017
… 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
underdarkskies referenced this pull request in underdarkskies/Ravencoin Jul 14, 2018
Revert "Rename out to m_tx_out in CScriptCheck"

This reverts commit 3a131b7.

-and-

Revert Merge #10953: [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck"
This reverts commit aeed345, reversing
changes made to c6223b3.
underdarkskies referenced this pull request in underdarkskies/Ravencoin Jul 14, 2018
…TxOut in CScriptCheck"

This reverts commit aeed345, reversing
changes made to c6223b3.
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 17, 2020
…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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 22, 2020
…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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 22, 2020
…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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 29, 2020
…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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 29, 2020
…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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 31, 2020
…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
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jul 15, 2020
… 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
furszy added a commit to PIVX-Project/PIVX that referenced this pull request May 26, 2021
…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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet