diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-10-22 12:29:23 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-10-22 12:29:28 +0200 |
commit | c001da306b29c46ef1e7421002c3aba3ff5ed514 (patch) | |
tree | ef3e6c3ff1338e464e1581243986f3082cbddec2 /src/crc32c/CMakeLists.txt | |
parent | 4833d1fdf39fb4e3dc45b76960b769d641eca4b8 (diff) | |
parent | 4307849256761fe2440d82bbec892d0e8e6b4dd4 (diff) |
Merge bitcoin/bitcoin#23325: mempool: delete exists(uint256) function
4307849256761fe2440d82bbec892d0e8e6b4dd4 [mempool] delete exists(uint256) function (glozow)
d50fbd4c5b4bc72415854d582cedf94541a46983 create explicit GenTxid::{Txid, Wtxid} ctors (glozow)
Pull request description:
We use the same type for txids and wtxids, `uint256`. In places where we want the ability to pass either one, we distinguish them using `GenTxid`.
The (overloaded) `CTxMemPool::exists()` function is defined as follows:
```c
bool exists(const uint256& txid) const { return exists(GenTxid{false, txid}); }
```
It always assumes that a uint256 is a txid, which is a footgunny interface.
Querying by wtxid returns a false negative if the transaction has a witness. :bug:
Another approach would be to try both:
```c
bool exists(const uint256& txid) const { return exists(GenTxid{false, txid}) || exists(GenTxid{false, txid}); }
```
But that's slower and wrongfully placing the burden on the callee; the caller always knows whether the hash is a txid or a wtxid.
ACKs for top commit:
laanwj:
Code review ACK 4307849256761fe2440d82bbec892d0e8e6b4dd4
jnewbery:
Tested and code review ACK 4307849256761fe2440d82bbec892d0e8e6b4dd4
MarcoFalke:
review ACK 4307849256761fe2440d82bbec892d0e8e6b4dd4 👘
Tree-SHA512: 8ed167a96f3124b6c14e41073c8358658114ce121a15a4cca2db7a5ac565903a6236e34e88ac03382b8bb8b68e3999abbfc5718bc8c22476554d6b49a5298eec
Diffstat (limited to 'src/crc32c/CMakeLists.txt')
0 files changed, 0 insertions, 0 deletions