9339 Commits

Author SHA1 Message Date
chromatic
b37b7e655b Attempt to evict nodes to meet the max conn count
The algorithm here is important and took some time to get right. Instead
of comparing whether the current number of connected nodes minus the
number of unevictable nodes is greater than the number of max
connections, check that:

 * there are any evictable nodes (connected nodes minus unevictable
 nodes)
 * there are more nodes connected than requested (connected nodes minus
 max connections)

While we could wait for nodes to disconnect organically, it's more
important to run the eviction logic frequently enough that we can tell
when it will have an effect.

Whitelisted connections and protected inbound connections are
unevictable, and max connections should account for inbound connections.

Because the evictor will never evict protected inbound connections, the
maximum connection count should always be at least as large as the
protected connection count.

Note that the tests for this use a delay and test that the delay has not
expired. This helps improve determinism in the testing. Otherwise, a
strict test for a fixed number of disconnections is susceptible to
things like CPU jitter, especially when running through CI.

Patrick ran this test for 1000 runs on busy CPUs and saw no failures.
2022-05-08 11:43:42 -07:00
chromatic
b277b68eb4 Set maximum/minimum connection thresholds
This uses the constant in src/net.h for the minimum allowed number of
connections.

The limit of new max connections is silently capped to the number of
available file descriptors. This value is not exposed in the UI or
RPC messages so as not to leak interesting or important system details.

The floor of maximum connections is set to the number of connections
required for this node to operate.
2022-05-04 17:38:03 -07:00
chromatic
4b5dcc77f6 Reduce number of connections, if needed
This makes the best attempt to reduce the number of connections by
reusing the eviction logic. This reuses the core of that algorithm at
the expense of deterministic behavior. In other words, starting with a
max connections value of 125 and then changing the max connections to 3
does not mean that this will immediately evict 122 connections.

Eventually the number of connections will reduce to the limit.

While the body of the condition will add latency to network processing,
the integer comparison between max connections and size of the
connections vector should be quick in most cases.

Note the extraction of connection disconnect/delete helpers so as to
reuse the same logic in multiple places. While this may not be strictly
necessary for the algorithm, it reduces the possibility that this entire
loop will get stuck doing busy work when trying to evict connections to
get under the maximum threshold.
2022-05-04 17:38:03 -07:00
chromatic
d871cda81a Add RPC command to set max connections 2022-05-04 17:38:03 -07:00
Old Dip Tracker
ecdba76ab3
Merge pull request #2882 from patricklodder/1.14.6-armv82crypto
build: work around ubuntu:focal libgcc-9-dev-arm64-cross issue
2022-04-27 12:32:58 -06:00
Old Dip Tracker
983ce7720f
Merge pull request #2909 from patricklodder/1.14.6-fix-rest
fix rest/getutxos endpoint for usage without mempool
2022-04-27 12:32:08 -06:00
alamshafil
71f5e6c488 Qt: Add prune setting to OptionsDialog
Make default prune size 3GB

Use GiB and MiB

Add DEFAULT_PRUNE_TARGET_GB

PruneMiBtoGB & PruneGBtoMiB
2022-04-17 16:34:55 -04:00
chromatic
67c7fefcf8 Improve translation policy
This change separates the `make translate language=...` and `make
translate_base` Makefile targets. The former is useful for translators
and the latter for core developers.

This change also rearranges flags to `lupdate` to improve utility for
both cases.

Finally, this change also documents these targets and gives more advice
on how to use them.
2022-04-07 15:56:25 -07:00
Patrick Lodder
da0e46a5a8
build: work around ubuntu focal gcc-9 arm cross issue
Ubuntu's libgcc-9-dev-arm64-cross on focal is broken: it misses
patch 8c92fcb13a4979232787f0476bf7469ccbb03617 that fixes a
mismatched "extern C" block in arm_acle.h.

We provide the patched header file in src/compat and include a
selector for it. Whenever we detect GCC 9.4, we include the
imported header rather than the system provided, broken header.

This patch can be reverted when Ubuntu has fixed
libgcc-9-dev-arm64-cross.
2022-04-07 16:17:08 +02:00
Patrick Lodder
7e727174d5
[rest] fix rest/getutxos endpoint for usage without mempool
The chain-only view from pcoinsTip was only assigned when the user
queried inclusive of mempool, but when queried without, the view
only contained an empty dummy.
2022-04-06 10:36:40 +02:00
Old Dip Tracker
08d2d5173b
Merge pull request #2754 from sinetek/displaymb
Network Tab Maximum Granularity.
2022-04-06 03:25:56 -04:00
Old Dip Tracker
d5b1719880
Merge pull request #2869 from jadijadi/fix/issue-2530-Persian-translation
Fixing Persian Translation; mainly repalcing Bitcoin with Dogecoin
2022-04-06 03:24:22 -04:00
Jadi
c1f4007c24 Fixing Persian Translation; mainly repalcing Bitcoin with Dogecoin
This fixes issue #2530 by running the `lupdate` and then reviewing the
strings. What is done is 1. replacing references to Bitcoin with Dogecoin,
2. fixing some minor typos and 3. translating some of the new strings (like tips)
2022-03-06 06:14:17 -05:00
Patrick Lodder
2a6421f79d
Merge pull request #2770 from just-an-dev/add-blockhashbyheight-to-rest-interface
add blockhashbyheight to rest interface
2022-02-13 22:30:57 -04:00
Patrick Lodder
24a20ed523
Merge pull request #2778 from chromatic/fix-qt-high-dpi-scaling
Fix QT high DPI scaling
2022-01-20 09:44:23 -04:00
Patrick Lodder
3024da3d6b
Merge pull request #2765 from rnicoll/1.14.6-fix-wallet-charbool
Fix Char as Bool in interfaces
2022-01-20 09:43:31 -04:00
Patrick Lodder
646b1149dc
Merge pull request #2779 from dogespacewizard/patch-2
Partial Translations for Korean
2022-01-16 18:17:19 -04:00
dogespacewizard
01f9baea35 a couple more additional translations im able to do 2022-01-10 23:39:56 +09:00
just-an-dev
5f5efffd11 add blockhashbyheight to rest interface 2022-01-04 00:47:22 +01:00
dogespacewizard
330c9c7ad4
Update bitcoin_ko_KR.ts 2021-12-25 19:28:25 +09:00
dogespacewizard
9e45c10449
Partial Translations for Korean
not a coder, ive added some translations for some lines that weren't translated i dont understand some of the stuff so i've left these untouched
2021-12-25 19:26:09 +09:00
chromatic
dae2b2626f Initialize Qt high DPI scaling appropriately
Refers to Bitcoin PR16524 by hebasto:

https://github.com/bitcoin/bitcoin/pull/16254

Addresses GH #2776.
2021-12-24 23:43:43 -08:00
Patrick Lodder
96af810b53
bench: add scrypt
Add an scrypt benchmark that hashes 80 byte inputs (size of a
block header)
2021-12-20 15:45:15 -04:00
Jeremy Rubin
3f64119177 Fix Char as Bool in interfaces 2021-12-19 18:08:04 +00:00
Ross Nicoll
da8dae3eb3
Merge pull request #2756 from patricklodder/1.14.6-fix-nlocktime-leak
Avoid leaking locktime fingerprint when anti-fee-sniping
2021-12-19 16:45:59 +00:00
Ross Nicoll
190d48e487
Merge pull request #2757 from patricklodder/1.14.6-uninit-scopeid
net: Ensure every CNetAddr constructor initializes the scopeId field
2021-12-19 11:50:47 +00:00
Ross Nicoll
e4e3371b6f
Merge pull request #2759 from patricklodder/1.14.6-initialize-counters
net: avoid uninitialized reads on counters
2021-12-19 11:36:28 +00:00
Patrick Lodder
39a476dcb2
net: avoid uninitialized reads on counters
Initialize CConnman byte counters during construction, so that
GetTotalBytesRecv() and GetTotalBytesSent() methods don't return
garbage before Start() is called, in QT.

Backported from: 8313fa8e
Original author: Russell Yanofsky <russ@yanofsky.org>
2021-12-17 19:45:45 -04:00
MarcoFalke
cd0444871e
wallet: Avoid leaking locktime fingerprint when anti-fee-sniping
Cherry-picked from: fa48baf23

Conflicts:
- Missing chain().lock(), moved assignment until after locking
  cs_main.
- Different structure and version of test framework required:
  - Different block heights
  - Different way of documenting test steps
  - Removal of wallet check, our tests don't run without a wallet
2021-12-17 16:26:07 -04:00
Kaz Wesley
b31dbd9dba
fix uninitialized read when stringifying an addrLocal
Reachable from either place where SetIP is used when our best-guess
addrLocal for a peer is IPv4, but the peer tells us it's reaching us at
an IPv6 address.

In that case, SetIP turns an IPv4 address into an IPv6 address without
setting the scopeId, which is subsequently read in GetSockAddr during
CNetAddr::ToStringIP and passed to getnameinfo. Fix by ensuring every
constructor initializes the scopeId field with something.

Cherry-picked from: b7b36dec
2021-12-17 16:19:41 -04:00
Kaz Wesley
ee4f7fbc13
add test demonstrating addrLocal UB
Cherry-picked from: 8ebbef01

Conflicts: missing MakeUnique, replaced with manual new CNode()
2021-12-17 16:19:07 -04:00
practicalswift
bfdaf2d269
rpc: Fix data race (UB) in InterruptRPC()
Cherry-picked from: 6c10037f7
2021-12-17 15:45:20 -04:00
sinetek
c8386eaf91 Display historical sent/received data on the Peers tab even if it goes beyond 1GB. Display in MB. 2021-12-17 16:30:34 +01:00
Michi Lumin
7019ead6a1
Merge pull request #2687 from edtubbs/1.14.6-dev
[feat] Added ARMv8 SHA support
2021-12-11 13:07:22 -07:00
Ed Tubbs
be9df91a4d Updated ARMv8 intrinsics for SHA-512
Updated cross build for ci environment
Updated experimental build to focal
Unified cross and native ARMv8.2 build options
Updated experimental build in ci
2021-12-08 19:24:49 -06:00
Ross Nicoll
2bc100ad10
Merge pull request #2727 from patricklodder/1.14.6-fix-msghdr-warn
backport: Fail instead of truncate command name in CMessageHeader constructor
2021-12-04 07:42:31 +00:00
Wladimir J. van der Laan
3fd3563d0a
net: Fail instead of truncate command name in CMessageHeader
Replace the memset/strncpy dance in `CMessageHeader::CMessageHeader`
with explicit code that copies then name and asserts the length.

This removes a warning in g++ 9.1.1 and IMO makes the code more readable
by not relying on strncpy padding and silent truncation behavior.

Cherry-picked from: b837b33
2021-11-29 20:08:15 +01:00
Wladimir J. van der Laan
87946deb94 build: Update build system for new leveldb
Upstream leveldb switched build systems, which means we need to define
a few different values.
2021-11-29 18:35:38 +01:00
MarcoFalke
752cb6d88d Add extra LevelDB source to Makefile 2021-11-29 18:27:05 +01:00
Chun Kuan Lee
97998bd989 build: Remove WINVER pre define in Makefile.leveldb.inlcude 2021-11-29 18:27:05 +01:00
Wladimir J. van der Laan
fd64777c4f Update to leveldb upstream using subtree merge 2021-11-29 18:27:05 +01:00
MarcoFalke
0b42af2ddb Pull leveldb subtree 2021-11-29 18:27:05 +01:00
MarcoFalke
c7f5171919 Merge leveldb subtree
Merge commit 'ec749b1bcdf2483b642fb51d635800e272c68ba6' into HEAD
2021-11-29 18:27:05 +01:00
MarcoFalke
c217773a6b Bump leveldb subtree 2021-11-29 18:27:05 +01:00
Pieter Wuille
8c4966dd66 Update LevelDB with latest Bitcoin-specific patches 2021-11-29 18:27:05 +01:00
Pieter Wuille
fc11055f0a Update to LevelDB 1.20 2021-11-29 18:27:05 +01:00
Patrick Lodder
f6bbad704f
Merge pull request #2718 from Likenttt/patch-1
fix a grammar problem
2021-11-22 14:33:22 -05:00
Chuanyi
fb2567fc6a
fix a grammar problem
Who own the private keys own the coins. -> Who owns the private keys owns the coins.
2021-11-21 16:55:26 +08:00
Ed Tubbs
3a7fef10ca Added ARMv8.2 intrinsics for SHA-512
Added build parameter for ARMv8.2
Added experimental ci build
Updated comments
2021-11-17 22:55:59 +00:00
Ross Nicoll
4b3e6529e9
Merge pull request #2693 from patricklodder/1.14.6-fix-boost-autoconf
build: change minimum boost to 1_60_0
2021-11-12 00:47:18 +00:00