Commit Graph

1664 Commits

Author SHA1 Message Date
Michel van Kessel
cd0660e7b8 Fix typo in strMessageMagic 2020-11-19 17:48:32 +01:00
Justin
afc9201fb9 Set fCoinStake for view tx in ApplyTxInUndo
Prevents possible DB corruption.
2020-05-31 19:13:12 -04:00
lateminer
248fb13834 Add header spam protection 2019-04-01 23:39:03 +03:00
lateminer
5d85509142 Ban peers that fail to pass future drift check 2019-03-28 20:21:44 +03:00
lateminer
5122eecd9f Move some checks out of ConnectBlock() 2019-03-28 20:21:03 +03:00
lateminer
9148f30fbc Use IsProtocolV1RetargetingFixed(), IsProtocolV3() everywhere 2019-03-28 20:18:53 +03:00
lateminer
22febc35b6 Move PoW check to CheckBlockHeader() 2019-03-21 00:38:40 +03:00
lateminer
61362bef05 PoS: get rid of nStakeMinConfirmations, IsConfirmedInNPrevBlocks(), ReadFromDisk() 2019-03-19 23:54:30 +03:00
lateminer
03ab4fee6d Reject blocks with non-canonical signatures starting from protocol version 60016 2019-03-09 21:54:11 +03:00
lateminer
2e32c7fd02 Disable BIP152 2019-03-08 23:13:53 +03:00
Jonas Schnelli
4649292ae3 Use pindexBestHeader instead of setBlockIndexCandidates for NotifyHeaderTip() 2018-11-18 13:41:39 +03:00
lateminer
55729c2f6e Update to Core 0.13.2 2018-11-14 19:43:28 +03:00
lateminer
1cb9772c35 GetTransactionSigOpCount() has to be int64_t
main.cpp
2018-11-11 18:07:54 +03:00
lateminer
aabee84651 Add GetTransactionSigOpCount unit tests 2018-11-11 17:11:01 +03:00
Gregory Maxwell
c0c8c006aa IsInitialBlockDownload no longer uses header-only timestamps. 2018-11-10 19:55:45 +03:00
lateminer
6cdb9a7907 Set nStakeModifier correctly 2018-10-31 23:21:10 +03:00
Pieter Wuille
88c725c6ac Reformat version in UpdateTip and other messages 2018-10-25 21:06:16 +03:00
lateminer
bb407424fa Remove relaying of double-spends 2018-10-25 20:37:40 +03:00
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