Commit Graph

18704 Commits

Author SHA1 Message Date
Wladimir J. van der Laan
d1e98dca54
Merge #12784: Fix bug in memory usage calculation (unintended integer division)
a16c6d2 Fix error in memory usage calculation (unintended integer division) (practicalswift)

Pull request description:

  Fix bug in memory usage calculation (unintended integer division).

Tree-SHA512: 2df1f00c5282581c61e1fd55fef3fabc02161b5a47d8f1795b05d57117245ff3d1ee861dd689eebe0185f28176cea428007e799d5c43a1ce5dc704123439f967
2020-10-14 13:27:33 -04:00
Wladimir J. van der Laan
89ced17da0
Merge #12495: Increase LevelDB max_open_files
ccedbaf Increase LevelDB max_open_files unless on 32-bit Unix. (Evan Klitzke)

Pull request description:

  Currently we set `max_open_files = 64` on all architectures due to concerns about file descriptor exhaustion. This is extremely expensive due to how LevelDB is designed.

  When a LevelDB file handle is opened, a bloom filter and block index are decoded, and some CRCs are checked. Bloom filters and block indexes in open table handles can be checked purely in memory. This means that when doing a key lookup, if a given table file may contain a given key, all of the lookup operations can happen completely in RAM until the block itself is fetched. In the common case fetching the block is one disk seek, because the block index stores its physical offset. This is the ideal case, and what we want to happen as often as possible.

  If a table file handle is not open in the table cache, then in addition to the regular system calls to open the file, the block index and bloom filter need to be decoded before they can be checked. This is expensive and is something we want to avoid.

  The current setting of 64 file handles means that on a synced node, only about 4% of key lookups can be satisifed by table file handles that are actually open and in memory.

  The original concerns about file descriptor exhaustion are unwarranted on most systems because:
   * On 64-bit POSIX hosts LevelDB will open up to 1000 file descriptors using `mmap()`, and it does not retain an open file descriptor for such files.
   * On Windows non-socket files do not interfere with the main network `select()` loop, so the same fd exhaustion issues do not apply there.

  This change keeps the default `max_open_files` value (which is 1000) on all systems except 32-bit POSIX hosts (which do not use `mmap()`). Open file handles use about 20 KB of memory (for the block index), so the extra file handles do not cause much memory overhead. At most 1000 will be open, and a fully synced node right now has about 1500 such files.

  Profile of `loadblk` thread before changes: https://monad.io/maxopenfiles-master.svg
  Profile of `loadblk` thread after changes: https://monad.io/maxopenfiles-increase.svg

Tree-SHA512: de54f77d57e9f8999eaf8d12592aab5b02f5877be8fa727a1f42cf02da2693ce25846445eb19eb138ce4e5045d1c65e14054df72faf3ff32c7655c9cfadd27a9
2020-10-14 13:27:33 -04:00
Wladimir J. van der Laan
79639195ee
Merge #12811: test: Make summary row bold-red if any test failed and show failed tests at end of table
ffb033a test: List any failed tests at the end of test_runner output (Anthony Towns)
f92541f test: Make summary row bold-red if any test failed (Wladimir J. van der Laan)

Pull request description:

  Make the summary row of the test runner bold red if *any* test fails. This helps visibility if something fails.
  (yesteryday I had a snafu where I missed that `feature_blocksdir.py` had failed because it's one of the earlier tests in the list, this intends to avoid that in the future)

  Before:
  ![testfailold](https://user-images.githubusercontent.com/126646/38021100-3fbaf1c6-327c-11e8-8bae-d3ba46e77408.png)

  After:
  ![testfailnew](https://user-images.githubusercontent.com/126646/38021108-43ac7ef8-327c-11e8-8566-e52bcbaf89b8.png)

  If tests pass it still looks the same:

  ![testok](https://user-images.githubusercontent.com/126646/38021115-4a8e9954-327c-11e8-8fe4-34e889384d3e.png)

Tree-SHA512: 057748c693ca1c80840e4e4cdea8aa1baf8996f03d6805975d8e3c07c4ba0087cd8fa83f891d6bf1af0bfbba88b5d46bd5d852df340d755202bd32ae6f1034b5
2020-10-14 13:27:32 -04:00
Wladimir J. van der Laan
365d698d44
Merge #12806: qa: Fix function names in feature_blocksdir
d71bedb qa: Fix function names in feature_blocksdir (MarcoFalke)

Pull request description:

  This fixes the test failure on master:

  ```
  AttributeError: 'BlocksdirTest' object has no attribute 'assert_start_raises_init_error'
  ```

Tree-SHA512: d96a9b707a9b4fb8752b15f28dae02c60c25cbec21dca5f3ee62e2717c6a49951533c24b52ed0d6e99c5a964ef2c3e90fdc58a9104122714ae9874e121955df6
2020-10-14 13:27:32 -04:00
Wladimir J. van der Laan
f8a2413b49
Merge #12714: Introduce interface for signing providers
d40f06a Introduce interface for signing providers (Pieter Wuille)

Pull request description:

  `CKeyStore` is a rich interface that provides many features, including knowledge of scripts and pubkeys for solving, private keys for signing, in addition to watch-only keys and scripts, and distinguishing lack of keys from them just being encrypted.

  The signing logic in script/sign does not actually need most of these features. Here we introduce a simpler interface (`SigningProvider`) which *only* provides keys and scripts. This is actually sufficient for signing.

  In addtion, we swap the dependency between keystore and script/sign (keystore now depends on script/script with `CKeyStore` deriving from `SigningProvider`, rather than `CKeyStore` being the interface that signing relies on).

  This is a very early step towards the design in https://gist.github.com/sipa/125cfa1615946d0c3f3eec2ad7f250a2, separating the concern between deciding what outputs are ours and signing.

Tree-SHA512: d511b7b03eec0e513530db1d9ae5aacf6d0bfa1d3e1c03d06c5bde396bafb5824c4491b227d32bcda9288530caf49835da18e846ccf66538d6c0cc6ae27291c9
Signed-off-by: pasta <pasta@dashboost.org>

# Conflicts:
#	src/script/sign.cpp
#	src/script/sign.h
2020-10-14 13:27:32 -04:00
Wladimir J. van der Laan
9909c3aca7
Merge #12717: [REST] Handle UTXO retrieval when ignoring the mempool
9cb9af8 [REST] Handle UTXO retrieval when ignoring the mempool (Roman Zeyde)
1fdc7c4 Make CTxMemPool::isSpent() const (Roman Zeyde)

Pull request description:

  Current REST API always returns empty UTXO when invoked without `/checkmempool/` URL part.

  After the fix:
  ```
  $ curl -s http://localhost:8332/rest/getutxos/0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098-0.json | jq
  {
    "chainHeight": 514109,
    "chaintipHash": "0000000000000000001fe76d1445e8a6432fd2de04261dc9c5915311dc7ad6de",
    "bitmap": "1",
    "utxos": [
      {
        "height": 1,
        "value": 50,
        "scriptPubKey": {
          "asm": "0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee OP_CHECKSIG",
          "hex": "410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac",
          "reqSigs": 1,
          "type": "pubkey",
          "addresses": [
            "12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX"
          ]
        }
      }
    ]
  }
  ```

  Before the fix:
  ```
  $ curl -s http://localhost:8332/rest/getutxos/0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098-0.json | jq
  {
    "chainHeight": 514109,
    "chaintipHash": "0000000000000000001fe76d1445e8a6432fd2de04261dc9c5915311dc7ad6de",
    "bitmap": "0",
    "utxos": []
  }
  ```

Tree-SHA512: 994a350cb34a3c8f5a7afbc169c6b177c5be6cf223b2071c62d63644819d416d3e10d1c58b244d9d351bae7233d2974aa5e9ebadd1b5d6218f5245558675be0d
2020-10-14 13:27:31 -04:00
MarcoFalke
af08c75579
Merge #13775: doc: Remove newlines from error message
620361fce8 Fix accidental use of the addition assignment operator ("+="). Remove newlines from error message. (practicalswift)

Pull request description:

  Fix accidental use of the addition assignment operator (`+=`).

  _Note to reviewers:_ Perhaps the `\n`:s should be removed too?

Tree-SHA512: 4e8c2dfd6025d78ef9d60522297994829dacc447e6b6782e15c0bdd5dd2daa17ca9a8948bfa9a15be57d9286092356381d7e6747980303852d273eb0df0dd76b
2020-10-14 13:27:31 -04:00
Wladimir J. van der Laan
ba32ad8620
Merge #12653: Allow to optional specify the directory for the blocks storage
a192636 -blocksdir: keep blockindex leveldb database in datadir (Jonas Schnelli)
f38e4fd QA: Add -blocksdir test (Jonas Schnelli)
386a6b6 Allow to optional specify the directory for the blocks storage (Jonas Schnelli)

Pull request description:

  Since the actual block files taking up more and more space, it may be desirable to have them stored in a different location then the data directory (use case: SSD for chainstate, etc., HD for blocks).

  This PR adds a `-blocksdir` option that allows one to keep the blockfiles and the blockindex external from the data directory (instead of creating symlinks).

  I fist had an option to keep the blockindex within the datadir, but seems to make no sense since accessing the index will (always) lead to access (r/w) the block files.

Tree-SHA512: f8b9e1a681679eac25076dc30e45e6e12d4b2d9ac4be907cbea928a75af081dbcb0f1dd3e97169ab975f73d0bd15824c00c2a34638f3b284b39017171fce2409
2020-10-14 13:26:32 -04:00
UdjinM6
74f4d2a898
Merge pull request #3682 from xdustinface/backport-10244-18123
backport: bitcoin#10244, bitcoin#18123, bitcoin#12906 + Parts of bitcoin#11403
2020-10-14 20:22:55 +03:00
xdustinface
7cf7b53375 wallet: Respect chainlocks in CMerkleTx::IsLockedByInstantSend 2020-10-14 12:53:11 +01:00
xdustinface
4dca83ba25 wallet: Add CL/IS caches in CMerkleTx 2020-10-14 12:53:11 +01:00
UdjinM6
12c840f8ce Add mempool lock for Create/CommitTransaction in wallet interface
This is required to fix a (potential) deadlock
2020-10-14 12:53:11 +01:00
xdustinface
5020a68f33 qt|interfaces: Avoid redundant status update calls
- Call `statusUpdateNeeded` before `tryGetTxStatus`. This allows to run
the latter only if really required i.e. if `statusUpdateNeeded` returns true.
- Reuse `cachedNumBlocks` from `WalletModel` in `TransactionTablePriv::index()` to _actually_ avoid redundant tx status updates
- Initialize `cachedNumBlocks` and `cachedChainLockHeight` with `-1` to avoid extra `pollBalanceChanged` call
2020-10-14 12:49:36 +01:00
xdustinface
cee8c151fa scripted-diff: Merge #12906: Avoid interface keyword to fix windows gitian build
17780d6f35 scripted-diff: Avoid `interface` keyword to fix windows gitian build (Russell Yanofsky)

Pull request description:

  Rename `interface` to `interfaces`

  Build failure reported by ken2812221 in https://github.com/bitcoin/bitcoin/pull/10244#issuecomment-379434756

Tree-SHA512: e02c97c728540f344202c13b036f9f63af23bd25e25ed7a5cfe9e2c2f201a12ff232cc94a93fbe37ef6fb6bf9e036fe62210ba798ecd30de191d09338754a8d0

-BEGIN VERIFY SCRIPT-
git mv src/interface src/interfaces
ren() { git grep -l "$1" | xargs sed -i "s,$1,$2,g"; }
ren interface/            interfaces/
ren interface::           interfaces::
ren BITCOIN_INTERFACE_    BITCOIN_INTERFACES_
ren "namespace interface" "namespace interfaces"
-END VERIFY SCRIPT-
2020-10-14 12:10:12 +01:00
xdustinface
7ab1051bf0 Partially backport bitcoin#11403 2020-10-14 12:10:11 +01:00
xdustinface
79d32b5b9e test: Fix wallet tests 2020-10-14 12:10:11 +01:00
Jonas Schnelli
7c6cecaf29 Merge #18123: gui: Fix race in WalletModel::pollBalanceChanged
bf36a3ccc212ad4d7c5cb8f26d7a22e279fe3cec gui: Fix race in WalletModel::pollBalanceChanged (Russell Yanofsky)

Pull request description:

  Poll function was wrongly setting cached height to the current chain height instead of the chain height at the time of polling.

  This bug could cause balances to appear out of date, and was first introduced a0704a8996 (diff-2e3836af182cfb375329c3463ffd91f8L117). Before that commit, there wasn't a problem because cs_main was held during the poll update.

  Currently, the problem should be rare. But if 8937d99ce81a27ae5e1012a28323c0e26d89c50b from #17954 were merged, the problem would get worse, because the wrong cachedNumBlocks value would be set if the wallet was polled in the interval between a block being connected and it processing the BlockConnected notification.

  MarcoFalke also points out that a0704a8996 could lead to GUI hangs as well, because previously the pollBalanceChanged method, which runs on the GUI thread, would only make a nonblocking TRY_LOCK(cs_main) call, but after could make blocking LOCK(cs_main) calls, potentially locking up the GUI.

  Thanks to John Newbery for finding this bug this while reviewing https://github.com/bitcoin/bitcoin/pull/17954.

ACKs for top commit:
  Empact:
    utACK bf36a3ccc2
  jonasschnelli:
    utACK bf36a3c

Tree-SHA512: 1f4f229fa70a6d1fcf7be3806dca3252e86bc1755168fb421258389eb95aae67f863cb1216e6dc086b596c33560d1136215a4c87b5ff890abc8baaa3333b47f4
2020-10-14 12:10:11 +01:00
xdustinface
6088650438 test: Add boost/signals2/connection.hpp to lint-inlcudes.sh 2020-10-14 12:10:11 +01:00
xdustinface
1a5a1ca78a interface/qt: Remove direct src/privatesend calls
Refactored into interface::PrivateSend::Options and
interface::PrivateSend::Client
2020-10-14 12:09:45 +01:00
UdjinM6
eeadfe4d0b
Merge branch 'master' into merge_master_0.16.0.1 2020-10-14 03:53:50 +03:00
UdjinM6
25e26ae76f
rpc: Do not require a privkey corresponding to ownerAddress in protx register_* to be known by the wallet
This requirement was introduced in the initial implementation when we were signing protx payload with the owner key (#2246). This was changed later when we implemented external collateral references (#2366). The owner key is not used for anything in ProTxReg but to get CKeyID since then which we can do by simply decoding an address instead. This simplifies masternode registration process by letting an Operator to issue `protx register_prepare` on its own instead of asking an Owner. An Owner still have to sign the message provided by an Operator with his collateral address to prove collateral ownership (and authorize masternode registration).

Note: `protx register_*` rpc will no longer accept privkeys for ownerAddress. Some 3-rd party software like DMT might need to be patched to work correctly with nodes running with this fix.
2020-10-13 19:19:52 +03:00
Konstantin Shuplenkov
5f2305e5c8
build: create mountpoint for named volume (#3765) 2020-10-08 14:34:33 +03:00
xdustinface
555a184a6a interface/qt: Remove direct src/masterode calls
Refactored into interface::Node::Masternode
2020-10-05 15:41:38 +02:00
xdustinface
e24b6228ad interface/qt: Remove direct src/llmq calls
Refactored into interface::Node::LLMQ
2020-10-05 15:13:34 +02:00
xdustinface
6c900725c2 interface/qt: Remove direct src/evo calls
Refactored into interface::Node::EVO
2020-10-05 15:13:34 +02:00
xdustinface
3139459c71 qt|privatesend: Remove unused wallet inlcudes 2020-10-05 15:13:34 +02:00
xdustinface
07600d9aa7 qt: Cleanup in OptionsDialog
Made node sense to squash it into the related OptionsDialog commit of
the initial PR because this diff uses the wallet interface which gets
introduced one commit after the related commit.
2020-10-05 15:13:34 +02:00
Russell Yanofsky
ce41506a3e Add developer notes about blocking GUI code 2020-10-05 15:13:34 +02:00
Russell Yanofsky
1133dfc1ce Use WalletBalances struct in Qt
Suggested by John Newbery <john@johnnewbery.com>
https://github.com/bitcoin/bitcoin/pull/10244#discussion_r177504284
2020-10-05 15:13:34 +02:00
Russell Yanofsky
8549622027 Remove direct bitcoin calls from qt/sendcoinsdialog.cpp 2020-10-05 15:13:34 +02:00
Russell Yanofsky
e4e00cbbdd Remove direct bitcoin access from qt/guiutil.cpp 2020-10-05 15:13:34 +02:00
Russell Yanofsky
155324e867 Remove direct bitcoin calls from qt transaction table files 2020-10-05 15:13:34 +02:00
Russell Yanofsky
b2f7e1d1eb Remove direct bitcoin calls from qt/paymentserver.cpp 2020-10-05 15:13:34 +02:00
Russell Yanofsky
50f7d661ab Remove direct bitcoin calls from qt/addresstablemodel.cpp 2020-10-05 15:13:34 +02:00
Russell Yanofsky
7bb2d25c3d Remove direct bitcoin calls from qt/coincontroldialog.cpp 2020-10-05 15:13:34 +02:00
Russell Yanofsky
bda6fc4be9 Remove most direct bitcoin calls from qt/walletmodel.cpp 2020-10-05 15:13:31 +02:00
PastaPastaPasta
204df7bc6e
update public part of windows code signing certificate (#3749)
* update public part of windows code signing certificate

Signed-off-by: pasta <pasta@dashboost.org>

* Fixing line-breaks

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-10-05 14:57:01 +03:00
Oleg Girko
ba35dae02d
depends: Update Qt download url. (#3756)
Signed-off-by: Oleg Girko <ol@infoserver.lv>

Co-authored-by: Oleg Girko <ol@infoserver.lv>
2020-10-05 14:56:15 +03:00
Russell Yanofsky
6298c97c29 Remove direct bitcoin calls from qt/optionsdialog.cpp 2020-10-05 02:01:17 +02:00
Russell Yanofsky
a19c1f8b88 Remove direct bitcoin calls from qt/rpcconsole.cpp 2020-10-05 02:01:17 +02:00
Russell Yanofsky
80286d777a Remove direct bitcoin calls from qt/bantablemodel.cpp 2020-10-05 02:01:17 +02:00
Russell Yanofsky
59cec79288 Remove direct bitcoin calls from qt/peertablemodel.cpp 2020-10-05 02:01:17 +02:00
Russell Yanofsky
5512eca39c Remove direct bitcoin calls from qt/intro.cpp 2020-10-05 02:01:15 +02:00
Russell Yanofsky
7fe386a00f Remove direct bitcoin calls from qt/clientmodel.cpp 2020-10-03 21:36:31 +02:00
Russell Yanofsky
2856f46424 Remove direct bitcoin calls from qt/splashscreen.cpp 2020-10-03 21:36:31 +02:00
Russell Yanofsky
2fdf3d8c64 Remove direct bitcoin calls from qt/utilitydialog.cpp 2020-10-03 21:36:31 +02:00
Russell Yanofsky
50f1a6205e Remove direct bitcoin calls from qt/bitcoingui.cpp 2020-10-03 21:36:31 +02:00
Russell Yanofsky
f45e095566 Remove direct bitcoin calls from qt/optionsmodel.cpp 2020-10-03 21:36:27 +02:00
Russell Yanofsky
e709f5a45e Remove direct bitcoin calls from qt/bitcoin.cpp 2020-10-03 21:17:37 +02:00
Russell Yanofsky
98473af332 Add src/interface/README.md 2020-10-03 21:17:37 +02:00