Commit Graph

1392 Commits

Author SHA1 Message Date
lateminer
ea42219781 Prettify coinstake rejecting error message in AcceptToMemoryPoolWorker()
main.cpp
2018-10-25 19:58:05 +03:00
Suhas Daftuar
7ee9a4218a Allow compactblock reconstruction when block is in flight 2018-10-24 22:40:07 +03:00
Gregory Maxwell
6689f09a0a Always drop the least preferred HB peer when adding a new one.
When a BIP152 HB-mode peer is in the least preferred position and
 disconnects, they will not be by ForNode on the next loop. They
 will continue to sit in that position and prevent deactivating
 HB mode for peers that are still connected.

There is no reason for them to stay in the list if already gone,
 so drop the first element unconditionally if there are too many.

Fixes issue #9163.

Github-Pull: #9199
Rebased-From: ca8549d2bd32f17f8b69d1edbe3f2976fba504b4
2018-10-24 22:37:48 +03:00
Russell Yanofsky
dc8f0bd8de Modify getblocktxn handler not to drop requests for old blocks 2018-10-24 22:35:37 +03:00
Matt Corallo
7796e0a7d9 Dont remove a "preferred" cmpctblock peer if they provide a block
Github-Pull: #8637
Rebased-From: 02a337defdd854efc78ecba6d1fb19cb1c075f16
2018-10-24 22:15:40 +03:00
Matt Corallo
bbc07a86bb Add missing cs_main lock to ::GETBLOCKTXN processing
Note that this is not a major issue as, in order for the missing
lock to cause issues, you have to receive a GETBLOCKTXN message
while reindexing, adding a block header via RPC, etc, which results
in either a table rehash or an insert into the bucket which you are
currently looking at.

Github-Pull: #8995
Rebased-From: dfe79060a62c8de098e75d527d97b99c3b10de50
2018-10-24 22:14:46 +03:00
Cory Fields
771b74ab4e net: fix a few cases where messages were sent rather than dropped upon disconnection
75ead758 turned these into crashes in the event of a handshake failure, most
notably when a peer does not offer the expected services.

There are likely other cases that these assertions will find as well.

Github-Pull: #8862
Rebased-From: 905bc68d05595f41cca36b3df83accd10c00cc48
2018-10-24 22:14:06 +03:00
Pavel Janík
0d1bc50056 UndoReadFromDisk works on undo files (rev), not on block files.
Github-Pull: #8737
Rebased-From: b4fb51271905f9ef39e5c2bc7e8c15e7489394a1
2018-10-24 22:09:40 +03:00
MarcoFalke
26d768db6f Use __func__ to get function name for output printing 2018-10-24 22:09:28 +03:00
Pieter Wuille
152011e50d Use a signal to continue init after genesis activation 2018-10-24 22:06:59 +03:00
Wladimir J. van der Laan
81d9a0d657 net: Ignore notfound P2P messages
Github-Pull: #8427
Rebased-From: 5c9e49d12c931f9c7ddaac0144739dcd7263e554
2018-10-24 22:01:40 +03:00
rodasmith
a02e75a50f fix op order to append first alert
Github-Pull: #8697
Rebased-From: 1d635ae61b26d1dd613c1cc1cac796627af2a31e
2018-10-24 22:01:09 +03:00
Gregory Maxwell
58d52ee75a Do not add random inbound peers to addrman.
We should learn about new peers via address messages.

An inbound peer connecting to us tells us nothing about
 its ability to accept incoming connections from us, so
 we shouldn't assume that we can connect to it based on
 this.

The vast majority of nodes on the network do not accept
 incoming connections, adding them will only slow down
 the process of making a successful connection in the
 future.

Nodes which have configured themselves to not announce would prefer we
 not violate their privacy by announcing them in GETADDR responses.
2018-10-24 22:00:45 +03:00
Pieter Wuille
fb9f18a268 Fix some locks
This makes sure that cs_filter is never held while taking cs_main
or CNode::cs_vSend.
2018-10-24 22:00:27 +03:00
Pieter Wuille
da944d430d Check for compatibility with download in FindNextBlocksToDownload 2018-10-24 21:58:31 +03:00
Suhas Daftuar
a1cc8adc8d Prevent fingerprinting, disk-DoS with compact blocks
- Ignore GETBLOCKTXN requests for unknown blocks

Don't disconnect peers, or else we leak information that could be
used for fingerprinting.

- Ignore CMPCTBLOCK messages for pruned blocks

Also ignores CMPCTBLOCK announcements that have too little work.  This is to
prevent disk-exhaustion DoS.

Github-Pull: #8408
Rebased-From: 1de2a46632946990a7863020b61172232f8c5796 1d06e49834814eed45e07393dcffd7b6683311b2
2018-10-24 21:51:43 +03:00
lateminer
bddddba7f3 Fix DoS vulnerability in mempool acceptance 2018-10-24 21:50:53 +03:00
Jonas Schnelli
c8ab3c44ef Log/report in 10% steps during VerifyDB 2018-10-24 21:39:41 +03:00
Kaz Wesley
ed20890e82 drop vAddrToSend after sending big addr message
We send a newly-accepted peer a 1000-entry addr message, and then only use
vAddrToSend for small messages. Deallocate vAddrToSend after it's been used for
the big message to save about 40 kB per connected inbound peer.
2018-10-24 21:39:30 +03:00
Kaz Wesley
1ed6d18a3c IsInitialBlockDownload: usually avoid locking
Optimistically test the latch bool before taking the lock.
For all IsInitialBlockDownload calls after the first to return false,
this avoids the need to lock cs_main.
2018-10-24 21:38:43 +03:00
instagibbs
099dbe4bb9 comment nit: miners don't vote 2018-10-24 21:37:28 +03:00
mrbandrews
ee5df5c99f Catch exceptions from non-canonical encoding and print only to log 2018-10-24 21:37:03 +03:00
Pavel Janík
a5a7b5ce44 Remove useless argument to AlertNotify. 2018-10-24 21:35:20 +03:00
Kaz Wesley
cf16a6e0d1 lock cs_main for chainActive 2018-10-24 21:31:26 +03:00
Kaz Wesley
7d7c806637 lock cs_main for State/Misbehaving
ProcessMessage calls State(...) and Misbehaving(...) without holding the
required lock; add LOCK(cs_main) blocks.
2018-10-24 21:27:36 +03:00
Alex Morcos
ee9e86ad0c Avoid unnecessary database access for unknown transactions 2018-10-24 21:22:44 +03:00
lateminer
7e41e6974f Remove redundant chainparams declaration
main.cpp
2018-10-23 23:30:04 +03:00
Pieter Wuille
1b70520ceb Align constant names for maximum compact block / blocktxn depth 2018-10-23 23:24:58 +03:00
lateminer
1534febd08 Move DEFAULT_BYTES_PER_SIGOP to policy/policy.h 2018-10-23 23:11:23 +03:00
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