Commit Graph

10807 Commits

Author SHA1 Message Date
Wladimir J. van der Laan
853cd3845c util: Add ParseUInt32 and ParseUInt64
Add error and range-checking parsers for unsigned 32 and 64 bit numbers.
The 32-bit variant is required for parsing sequence numbers from the
command line in `bitcoin-tx` (see #8164 for discussion). I've thrown in
the 64-bit variant as a bonus, as I'm sure it will be needed at some
point.

Also adds tests, and updates `developer-notes.md`.
2018-10-21 23:59:08 +03:00
MarcoFalke
c6ac3b5c34 [doc] Fix doxygen comments for members 2018-10-21 23:57:58 +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
8f5935a1d8 Bump the protocol version to distinguish new banning behavior.
This allows future software that would relay compact blocks before
full validation to announce only to peers that will not ban if the
block turns out to be invalid.
2018-10-21 23:41:32 +03:00
Suhas Daftuar
f2a7a4d1ba Fix compact block handling to not ban if block is invalid 2018-10-21 23:41:27 +03:00
Suhas Daftuar
531d15ea84 [qa] Another attempt to fix race condition in p2p-compactblocks.py
sync_with_ping() only guarantees that the node has processed messages
it's received from the peer, not that block announcements from the node have
made it back to the peer.  Replace sync_with_ping() with an explicit check that
the node's tip has been announced.

Github-Pull: #8882
Rebased-From: 6976db2f4687d575e1b4bee5aaf1d93a794f23c3
2018-10-21 23:36:16 +03:00
Suhas Daftuar
90f833fe60 [qa] Fix race condition in p2p-compactblocks test
Also fix a bug in the sync_with_ping() helper function

Github-Pull: #8854
Rebased-From: b5fd666984fdb7125cb809c773b36034f32128cc
2018-10-21 23:36:07 +03:00
Suhas Daftuar
79a8a8b012 Fix broken sendcmpct test in p2p-compactblocks.py
Python lambda use was incorrect.

sendcmpct messages need to be synchronized with RPC calls to generate().

Headers need to be synced (eg with getheaders) for cmpctblock announcements
to start.

Last test omitted sending a sendcmpct message.

Github-Pull: #8739
Rebased-From: 157254a4bfdfc4ca3ad5bf2d84e82f290bd0c7f2)
2018-10-21 23:35:49 +03:00
Suhas Daftuar
1df646211a Add p2p test for BIP 152 (compact blocks) 2018-10-21 23:35:40 +03:00
lateminer
20fbff2cf4 Use commas instead of brackets in getnormalizedtxid RPC call 2018-10-19 21:14:17 +03:00
lateminer
a40209ddbd Declare nNewHeight;
main.cpp
2018-10-19 20:55:01 +03:00
Kaz Wesley
48ea3a4abe prepend license statement to indirectmap
Add statement about MIT licensing to indirectmap.h. I forgot the license
preamble when I originally wrote the file.

Github-Pull: #8414
Rebased-From: d3af342276f29d2bd162628eb4b669599633e39e
2018-10-19 20:36:52 +03:00
MarcoFalke
83c2dd1f10 Bump copyright headers to 2014 2018-10-19 20:21:37 +03:00
Matt Corallo
7ce6f6ebdb Remove duplicate nBlocksEstimate cmp (we already checked IsIBD()) 2018-10-19 20:08:41 +03:00
Gregory Maxwell
ef31caf805 Remove GetTotalBlocksEstimate and checkpoint tests that test nothing. 2018-10-19 20:04:55 +03:00
Suhas Daftuar
872628a702 Allow changing BIP9 parameters on regtest 2018-10-19 20:03:24 +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
Jorge Timón
465caa748c MOVEONLY: non-consensus: from pow to chain: 2018-10-19 19:54:08 +03:00
Pieter Wuille
3ac186a690 More efficient bitsliced rolling Bloom filter
This patch changes the implementation from one that stores 16 2-bit integers
in one uint32_t's, to one that stores the first bit of 64 2-bit integers in
one uint64_t and the second bit in another. This allows for 450x faster
refreshing and 2.2x faster average speed.
2018-10-19 19:47: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
João Barbosa
b8003b2bd3 Improve EncodeBase58 performance 2018-10-19 19:44:56 +03:00
MarcoFalke
733f17114c [amount] tests: Fix off-by-one mistake 2018-10-19 19:43:40 +03:00
MarcoFalke
f36643ec2d [amount] test negative fee rates and full constructor 2018-10-19 19:42:51 +03:00
MarcoFalke
74ec1d8c8a [qa] Add amount tests 2018-10-19 19:42:40 +03:00
MarcoFalke
fb9c7896c4 [amount] Add support for negative fee rates 2018-10-19 19:40:44 +03:00
lateminer
b51c500e6e Replace remaining Lore mentions with Blackmore 2018-10-19 01:09:44 +03:00
lateminer
970a285dc2 Doxyfile: v2.12.2 2018-10-19 00:55:13 +03:00
lateminer
1874993043 Fix multiple backporting errors 2018-10-19 00:54:22 +03:00
Pavel Janík
8b2e1d8a04 Do not shadow member variables 2018-10-19 00:03:18 +03:00
Cory Fields
9d9499fd40 net: fixup nits 2018-10-19 00:03:01 +03:00
Cory Fields
819f4b8dfe net: Split resolving out of CSubNet 2018-10-19 00:01:51 +03:00
Cory Fields
116718f5d5 net: move CNetAddr/CService/CSubNet out of netbase 2018-10-18 23:56:44 +03:00
21E14
7efc89cd18 CCoinsViewErrorCatcher raison-d-etre 2018-10-18 23:40:49 +03:00
Patrick Strateman
c312b47cce Acquire lock to check for genesis block. 2018-10-18 23:40:08 +03:00
instagibbs
1b6cba2d1f Add cmpctblock to debug help list
Github-Pull: #8637
Rebased-From: b2e93a343ec2dc7d255b970e6ee45e9c390f7ed0
2018-10-18 23:38:58 +03:00
Gregory Maxwell
8bbe525e02 Use RelevantServices instead of node_network in AttemptToEvict.
Use of node_network here is really meant to be a proxy of "likely to
 send us blocks in the future".  RelevantServices is the right criteria
 now.

Github-Pull: #9052
Rebased-From: d32036a47d9ccdc38628a7a75bb8b711af462e4f
2018-10-18 23:33:16 +03:00
MarcoFalke
5ef877ba8f [net] Remove assert(nMaxInbound > 0)
nMaxInbound might very well be 0 or -1, if the user prefers to keep
a small number of maxconnections.

Note: nMaxInbound of -1 means that the user set maxconnections
to 8 or less, but we still want to keep an additional slot for
the feeler connection.

Github-Pull: #9008
Rebased-From: fa1c3c2eb0a1853ed0e0662fc2bdbca51e05ccf5
2018-10-18 23:32:56 +03:00
Wladimir J. van der Laan
a14ed45674 nMaxOutbound is MAX_OUTBOUND_CONNECTIONS on 0.13
Github-Pull: #8949
2018-10-18 23:32:46 +03:00
Gregory Maxwell
7b0cd213fc Make dnsseed's definition of acute need include relevant services.
We normally prefer to connect to peers offering the relevant services.

If we're not connected to enough peers with relevant services, we
 probably don't know about them and could use dnsseed's help.

Github-Pull: #8949
Rebased-From: 46304791353d2bb61004a035869612620c30b4eb
2018-10-18 23:32:37 +03:00
Gregory Maxwell
784ceae891 Be more aggressive in connecting to peers with relevant services.
Only allow skipping relevant services until there are four outbound
 connections up.

This avoids quickly filling up with peers lacking the relevant
 services when addrman has few or none of them.

Github-Pull: #8949
Rebased-From: 9583477288072e203541b747fcffe8d50cfefb8d
2018-10-18 23:32:28 +03:00
Matt Corallo
a72b866b00 Remove bogus assert on number of oubound connections.
This value can be significantly higher if the users uses addnode

Github-Pull: #8944
Rebased-From: 1ab21cf344ed0547de5ae679b7e479cb4b1a923b
2018-10-18 23:32:18 +03:00
Matt Corallo
4faf4c99f7 Comment that most dnsseeds only support some service bits combos 2018-10-18 23:32:08 +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
Wladimir J. van der Laan
c808450d87 http: Force-exit event loop after predefined time
This makes sure that the event loop eventually terminates, even if an
event (like an open timeout, or a hanging connection) happens to be
holding it up.
2018-10-18 23:12:41 +03:00
Wladimir J. van der Laan
d57bd81ce6 http: Restrict maximum size of request line + headers
Prevent memory exhaustion by sending lots of data.
Also add a test to `httpbasics.py`.

Closes #6425
2018-10-18 23:12:06 +03:00
Cory Fields
84a208b9d2 net: Have LookupNumeric return a CService directly 2018-10-18 23:10:38 +03:00
Cory Fields
327528fbf1 httpserver: replace boost threads with std
along with mutex/condvar/bind/etc.

httpserver handles its own interruption, so there's no reason not to use std
threading.

While we're at it, may as well kill the BOOST_FOREACH's as well.
2018-10-18 23:08:28 +03:00
Cory Fields
75050e103d httpserver: explicitly detach worker threads
When using std::thread in place of boost::thread, letting the threads destruct
results in a std::terminate. According to the docs, the same thing should be
be happening in later boost versions:
http://www.boost.org/doc/libs/1_55_0/doc/html/thread/thread_management.html#thread.thread_management.thread.destructor

I'm unsure why this hasn't blown up already, but explicitly detaching can't
hurt.
2018-10-18 23:08:19 +03:00
Cory Fields
09d5672a7d httpserver: use a future rather than relying on boost's try_join_for 2018-10-18 23:08:10 +03:00