aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.h
AgeCommit message (Collapse)Author
2016-07-18Rename "block cost" to "block weight"Suhas Daftuar
2016-06-22BIP141: Other consensus critical limits, and BIP145Pieter Wuille
Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
2016-06-19Provide a flat list of txid/terators to txn in CTxMemPoolMatt Corallo
2016-06-07Get rid of CTxMempool::lookup() entirelyPieter Wuille
2016-06-05Switch CTransaction storage in mempool to std::shared_ptrPieter Wuille
2016-06-03Merge #7997: replace mapNextTx with slimmer setSpendsPieter Wuille
9805f4a mapNextTx: use pointer as key, simplify value (Kaz Wesley)
2016-06-02mapNextTx: use pointer as key, simplify valueKaz Wesley
Saves about 10% of application memory usage once the mempool warms up. Since the mempool is DynamicUsage-regulated, this will translate to a larger mempool in the same amount of space. Map value type: eliminate the vin index; no users of the map need to know which input of the transaction is spending the prevout. Map key type: replace the COutPoint with a pointer to a COutPoint. A COutPoint is 36 bytes, but each COutPoint is accessible from the same map entry's value. A trivial DereferencingComparator functor allows indirect map keys, but the resulting syntax is misleading: `map.find(&outpoint)`. Implement an indirectmap that acts as a wrapper to a map that uses a DereferencingComparator, supporting a syntax that accurately reflect the container's semantics: inserts and iterators use pointers since they store pointers and need them to remain constant and dereferenceable, but lookup functions take const references.
2016-05-25Do not use mempool for GETDATA for tx accepted after the last mempool req.Gregory Maxwell
The ability to GETDATA a transaction which has not (yet) been relayed is a privacy loss vector. The use of the mempool for this was added as part of the mempool p2p message and is only needed to fetch transactions returned by it.
2016-05-17Switch CTxMempool::mapTx to use a hash index for txidsPieter Wuille
2016-05-05Merge #7840: Several performance and privacy improvements to inv/mempool ↵Wladimir J. van der Laan
handling b559914 Move bloom and feerate filtering to just prior to tx sending. (Gregory Maxwell) 4578215 Return mempool queries in dependency order (Pieter Wuille) ed70683 Handle mempool requests in send loop, subject to trickle (Pieter Wuille) dc13dcd Split up and optimize transaction and block inv queues (Pieter Wuille) f2d3ba7 Eliminate TX trickle bypass, sort TX invs for privacy and priority. (Gregory Maxwell)
2016-04-30[trivial] Add missing const qualifiers.Daniel Kraft
Add some const qualifiers to references that are not modified and should be marked as const.
2016-04-20Eliminate TX trickle bypass, sort TX invs for privacy and priority.Gregory Maxwell
Previously Bitcoin would send 1/4 of transactions out to all peers instantly. This causes high overhead because it makes >80% of INVs size 1. Doing so harms privacy, because it limits the amount of source obscurity a transaction can receive. These randomized broadcasts also disobeyed transaction dependencies and required use of the orphan pool. Because the orphan pool is so small this leads to poor propagation for dependent transactions. When the bypass wasn't in effect, transactions were sent in the order they were received. This avoided creating orphans but undermines privacy fairly significantly. This commit: Eliminates the bypass. The bypass is replaced by halving the average delay for outbound peers. Sorts candidate transactions for INV by their topological depth then by their feerate (then hash); removing the information leakage and providing priority service to higher fee transactions. Limits the amount of transactions sent in a single INV to 7tx/sec (and twice that for outbound); this limits the harm of low fee transaction floods, gives faster relay service to higher fee transactions. The 7 sounds lower than it really is because received advertisements need not be sent, and because the aggregate rate is multipled by the number of peers.
2016-04-03[doc] Fix doxygen comments for membersMarcoFalke
2016-03-21Implement "feefilter" P2P message.Alex Morcos
The "feefilter" p2p message is used to inform other nodes of your mempool min fee which is the feerate that any new transaction must meet to be accepted to your mempool. This will allow them to filter invs to you according to this feerate.
2016-03-17Merge #7594: Mempool: Add tracking of ancestor packagesWladimir J. van der Laan
ce019bf Check all ancestor state in CTxMemPool::check() (Suhas Daftuar) e2eeb5d Add ancestor feerate index to mempool (Suhas Daftuar) 72abd2c Add ancestor tracking to mempool (Suhas Daftuar) 76a7632 Remove work limit in UpdateForDescendants() (Suhas Daftuar) 5de2baa Rename CTxMemPool::remove -> removeRecursive (Suhas Daftuar) 7659438 CTxMemPool::removeForBlock now uses RemoveStaged (Suhas Daftuar)
2016-03-16Merge #7187: Keep reorgs fast for SequenceLocks checksWladimir J. van der Laan
982670c Add LockPoints (Alex Morcos)
2016-03-16Add LockPointsAlex Morcos
Obtain LockPoints to store in CTxMemPoolEntry and during a reorg, evaluate whether they are still valid and if not, recalculate them.
2016-03-14Check all ancestor state in CTxMemPool::check()Suhas Daftuar
2016-03-14Add ancestor feerate index to mempoolSuhas Daftuar
2016-03-14Add ancestor tracking to mempoolSuhas Daftuar
This implements caching of ancestor state to each mempool entry, similar to descendant tracking, but also including caching sigops-with-ancestors (as that metric will be helpful to future code that implements better transaction selection in CreatenewBlock).
2016-03-14Remove work limit in UpdateForDescendants()Suhas Daftuar
The work limit served to prevent the descendant walking algorithm from doing too much work by marking the parent transaction as dirty. However to implement ancestor tracking, it's not possible to similarly mark those descendant transactions as dirty without having to calculate them to begin with. This commit removes the work limit altogether. With appropriate chain limits (-limitdescendantcount) the concern about doing too much work inside this function should be mitigated.
2016-03-14Rename CTxMemPool::remove -> removeRecursiveSuhas Daftuar
remove is no longer called non-recursively, so simplify the logic and eliminate an unnecessary parameter
2016-02-16Add tags to mempool's mapTx indicesSuhas Daftuar
2016-01-05Merge pull request #7205Wladimir J. van der Laan
fa71669 [devtools] Use git pretty-format for year parsing (MarcoFalke) fa24439 Bump copyright headers to 2015 (MarcoFalke) fa6ad85 [devtools] Rewrite fix-copyright-headers.py (MarcoFalke)
2015-12-13Bump copyright headers to 2015MarcoFalke
2015-12-02Fix mempool limiting for PrioritiseTransactionSuhas Daftuar
Redo the feerate index to be based on mining score, rather than fee. Update mempool_packages.py to test prioritisetransaction's effect on package scores.
2015-12-01Get the set of now-uncacheable-txn from CTxMemPool::TrimToSizeMatt Corallo
2015-12-01Make accessing mempool parents and children publicAlex Morcos
2015-12-01Add TxPriority class and comparatorAlex Morcos
2015-12-01Add a score index to the mempool.Alex Morcos
The score index is meant to represent the order of priority for being included in a block for miners. Initially this is set to the transactions modified (by any feeDelta) fee rate. Index improvements and unit tests by sdaftuar.
2015-12-01Store the total sig op count of a tx.Alex Morcos
Store sum of legacy and P2SH sig op counts. This is calculated in AcceptToMemory pool and storing it saves redoing the expensive calculation in block template creation.
2015-11-30Fix removeForReorg to use MedianTimePastSuhas Daftuar
2015-11-30Track coinbase spends in CTxMemPoolEntrySuhas Daftuar
This allows us to optimize CTxMemPool::removeForReorg.
2015-11-30Fix removal of time-locked transactions during reorgMatt Corallo
2015-11-19Change GetPriority calculation.Alex Morcos
Compute the value of inputs that already are in the chain at time of mempool entry and only increase priority due to aging for those inputs. This effectively changes the CTxMemPoolEntry's GetPriority calculation from an upper bound to a lower bound.
2015-11-19Modify variable names for entry height and priorityAlex Morcos
2015-11-19Remove default arguments for CTxMemPoolEntry()Alex Morcos
2015-11-27Merge pull request #6871Wladimir J. van der Laan
63b5840 Fix usage of local python-bitcoinlib (Peter Todd) 16a2f93 Fix incorrect locking of mempool during RBF replacement (Peter Todd) 97203f5 Port test to rpc-test framework (Suhas Daftuar) 20367d8 Add test for max replacement limit (Suhas Daftuar) 73d9040 Improve RBF replacement criteria (Suhas Daftuar) b272ecf Reject replacements that add new unconfirmed inputs (Peter Todd) fc8c19a Prevent low feerate txs from (directly) replacing high feerate txs (Peter Todd) 0137e6f Add tests for transaction replacement (Peter Todd) 5891f87 Add opt-in full-RBF to mempool (Peter Todd)
2015-11-16Add smart fee estimation functionsAlex Morcos
These are more useful fee and priority estimation functions. If there is no fee/pri high enough for the target you are aiming for, it will give you the estimate for the lowest target that you can reliably obtain. This is better than defaulting to the minimum. It will also pass back the target for which it returned an answer.
2015-11-10Improve RBF replacement criteriaSuhas Daftuar
Fix the calculation of conflicting size/conflicting fees.
2015-10-28Make -checkmempool=1 not fail through int32 overflowPieter Wuille
2015-10-28Merge pull request #6776Pieter Wuille
ab1f560 Support -checkmempool=N, which runs checks on average once every N transactions (Pieter Wuille)
2015-10-26fix locking issue with new mempool limitingJonas Schnelli
Current master crashes on OSX with an exception: "boost: mutex lock failed in pthread_mutex_lock: Invalid argument"
2015-10-20Support -checkmempool=N, which runs checks on average once every N transactionsPieter Wuille
2015-10-14Fix comment formatting tabsMatt Corallo
2015-10-13Add reasonable test case for mempool trimmingMatt Corallo
2015-10-13Implement on-the-fly mempool size limitation.Matt Corallo
After each transaction which is added to mempool, we first call Expire() to remove old transactions, then throwing away the lowest-feerate transactions. After throwing away transactions by feerate, we set the minimum relay fee to the maximum fee transaction-and-dependant-set we removed, plus the default minimum relay fee. After the next block is received, the minimum relay fee is allowed to decrease exponentially. Its halflife defaults to 12 hours, but is decreased to 6 hours if the mempool is smaller than half its maximum size, and 3 hours if the mempool is smaller than a quarter its maximum size. The minimum -maxmempool size is 40*-limitdescendantsize, as it is easy for an attacker to play games with the cheapest -limitdescendantsize transactions. -maxmempool defaults to 300MB. This disables high-priority transaction relay when the min relay fee adjustment is >0 (ie when the mempool is full). When the relay fee adjustment drops below the default minimum relay fee / 2 it is set to 0 (re-enabling priority-based free relay).
2015-10-13Track (and define) ::minRelayTxFee in CTxMemPoolMatt Corallo
2015-10-13Fix calling mempool directly, instead of pool, in ATMPMatt Corallo
2015-10-13Add Mempool Expire function to remove old transactionsPieter Wuille
(note the 9x multiplier on (void*)'s for CTxMemPool::DynamicMemoryUsage was accidentally introduced in 5add7a7 but should have waited for this commit which adds the extra index)