aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Dogecoin: Update coinbase maturityRoss Nicoll2021-05-201-1/+1
| | | | | | | * Change coinbase maturity to 240 blocks in most cases, with main/test early chains allowing 30 blocks. I've kept the 240 consistent in regtest to avoid having to redesign a lot of the test cases. * Disabled mining unit test which require COINBASE_MATURITY worth of pre-calculated blocks, as we'd otherwise be constantly refactoring them. * Moved functional test which uses the Bitcoin testnet block data as its reference, as it completely breaks as we introduce Dogecoin data. * Updated standard blockchains for tests from 100/200 to 240/480 as appropriate.
* Add 'sequence' zmq publisher to track all block (dis)connects, mempool deltasGregory Sanders2020-09-221-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using the zmq notifications to avoid excessive mempool polling can be difficult given the current notifications available. It announces all transactions being added to mempool or included in blocks, but announces no evictions and gives no indication if the transaction is in the mempool or a block. Block notifications for zmq are also substandard, in that it only announces block tips, while all block transactions are still announced. This commit adds a unified stream which can be used to closely track mempool: 1) getrawmempool to fill out mempool knowledge 2) if txhash is announced, add or remove from set based on add/remove flag 3) if blockhash is announced, get block txn list, remove from those transactions local view of mempool 4) if we drop a sequence number, go to (1) The mempool sequence number starts at the value 1, and increments each time a transaction enters the mempool, or is evicted from the mempool for any reason, including block inclusion. The mempool sequence number is published via ZMQ for any transaction-related notification. These features allow for ZMQ/RPC consumer to track mempool state in a more exacting way, without unnecesarily polling getrawmempool. See interface_zmq.py::test_mempool_sync for example usage.
* Get rid of unused functions CTxMemPool::GetMemPoolChildren, ↵Jeremy Rubin2020-09-041-12/+0
| | | | CTxMemPool::GetMemPoolParents
* Remove mapLinks in favor of entry inlined structs with iterator type erasureJeremy Rubin2020-09-041-90/+91
|
* refactor: CTxMemPool::ClearPrioritisation() requires CTxMemPool::cs lockHennadii Stepanov2020-09-011-2/+2
| | | | | No change in behavior, the lock is already held at call sites. Also `const uint256` refactored to `const uint256&`.
* refactor: CTxMemPool::ApplyDelta() requires CTxMemPool::cs lockHennadii Stepanov2020-09-011-2/+2
| | | | | No change in behavior, the lock is already held at call sites. Also `const uint256` refactored to `const uint256&`.
* refactor: CTxMemPool::UpdateChild() requires CTxMemPool::cs lockHennadii Stepanov2020-09-011-0/+1
| | | | No change in behavior, the lock is already held at call sites.
* refactor: CTxMemPool::UpdateParent() requires CTxMemPool::cs lockHennadii Stepanov2020-09-011-0/+1
| | | | No change in behavior, the lock is already held at call sites.
* refactor: make txmempool interface use GenTxidPieter Wuille2020-07-301-2/+4
|
* Add a wtxid-index to the mempoolSuhas Daftuar2020-07-181-7/+7
|
* wallet: Minimal fix to restore conflicted transaction notificationsRussell Yanofsky2020-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | | This fix is a based on the fix by Antoine Riard <[email protected]> in https://github.com/bitcoin/bitcoin/pull/18600. Unlike that PR, which implements some new behavior, this just restores previous wallet notification and status behavior for transactions removed from the mempool because they conflict with transactions in a block. The behavior was accidentally changed in two `CWallet::BlockConnected` updates: a31be09bfd77eed497a8e251d31358e16e2f2eb1 and 7e89994133725125dddbfa8d45484e3b9ed51c6e from https://github.com/bitcoin/bitcoin/pull/16624, causing issue https://github.com/bitcoin/bitcoin/issues/18325. The change here could be improved and replaced with a more comprehensive cleanup, so it includes a detailed comment explaining future considerations. Fixes #18325 Co-authored-by: Antoine Riard <[email protected]>
* Merge #18038: P2P: Mempool tracks locally submitted transactions to improve ↵fanquake2020-04-291-0/+11
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wallet privacy 50fc4df6c4e8a84bdda13ade7bed7a2131796f00 [mempool] Persist unbroadcast set to mempool.dat (Amiti Uttarwar) 297a1785360c4db662a7f3d3ade7b6b503258d39 [test] Integration tests for unbroadcast functionality (Amiti Uttarwar) 6851502472d3625416f0e7796e9f2a0379d14d49 [refactor/test] Extract P2PTxInvStore into test framework (Amiti Uttarwar) dc1da48dc5e5526215561311c184a8cbc345ecdc [wallet] Update the rebroadcast frequency to be ~1/day. (Amiti Uttarwar) e25e42f20a3aa39651fbc1f9fa3df1a49f1f5868 [p2p] Reattempt initial send of unbroadcast transactions (Amiti Uttarwar) 7e93eecce3bc5a1b7bb0284e06f9e2e69454f5ba [util] Add method that returns random time in milliseconds (Amiti Uttarwar) 89eeb4a3335f8e871cc3f5286af4546dff66172a [mempool] Track "unbroadcast" transactions (Amiti Uttarwar) Pull request description: This PR introduces mempool tracking of unbroadcast transactions and periodic reattempts at initial broadcast. This is a part of the rebroadcast project, and a standalone privacy win. The current rebroadcast logic is terrible for privacy because 1. only the source wallet rebroadcasts transactions and 2. it does so quite frequently. In the current system, if a user submits a transaction that does not immediately get broadcast to the network (eg. they are offline), this "rebroadcast" behavior is the safety net that can actually serve as the initial broadcast. So, keeping the attempts frequent is important for initial delivery within a reasonable timespan. This PR aims to improve # 2 by reducing the wallet rebroadcast frequency to ~1/day from ~1/15 min. It achieves this by separating the notion of initial broadcast from rebroadcasts. With these changes, the mempool tracks locally submitted transactions & periodically reattempts initial broadcast. Transactions submitted via the wallet or RPC are added to an "unbroadcast" set & are removed when a peer sends a `getdata` request, or the transaction is removed from the mempool. Every 10-15 minutes, the node reattempts an initial broadcast. This enables reducing the wallet rebroadcast frequency while ensuring the transactions will be propagated to the network. For privacy improvements around # 1, please see #16698. Thank you to gmaxwell for the idea of how to break out this subset of functionality (https://github.com/bitcoin/bitcoin/pull/16698#issuecomment-571399346) ACKs for top commit: fjahr: Code review ACK 50fc4df6c4e8a84bdda13ade7bed7a2131796f00 MarcoFalke: ACK 50fc4df6c4e8a84bdda13ade7bed7a2131796f00, I think this is ready for merge now 👻 amitiuttarwar: The current tip `50fc4df` currently has 6 ACKs on it, so I've opened #18807 to address the last bits. jnewbery: utACK 50fc4df6c4e8a84bdda13ade7bed7a2131796f00. ariard: Code Review ACK 50fc4df (minor points no need to invalid other ACKs) robot-visions: ACK 50fc4df6c4e8a84bdda13ade7bed7a2131796f00 sipa: utACK 50fc4df6c4e8a84bdda13ade7bed7a2131796f00 naumenkogs: utACK 50fc4df Tree-SHA512: 2dd935d645d5e209f8abf87bfaa3ef0e4492705ce7e89ea64279cb27ffd37f4727fa94ad62d41be331177332f8edbebf3c7f4972f8cda10dd951b80a28ab3c0f
| * [mempool] Track "unbroadcast" transactionsAmiti Uttarwar2020-04-231-0/+11
| | | | | | | | | | | | - Mempool tracks locally submitted transactions (wallet or rpc) - Transactions are removed from set when the node receives a GETDATA request from a peer, or if the transaction is removed from the mempool.
* | scripted-diff: Bump copyright headersMarcoFalke2020-04-161-1/+1
|/ | | | | | -BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
* [mempool] Remove NotifyEntryAdded and NotifyEntryRemoved callbacksJohn Newbery2020-03-111-4/+1
| | | | | | | | | | | | NotifyEntryAdded never had any subscribers so can be removed. Since ConnectTrace no longer subscribes to NotifyEntryRemoved, there are now no subscribers. The CValidationInterface TransactionAddedToMempool and TransactionRemovedFromMempool methods can now provide this functionality. There's no need for a special notifications framework for the mempool.
* [wallet] Notify conflicted transactions in TransactionRemovedFromMempoolJohn Newbery2020-03-111-1/+5
| | | | | | | | | The only CValidationInterface client that cares about transactions that are removed from the mempool because of CONFLICT is the wallet. Start using the TransactionRemovedFromMempool method to notify about conflicted transactions instead of using the vtxConflicted vector in BlockConnected.
* Make UpdateTransactionsFromBlock use EpochsJeremy Rubin2020-01-141-12/+14
|
* Add Epoch Guards to CTXMemPoolEntry and CTxMemPoolJeremy Rubin2020-01-141-2/+21
|
* scripted-diff: Bump copyright of files changed in 2019MarcoFalke2019-12-301-1/+1
| | | | | | -BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
* Fire TransactionRemovedFromMempool from mempool2512019-11-211-1/+7
| | | | | This commit fires TransactionRemovedFromMempool callbacks from the mempool and cleans up a bunch of code.
* Merge #17316: refactor: Replace all uses of boost::optional with our own ↵fanquake2019-10-301-3/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optional type d314e8a818d4c162b1c7201533e6b600dcab2d91 refactor: Replace all uses of boost::optional with our own Optional type (Wladimir J. van der Laan) Pull request description: Replace all uses of boost::optional with our own Optional type. Luckily, there aren't so many. After this: - `boost::optional` is no longer used directly (only through `Optional` which is an alias for it) - `boost/optional.hpp` is only included in one place ACKs for top commit: MarcoFalke: ACK d314e8a818d4c162b1c7201533e6b600dcab2d91 practicalswift: ACK d314e8a818d4c162b1c7201533e6b600dcab2d91 -- diff looks correct + satisfying to see incremental progress towards the goal of a Boost free future :) jtimon: ACK d314e8a818d4c162b1c7201533e6b600dcab2d91 fanquake: ACK d314e8a818d4c162b1c7201533e6b600dcab2d91 Tree-SHA512: b43e0017af81b07b5851377cd09624f114510ac5b9018d037664b58ad0fc8e893e30946b61f8f5e21e39125925bf9998a81f2226b468aab2df653ee57ed3213d
| * refactor: Replace all uses of boost::optional with our own Optional typeWladimir J. van der Laan2019-10-301-3/+4
| | | | | | | | | | | | | | | | After this: - `boost::optional` is no longer used directly (only through `Optional` which is an alias for it) - `boost/optional.hpp` is only included in one place
* | [validation] Add CValidationState subclassesJohn Newbery2019-10-291-2/+2
|/ | | | | Split CValidationState into TxValidationState and BlockValidationState to store validation results for transactions and blocks respectively.
* feefilter: Compute the absolute fee rather than stored rate to match mempool ↵Gregory Sanders2019-10-031-1/+1
| | | | acceptance logic
* txmempool: Make entry time type-safe (std::chrono)MarcoFalke2019-09-231-1/+2
|
* validation: Add missing mempool locksMarcoFalke2019-06-071-8/+6
|
* txpool: Make nTransactionsUpdated atomicMarcoFalke2019-06-071-4/+2
|
* Make reasoning about dependencies easier by not including unused dependenciespracticalswift2019-06-021-2/+0
|
* mempool: remove unused magic number from consistency checkGregory Sanders2019-05-201-1/+1
|
* Merge #15323: rpc: Expose g_is_mempool_loaded via getmempoolinfoMarcoFalke2019-05-011-0/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | effe81f750 Move g_is_mempool_loaded into CTxMemPool::m_is_loaded (Ben Woosley) bb8ae2c419 rpc: Expose g_is_mempool_loaded via getmempoolinfo and /rest/mempool/info.json (Ben Woosley) Pull request description: And use it to fix a race condition in mempool_persist.py: https://travis-ci.org/Empact/bitcoin/jobs/487577243 Since e.g. getrawmempool returns errors based on this status, this enables users to test it for readiness. Fixes #12863 ACKs for commit effe81: MarcoFalke: utACK effe81f750 jnewbery: utACK effe81f7503d2ca3c88cfdea687f9f997f353e0d Tree-SHA512: 74328b0c17a97efb8a000d4ee49b9a673c2b6dde7ea30c43a6a2eff961a233351c9471f9a42344412135786c02bdf2ee1b2526651bb8fed68bd94d2120c4ef86
| * Move g_is_mempool_loaded into CTxMemPool::m_is_loadedBen Woosley2019-03-221-0/+12
| | | | | | | | So the loaded state is explicitly mempool-specific.
* | [build] Move policy settings to new src/policy/settings unitJohn Newbery2019-04-091-0/+1
|/ | | | | | | | | | | | | This moves the following policy settings functions and globals to a new src/policy/settings unit in lib_server: - `incrementalRelayFee` - `dustRelayFee` - `nBytesPerSigOp` - `fIsBareMultisigStd` These settings are only required by the node and should not be accessed by other libraries.
* rpc: Pass mempool into MempoolToJSONMarcoFalke2019-02-251-1/+1
|
* scripted-diff: Move util files to separate directory.Jim Posen2018-11-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- mkdir -p src/util git mv src/util.h src/util/system.h git mv src/util.cpp src/util/system.cpp git mv src/utilmemory.h src/util/memory.h git mv src/utilmoneystr.h src/util/moneystr.h git mv src/utilmoneystr.cpp src/util/moneystr.cpp git mv src/utilstrencodings.h src/util/strencodings.h git mv src/utilstrencodings.cpp src/util/strencodings.cpp git mv src/utiltime.h src/util/time.h git mv src/utiltime.cpp src/util/time.cpp sed -i 's/<util\.h>/<util\/system\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilmemory\.h>/<util\/memory\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilmoneystr\.h>/<util\/moneystr\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utiltime\.h>/<util\/time\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h sed -i 's/BITCOIN_UTILMEMORY_H/BITCOIN_UTIL_MEMORY_H/g' src/util/memory.h sed -i 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h sed -i 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h sed -i 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h sed -i 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am sed -i 's/utilmemory\.\(h\|cpp\)/util\/memory\.\1/g' src/Makefile.am sed -i 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am sed -i 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am sed -i 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am sed -i 's/-> util ->/-> util\/system ->/' test/lint/lint-circular-dependencies.sh sed -i 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-format-strings.py test/lint/lint-locale-dependence.sh sed -i 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh sed -i 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh sed -i 's/src\\utilstrencodings\.cpp/src\\util\\strencodings\.cpp/' build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj -END VERIFY SCRIPT-
* Pass tx pool reference into CheckSequenceLocksMarcoFalke2018-09-111-1/+1
|
* tx pool: Use class methods to hide raw map iterator impl detailsMarcoFalke2018-09-071-12/+30
|
* Merge #13249: Make objects in range declarations immutable by default. Avoid ↵Wladimir J. van der Laan2018-09-041-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | unnecessary copying of objects in range declarations. f34c8c466a0e514edac2e8683127b4176ad5d321 Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. (practicalswift) Pull request description: Make objects in range declarations immutable by default. Rationale: * Immutable objects are easier to reason about. * Prevents accidental or hard-to-notice change of value. Tree-SHA512: cad69d35f0cf8a938b848e65dd537c621d96fe3369be306b65ef0cd1baf6cc0a9f28bc230e1e383d810c555a6743d08cb6b2b0bd51856d4611f537a12e5abb8b
| * Make objects in range declarations immutable by default. Avoid unnecessary ↵practicalswift2018-08-271-3/+3
| | | | | | | | copying of objects in range declarations.
* | Merge #13792: tx pool: Avoid passing redundant hash into addUnchecked ↵Wladimir J. van der Laan2018-08-291-9/+6
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (scripted-diff) fa587773e59721e187cadc998f4dc236ad3aef0b scripted-diff: Remove unused first argument to addUnchecked (MarcoFalke) fe5c49766c0dc5beaf186d77b568361242b20d5e tx pool: Use the entry's hash instead of the one passed to addUnchecked (MarcoFalke) ddd395f968a050be5dd0ae21ba7d189b6b7f73fd Mark CTxMemPoolEntry members that should not be modified const (MarcoFalke) Pull request description: Several years ago the transaction hash was not cached. For optimization the hash was instead passed into `addUnchecked` to avoid re-calculating it. See f77654a0e9424f13cad04f82c014abd78fbb5e38 Passing in the hash is now redundant and the argument can safely be removed. Tree-SHA512: 0206b65c7a014295f67574120e8c5397bf1b1bd70c918ae1360ab093676f7f89a6f084fd2c7000a141baebfe63fe6f515559e38c4ac71810ba64f949f9c0467f
| * | scripted-diff: Remove unused first argument to addUncheckedMarcoFalke2018-07-301-3/+3
| | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- git grep -l addUnchecked | xargs sed --regexp-extended -i -e 's/addUnchecked\([^)][^,]+,\s*/addUnchecked(/g' -END VERIFY SCRIPT-
| * | tx pool: Use the entry's hash instead of the one passed to addUncheckedMarcoFalke2018-07-301-1/+1
| | |
| * | Mark CTxMemPoolEntry members that should not be modified constMarcoFalke2018-07-301-5/+2
| | |
* | | Merge #13767: Remove redundant assignments (dead stores)MarcoFalke2018-08-271-6/+1
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | dd777f3e12 Remove unused variable (practicalswift) cdf4089457 Remove redundant assignments (dead stores) (practicalswift) Pull request description: Remove redundant assignments (dead stores). Tree-SHA512: e852059b22a161c34a0f18a6a6ed798e2b35e6d2b9f23c526af0ec33e01f6a5bb1fa5ada6671ba183d7b02393ff0d397be5aa4b4e2edbd5e604c9a76ac48d249
| * | Remove redundant assignments (dead stores)practicalswift2018-08-021-6/+1
| |/
* | Move cs_main locking annotations from .cpp to .hpracticalswift2018-08-261-1/+1
| |
* | Add compile time checking for all cs_main runtime locking assertionspracticalswift2018-08-261-1/+1
| |
* | Merge #13780: 0.17: Pre-branch maintenanceWladimir J. van der Laan2018-08-081-1/+1
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | 3fc20632a3ad30809356a58d2cf0ea4a4ad4cec3 qt: Set BLOCK_CHAIN_SIZE = 220 (DrahtBot) 2b6a2f4a28792f2fe9dc1be843b1ff1ecae35e8a Regenerate manpages (DrahtBot) eb7daf4d600eeb631427c018a984a77a34aca66e Update copyright headers to 2018 (DrahtBot) Pull request description: Some trivial maintenance to avoid having to do it again after the 0.17 branch off. (The scripts to do this are in `./contrib/`) Tree-SHA512: 16b2af45e0351b1c691c5311d48025dc6828079e98c2aa2e600dc5910ee8aa01858ca6c356538150dc46fe14c8819ed8ec8e4ec9a0f682b9950dd41bc50518fa
| * Update copyright headers to 2018DrahtBot2018-07-271-1/+1
| |
* | refactor: Avoid locking tx pool cs thriceMarcoFalke2018-07-291-4/+0
| |
* | Return void instead of bool for functions that cannot failpracticalswift2018-07-271-4/+2
|/ | | | | | | | | | | | | | | | | * CBlockTreeDB::ReadReindexing(...) * CChainState::ResetBlockFailureFlags(...) * CTxMemPool::addUnchecked(...) * CWallet::LoadDestData(...) * CWallet::LoadKeyMetadata(...) * CWallet::LoadScriptMetadata(...) * CWallet::LoadToWallet(...) * CWallet::SetHDChain(...) * CWallet::SetHDSeed(...) * RemoveLocal(...) * SetMinVersion(...) * StartHTTPServer(...) * StartRPC(...) * TorControlConnection::Disconnect(...)