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

validation: Pass tx pool reference into CheckSequenceLocks #13783

Merged
merged 1 commit into from Oct 27, 2018

Conversation

@MarcoFalke
Copy link
Member

@MarcoFalke MarcoFalke 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)

@MarcoFalke
Copy link
Member Author

@MarcoFalke MarcoFalke commented Jul 30, 2018

This is required for and split off of #13804

@DrahtBot
Copy link
Contributor

@DrahtBot DrahtBot commented Aug 1, 2018

Reviewers, this pull request conflicts with the following ones:
  • #13864 (validation: Document where we are intentionally ignoring bool return values from validation related functions by practicalswift)

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
Member

@promag promag commented Aug 1, 2018

Tested ACK fad3b321.

@MarcoFalke MarcoFalke force-pushed the Mf1807-txPoolValidation branch from fa287b8 to fa511e8 Sep 11, 2018
Copy link
Contributor

@ryanofsky ryanofsky left a comment

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

@MarcoFalke
Copy link
Member Author

@MarcoFalke MarcoFalke commented Sep 17, 2018

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

@ryanofsky
Copy link
Contributor

@ryanofsky ryanofsky commented Sep 17, 2018

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

utACK fa511e8, pasted the wrong hash previously

Copy link
Member

@promag promag left a comment

utACK fa511e8.

@@ -361,10 +361,10 @@ bool TestLockPointValidity(const LockPoints* lp)
return true;
}

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
Member

@promag promag Sep 17, 2018

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

Copy link
Member Author

@MarcoFalke MarcoFalke Sep 17, 2018

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
Member

@promag promag Sep 17, 2018

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

Copy link
Member Author

@MarcoFalke MarcoFalke Sep 17, 2018

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

Copy link
Member

@promag promag Oct 8, 2018

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?

@MarcoFalke MarcoFalke merged commit fa511e8 into bitcoin:master Oct 27, 2018
2 checks passed
@MarcoFalke MarcoFalke deleted the Mf1807-txPoolValidation branch Oct 27, 2018
MarcoFalke added a commit that referenced this issue 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 issue 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 added a commit to jonspock/devault that referenced this issue 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 added a commit to devaultcrypto/devault that referenced this issue 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 added a commit to Munkybooty/dash that referenced this issue Jul 22, 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
Munkybooty added a commit to Munkybooty/dash that referenced this issue Jul 22, 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
Munkybooty added a commit to Munkybooty/dash that referenced this issue Jul 23, 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
Munkybooty added a commit to Munkybooty/dash that referenced this issue Jul 23, 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
Munkybooty added a commit to Munkybooty/dash that referenced this issue 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
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants