Commit Graph

159 Commits

Author SHA1 Message Date
lateminer
55729c2f6e Update to Core 0.13.2 2018-11-14 19:43:28 +03:00
lateminer
bb407424fa Remove relaying of double-spends 2018-10-25 20:37:40 +03:00
lateminer
74cf4b83e5 Refactor CreateNewBlock to be a method of the BlockAssembler class 2018-10-23 01:15:28 +03:00
21E14
69de80c238 Remove obsolete reference to CValidationState from UpdateCoins. 2018-10-22 00:40:59 +03:00
Pieter Wuille
834db9539b Get rid of CTxMempool::lookup() entirely 2018-10-17 20:51:51 +03:00
Pieter Wuille
ab86d7e4ff Switch CTransaction storage in mempool to std::shared_ptr 2018-10-17 20:34:25 +03:00
Gregory Maxwell
16b0e12385 Do not use mempool for GETDATA for tx accepted after the last mempoolreq 2018-10-17 19:56:28 +03:00
Pieter Wuille
80803b1de0 Return mempool queries in dependency order 2018-10-17 19:45:54 +03:00
Daniel Kraft
ad0ec643b7 [trivial] Add missing const qualifiers.
Add some const qualifiers to references that are not modified and should
be marked as const.
2018-10-17 19:44:48 +03:00
Gregory Maxwell
05c3d2e290 Eliminate TX trickle bypass, sort TX invs for privacy and priority.
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.
2018-10-17 19:44:11 +03:00
Matt Corallo
b88d342f2c Provide a flat list of txid/terators to txn in CTxMemPool 2018-10-17 19:23:57 +03:00
Gregory Sanders
edf4aef1e2 reduce number of lookups in TransactionWithinChainLimit 2018-10-14 15:20:09 +03:00
Gregory Sanders
8a0d1a55f9 SelectCoinsMinConf: Prefer coins with fewer ancestors 2018-10-14 15:06:03 +03:00
Kaz Wesley
000a97ca5f replace mapNextTx with slimmer setSpends 2018-10-13 18:59:42 +03:00
lateminer
17401c86d1 Fix backporting errors
pos.cpp
primitives/transaction.cpp
rpc/rawtransaction.cpp
script/sign.cpp
script/sign.h
txmempool.cpp
2018-10-13 18:55:32 +03:00
Alex Morcos
b821da64ef Implement "feefilter" P2P message. 2018-10-13 15:44:02 +03:00
lateminer
b1bb30cb3a Remove address indexes 2018-10-11 22:02:52 +03:00
lateminer
3a29ae6903 Some code refactoring and cleanup 2018-10-02 01:04:31 +03:00
lateminer
c946ec9d9e Revert "mapNextTx: use pointer as key, simplify value"
This reverts commit 52680318bb.
2018-01-13 02:44:28 +03:00
Pieter Wuille
09ddb265d6 Stop trimming when mapTx is empty 2018-01-13 02:15:11 +03:00
Kaz Wesley
52680318bb mapNextTx: use pointer as key, simplify value 2018-01-13 02:14:46 +03:00
Suhas Daftuar
26475e2de4 Check all ancestor state in CTxMemPool::check() 2018-01-13 01:57:25 +03:00
Suhas Daftuar
b02423bdb5 Add ancestor feerate index to mempool 2018-01-13 01:57:17 +03:00
Suhas Daftuar
dcb9441105 Add ancestor tracking to mempool
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).
2018-01-13 01:57:09 +03:00
Suhas Daftuar
83568275f1 Remove work limit in UpdateForDescendants()
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.
2018-01-13 01:56:59 +03:00
Suhas Daftuar
e001fd3ea4 Rename CTxMemPool::remove -> removeRecursive 2018-01-13 01:56:51 +03:00
Suhas Daftuar
ff1f0ead66 CTxMemPool::removeForBlock now uses RemoveStaged 2018-01-13 01:53:12 +03:00
Suhas Daftuar
1e0ba49e26 Add tags to mempool's mapTx indices 2018-01-13 01:31:09 +03:00
lateminer
72875a2116 Relay double-spends, subject to anti-DOS
cef3711500 (diff-7ec3c68a81efff79b6ca22ac1f1eabbaL929)
2018-01-10 21:52:38 +03:00
lateminer
f536a8126e Replace COINBASE_MATURITY...
...with nCoinbaseMaturity
2017-12-17 15:21:59 +03:00
janko33bd
2fdd12b2ea Blackcoin Lore 2017-05-30 21:33:31 +02:00
Gregory Sanders
e1ff0dbe19 reduce number of lookups in TransactionWithinChainLimit 2016-12-20 10:10:32 +00:00
Gregory Sanders
bdd6d4c97d SelectCoinsMinConf: Prefer coins with fewer ancestors 2016-12-20 10:10:01 +00:00
Pieter Wuille
fe1975a974 Use cmpctblock type 2 for segwit-enabled transfer
Contains version negotiation logic by Matt Corallo and bugfixes by
Suhas Daftuar.

Github-Pull: #8393
Rebased-From: 6aa28abf53ef4694692474b4a3b0a8fa7559b50b
2016-10-13 20:15:17 +02:00
Pieter Wuille
b8c79a057c Precompute sighashes
Original version by Nicolas Dorier. Precomputing version by Pieter Wuille.
2016-09-07 16:42:41 +02:00
Pieter Wuille
3f65ba2b3b Treat high-sigop transactions as larger rather than rejecting them 2016-07-31 21:47:21 +02:00
Suhas Daftuar
fca1a415ce Rename "block cost" to "block weight"
Github-Pull: #8363
Rebased-From: 2c06bae39edfaa9c0855d83377ad8fda09e4fa08
2016-07-19 12:10:28 +02:00
Pieter Wuille
2b1f6f9ccf BIP141: Other consensus critical limits, and BIP145
Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
2016-06-22 15:43:00 +02:00
Matt Corallo
811902649d Provide a flat list of txid/terators to txn in CTxMemPool 2016-06-19 23:06:55 -07:00
Pieter Wuille
96806c39f4 Stop trimming when mapTx is empty 2016-06-19 01:34:57 -07:00
Braydon Fuller
c01f78375e mempool: same address and index for an input and output bug
fixes a bug that would happen when an output would match an input with
the same address and index, and would lead to the outputs not appearing
in results.
2016-06-13 11:23:30 -04:00
Braydon Fuller
4dcf3e821c mempool: fix bug with mempool address index iteration
fixes a minor bug where iteration would not end when there are matching
hashes for a p2sh and p2pkh address, and would return results for
both addresses
2016-06-13 11:23:30 -04:00
Pieter Wuille
288d85ddf2 Get rid of CTxMempool::lookup() entirely 2016-06-07 13:44:56 +02:00
Pieter Wuille
8d39d7a2cf Switch CTransaction storage in mempool to std::shared_ptr 2016-06-05 00:31:43 +02:00
Pieter Wuille
a82f03393a Merge #7997: replace mapNextTx with slimmer setSpends
9805f4a mapNextTx: use pointer as key, simplify value (Kaz Wesley)
2016-06-03 01:26:50 +02:00
Kaz Wesley
9805f4af7e mapNextTx: use pointer as key, simplify value
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-06-02 12:31:51 -07:00
Braydon Fuller
55fa4798eb main: spentindex for the mempool 2016-06-02 12:15:59 -04:00
Braydon Fuller
b66eff47cf main: mempool address index 2016-06-02 12:15:14 -04:00
Gregory Maxwell
7e908c7b82 Do not use mempool for GETDATA for tx accepted after the last mempool req.
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-25 18:05:58 +00:00
Wladimir J. van der Laan
e29cfc48fc Merge #7976: Remove obsolete reference to CValidationState from UpdateCoins.
c8b9248 Remove obsolete reference to CValidationState from UpdateCoins. (21E14)
2016-05-09 11:59:03 +02:00