Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Jul 27, 2018

CheckSequenceLocks is called from ATMP and the member function CTxMemPool::removeForReorg without passing in the tx pool object that is used in those function's scope and instead using the global ::mempool instance.

This fix should be refactoring only, since currently there is only one (global) tx pool in normal operation. Though, it fixes hard to track down issues in future settings where more than one mempool exists at a time. (E.g. for tests, rpc or p2p tx relay purposes)

@maflcko
Copy link
Member Author

maflcko commented Jul 30, 2018

This is required for and split off of #13804

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 1, 2018

Reviewers, this pull request conflicts with the following ones:

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.

@promag
Copy link
Contributor

promag commented Aug 1, 2018

Tested ACK fad3b321.

@maflcko maflcko force-pushed the Mf1807-txPoolValidation branch from fa287b8 to fa511e8 Compare September 11, 2018 16:08
Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

utACK fac9539. Change is simple and looks good if needed for #13804.

@maflcko
Copy link
Member Author

maflcko commented Sep 17, 2018

@ryanofsky It seems the commit you reviewed is unrelated to this pull request?

@ryanofsky
Copy link
Contributor

@ryanofsky It seems the commit you reviewed is unrelated to this pull request?

utACK fa511e8, pasted the wrong hash previously

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

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

utACK fa511e8.

bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp, bool useExistingLockPoints)
bool CheckSequenceLocks(const CTxMemPool& pool, const CTransaction& tx, int flags, LockPoints* lp, bool useExistingLockPoints)
{
AssertLockHeld(cs_main);
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated to this PR, but couldn't this AssertLockHeld be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, but I think we want to keep these for now, since not all compilers support these compile-time annotations and sometimes they have to be disabled due to shortcomings.

Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand, the annotation is incomplete, missing pool.cs?

Copy link
Member Author

Choose a reason for hiding this comment

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

True, but should be done in a separate pull, since the changes required are non-trivial (more than one line)

Copy link
Contributor

Choose a reason for hiding this comment

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

In order to add that annotation txmempool.h must be included in validation.h and I'm not sure if that is correct because of the circular dependency "txmempool -> validation -> txmempool". I don't know what is the plan here but I think mempool should not depend on validation or am I wrong?

@maflcko maflcko merged commit fa511e8 into bitcoin:master Oct 27, 2018
@maflcko maflcko deleted the Mf1807-txPoolValidation branch October 27, 2018 14:42
maflcko pushed a commit that referenced this pull request Oct 27, 2018
fa511e8 Pass tx pool reference into CheckSequenceLocks (MarcoFalke)

Pull request description:

  `CheckSequenceLocks` is called from ATMP and the member function `CTxMemPool::removeForReorg` without passing in the tx pool object that is used in those function's scope and instead using the global `::mempool` instance.

  This fix should be refactoring only, since currently there is only one (global) tx pool in normal operation. Though, it fixes hard to track down issues in future settings where more than one mempool exists at a time. (E.g. for tests, rpc or p2p tx relay purposes)

Tree-SHA512: f0804588c7d29bb6ff05ec14f22a16422b89ab31ae714f38cd07f811d7dc7907bfd14e799c4c1c3121144ff22711019bbe9212b39e2fd4531936a4119950fa49
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 11, 2019
Summary:
`CheckSequenceLocks` is called from ATMP and the member function `CTxMemPool::removeForReorg` without passing in the tx pool object that is used in those function's scope and instead using the global `::mempool` instance.

Backport of Bitcoin Core PR13783
bitcoin/bitcoin#13783

Test Plan:
```
make check-all
```

Reviewers: Fabien, #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D4178
jonspock pushed a commit to jonspock/devault that referenced this pull request Dec 27, 2019
Summary:
`CheckSequenceLocks` is called from ATMP and the member function `CTxMemPool::removeForReorg` without passing in the tx pool object that is used in those function's scope and instead using the global `::mempool` instance.

Backport of Bitcoin Core PR13783
bitcoin/bitcoin#13783

Test Plan:
```
make check-all
```

Reviewers: Fabien, #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D4178
jonspock pushed a commit to devaultcrypto/devault that referenced this pull request Dec 29, 2019
Summary:
`CheckSequenceLocks` is called from ATMP and the member function `CTxMemPool::removeForReorg` without passing in the tx pool object that is used in those function's scope and instead using the global `::mempool` instance.

Backport of Bitcoin Core PR13783
bitcoin/bitcoin#13783

Test Plan:
```
make check-all
```

Reviewers: Fabien, #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D4178
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Jul 26, 2021
…uenceLocks

fa511e8 Pass tx pool reference into CheckSequenceLocks (MarcoFalke)

Pull request description:

  `CheckSequenceLocks` is called from ATMP and the member function `CTxMemPool::removeForReorg` without passing in the tx pool object that is used in those function's scope and instead using the global `::mempool` instance.

  This fix should be refactoring only, since currently there is only one (global) tx pool in normal operation. Though, it fixes hard to track down issues in future settings where more than one mempool exists at a time. (E.g. for tests, rpc or p2p tx relay purposes)

Tree-SHA512: f0804588c7d29bb6ff05ec14f22a16422b89ab31ae714f38cd07f811d7dc7907bfd14e799c4c1c3121144ff22711019bbe9212b39e2fd4531936a4119950fa49
@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.

4 participants