Commit Graph

1363 Commits

Author SHA1 Message Date
Gregory Maxwell
8a98c894d4 Increase maximum orphan size to 100,000 bytes.
Although this increases node memory usage in the worst case by perhaps
 30MB, the current behavior causes severe issues with dependent tx relay.
2018-10-23 22:53:13 +03:00
Gregory Maxwell
e0505fced9 Treat orphans as implicit inv for parents, discard when parents rejected.
An orphan whos parents were rejected is never going to connect, so there
 is little utility in keeping it.

Orphans also helpfully tell us what we're missing, so go ahead and treat
 it as INVed.
2018-10-23 22:53:04 +03:00
Gregory Maxwell
654a62c131 Adds an expiration time for orphan tx.
This prevents higher order orphans and other junk from
 holding positions in the orphan map.  Parents delayed
 twenty minutes are more are unlikely to ever arrive.

The freed space will improve the orphan matching success rate for
 other transactions.
2018-10-23 22:52:51 +03:00
Pieter Wuille
10ae5af2c5 Track orphan by prev COutPoint rather than prev hash 2018-10-23 22:39:39 +03:00
instagibbs
61b8aea708 Rename ReconsiderBlock func to reflect real behavior 2018-10-23 22:24:41 +03:00
instagibbs
46038d59ea Remove state arg from ReconsiderBlock 2018-10-23 22:24:01 +03:00
Jorge Timón
4a2d793f2a Globals: Explicitly pass const CChainParams& to UpdateTip() 2018-10-23 22:22:50 +03:00
face
7e7f211dea Pass CChainParams to DisconnectTip() 2018-10-23 22:22:19 +03:00
Luke Dashjr
7828e48b69 Remove -enforcenodebloom 2018-10-23 22:15:45 +03:00
lateminer
afa46b1aef Use nAbsurdFee instead of maxTxFee in AcceptToMemoryPoolWorker()
main.cpp
2018-10-23 22:09:14 +03:00
lateminer
79085ea232 Add missing fMayBanPeerIfInvalid parameter in ProcessNewBlock() call
main.cpp
2018-10-22 22:37:05 +03:00
Wladimir J. van der Laan
7a11d02bde Break circular dependency main ↔ txdb
Break the circular dependency between main and txdb by:

- Moving `CBlockFileInfo` from `main.h` to `chain.h`. I think this makes
  sense, as the other block-file stuff is there too.

- Moving `CDiskTxPos` from `main.h` to `txdb.h`. This type seems
  specific to txdb.

- Pass a functor `insertBlockIndex` to `LoadBlockIndexGuts`. This leaves
  it up to the caller how to insert block indices.
2018-10-22 00:42:47 +03:00
21E14
69de80c238 Remove obsolete reference to CValidationState from UpdateCoins. 2018-10-22 00:40:59 +03:00
Jonas Schnelli
6d90c71b64 include the chaintip blockindex in the SyncTransaction signal, add signal UpdateTip() 2018-10-21 23:51:31 +03:00
Suhas Daftuar
f2a7a4d1ba Fix compact block handling to not ban if block is invalid 2018-10-21 23:41:27 +03:00
lateminer
a40209ddbd Declare nNewHeight;
main.cpp
2018-10-19 20:55:01 +03:00
Matt Corallo
7ce6f6ebdb Remove duplicate nBlocksEstimate cmp (we already checked IsIBD()) 2018-10-19 20:08:41 +03:00
Wladimir J. van der Laan
c5e913fd28 Make max tip age an option instead of chainparam 2018-10-19 19:59:49 +03:00
Pieter Wuille
3da1cf3080 Switch to a more efficient rolling Bloom filter
For each 'bit' in the filter we really maintain 2 bits, which store either:
0: not set
1-3: set in generation N

After (nElements / 2) insertions, we switch to a new generation, and wipe
entries which already had the new generation number, effectively switching
from the last 1.5 * nElements set to the last 1.0 * nElements set.

This is 25% more space efficient than the previous implementation, and can
(at peak) store 1.5 times the requested amount of history (though only
1.0 times the requested history is guaranteed).

The existing unit tests should be sufficient.
2018-10-19 19:47:22 +03:00
leijurv
e0e706c9cf various typos 2018-10-18 23:30:54 +03:00
Ethan Heilman
82072c13f8 Added feeler connections increasing good addrs in the tried table. 2018-10-18 23:26:46 +03:00
Gregory Maxwell
35c0e679b7 Add recently accepted blocks and txn to AttemptToEvictConnection.
This protects any not-already-protected peers who were the most
 recent four to relay transactions and most recent four to send
 blocks to us.
2018-10-18 22:35:51 +03:00
Pieter Wuille
cb47af78cc Introduce REQUIRED_SERVICES constant 2018-10-18 22:32:31 +03:00
Pieter Wuille
c043d2fedc Introduce enum ServiceFlags for service flags 2018-10-18 22:32:23 +03:00
Pieter Wuille
be365a0d15 Only store and connect to NODE_NETWORK nodes 2018-10-18 22:26:29 +03:00
Pieter Wuille
0c7d5a8af8 Verify that outbound connections have expected services 2018-10-18 22:26:18 +03:00
Pieter Wuille
f1d80ea69b Keep addrman's nService bits consistent with outbound observations 2018-10-18 22:26:08 +03:00
Pieter Wuille
3a1602b31d Use C++11 thread-safe static initializers 2018-10-18 21:55:20 +03:00
Gregory Maxwell
e577b5c7e1 Only send one GetAddr response per connection. 2018-10-17 22:14:44 +03:00
21E14
fcc23c5c63 Double semicolon cleanup. 2018-10-17 22:10:51 +03:00
lateminer
786436baef Make it compile 2018-10-17 21:37:53 +03:00
Pieter Wuille
834db9539b Get rid of CTxMempool::lookup() entirely 2018-10-17 20:51:51 +03:00
Pieter Wuille
2737ac3d7f Optimization: use usec in expiration and reuse nNow 2018-10-17 20:51:42 +03:00
Pieter Wuille
594213c60d Optimization: don't check the mempool at all if no mempool req ever 2018-10-17 20:51:33 +03:00
Pieter Wuille
d4e4acd906 Optimize the relay map to use shared_ptr's 2018-10-17 20:51:23 +03:00
Pieter Wuille
ab86d7e4ff Switch CTransaction storage in mempool to std::shared_ptr 2018-10-17 20:34:25 +03:00
Suhas Daftuar
0814da4e9d Only use AddInventoryKnown for transactions
filterInventoryKnown is only used when relaying transactions,
so stop adding block hashes to the filter.
2018-10-17 20:32:50 +03:00
Gregory Maxwell
b3992a38d4 Defer inserting into maprelay until just before relaying. 2018-10-17 20:32:14 +03:00
Wladimir J. van der Laan
c41e3c69aa UpdateTip: log only one line at most per block 2018-10-17 20:26:54 +03:00
Gregory Maxwell
89655c3a1e Remove unneeded feerate param from RelayTransaction/AcceptToMemoryPool. 2018-10-17 20:22:44 +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
Gregory Maxwell
c41eb3a831 Move bloom and feerate filtering to just prior to tx sending. 2018-10-17 19:47:32 +03:00
Pieter Wuille
eeded98dce Handle mempool requests in send loop, subject to trickle
By eliminating queued entries from the mempool response and responding only at
trickle time, this makes the mempool no longer leak transaction arrival order
information (as the mempool itself is also sorted)-- at least no more than
relay itself leaks it.
2018-10-17 19:45:45 +03:00
Pieter Wuille
16e9766115 Split up and optimize transaction and block inv queues 2018-10-17 19:45:37 +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
705fe53e49 Fix some minor compact block issues that came up in review 2018-10-17 19:24:21 +03:00
Matt Corallo
4e55d9962c Get our "best three" peers to announce blocks using cmpctblocks 2018-10-17 19:23:07 +03:00
Matt Corallo
0fcad61796 Add receiver-side protocol implementation for CMPCTBLOCK stuff 2018-10-17 19:20:33 +03:00
Matt Corallo
c94ec58bcf Add sender-side protocol implementation for CMPCTBLOCK stuff 2018-10-17 19:20:24 +03:00