Commit Graph

18058 Commits

Author SHA1 Message Date
UdjinM6
af2c411924
Merge pull request #3462 from PastaPastaPasta/backport-10740
Backport loadwallet
2020-05-11 15:29:08 +03:00
UdjinM6
ed7d8c883c
Fix autobackup 2020-05-10 12:13:46 -05:00
PastaPastaPasta
cd42171a4f
bitcoind -> dashd
Co-Authored-By: dustinface <35775977+xdustinface@users.noreply.github.com>
2020-05-10 12:13:46 -05:00
xdustinface
b1c26d4aae
qt: Disconnect CClientUIInterface from SplashScreen::ConnectWallet
Due to not disconnecting the signal there the trace of the `loadwallet` 
rpc command ends 
in a call of `SplashScreen::ConnectWallet` for the not longer existent 
splashscreen object.

7770a7da95/src/wallet/wallet.cpp (L4192)

Wasn't an issue before the `loadwallet` rpc was introduced because 
`CWallet::LoadWallet` was only called once on startup.
2020-05-10 12:13:46 -05:00
Russell Yanofsky
b0c1406bee
End Merge #11851: Add m_ prefix to WalletBatch::m_batch 2020-05-10 12:13:46 -05:00
Russell Yanofsky
1cf961182f
Update walletdb comment after renaming.
Text from https://github.com/bitcoin/bitcoin/pull/11851#issuecomment-350320608
by John Newbery <john@johnnewbery.com>.
2020-05-10 12:13:46 -05:00
Pasta
b1c8875579
scripted-diff: Rename wallet database classes (begin bitcoin#11851)
-BEGIN VERIFY SCRIPT-

sed -i 's/\<CWalletDBWrapper\>/BerkeleyDatabase/g' src/wallet/db.h src/wallet/db.cpp
sed -i '/statuses/i/** Backend-agnostic database type. */\nusing WalletDatabase = BerkeleyDatabase\;\n' src/wallet/walletdb.h
ren() { git grep -l "\<$1\>" 'src/*.cpp' 'src/*.h' ':(exclude)*dbwrapper*' test | xargs sed -i "s:\<$1\>:$2:g"; }
ren CDBEnv           BerkeleyEnvironment
ren CDB              BerkeleyBatch
ren CWalletDBWrapper WalletDatabase
ren CWalletDB        WalletBatch
ren dbw              database
ren m_dbw            m_database
ren walletdb         batch
ren pwalletdb        batch
ren pwalletdbIn      batch_in
ren wallet/batch.h   wallet/walletdb.h
ren pwalletdbEncryption encrypted_batch

-END VERIFY SCRIPT-

Signed-off-by: Pasta <pasta@dashboost.org>
2020-05-10 12:13:46 -05:00
John Newbery
8ebbdfe805
Merge #10740: [wallet] loadwallet RPC - load wallet at runtime
cd53981 [docs] Add release notes for `loadwallet` RPC. (John Newbery)
a46aeb6 [wallet] [tests] Test loadwallet (John Newbery)
5d15260 [wallet] [rpc] Add loadwallet RPC (John Newbery)
876eb64 [wallet] Pass error message back from CWallet::Verify() (John Newbery)
e0e90db [wallet] Add CWallet::Verify function (John Newbery)
470316c [wallet] setup wallet background flushing in WalletInit directly (John Newbery)
59b87a2 [wallet] Fix potential memory leak in CreateWalletFromFile (John Newbery)

Pull request description:

  Adds a `loadwallet` RPCs. This allows wallets to be loaded dynamically during runtime without having to stop-start the node with new `-wallet` params.

  Includes functional tests and release notes.

  Limitations:

  - currently this functionality is only available through the RPC interface.
  - wallets loaded in this way will not be displayed in the GUI.

Tree-SHA512: f80dfe32b77f5c97ea3732ac538de7d6ed7e7cd0413c2ec91096bb652ad9bccf05d847ddbe81e7cd3cd44eb8030a51a5f00083871228b1b9b0b8398994f6f9f1
2020-05-10 12:13:46 -05:00
Wladimir J. van der Laan
3d73de3381
Merge #13028: Make vpwallets usage thread safe
e2f58f4 wallet: Make vpwallets usage thread safe (João Barbosa)

Pull request description:

  This PR turns the functions introduced in #13017 thread safe. This is required to correctly support dynamically loading wallets, which is implemented in #10740.

Tree-SHA512: efaa09e501636cf957aa33de83719ce09dc0c2a19daff741a94ef10d6b7ba5dee538355b80c96ead995140f99f5df0c92fb0e22ae1adb8f397eb478280c8d8c7
2020-05-10 11:15:58 -05:00
Wladimir J. van der Laan
b0dc2ab3c1
Merge #11862: Network specific conf sections
c25321f Add config changes to release notes (Anthony Towns)
5e3cbe0 [tests] Unit tests for -testnet/-regtest in [test]/[regtest] sections (Anthony Towns)
005ad26 ArgsManager: special handling for -regtest and -testnet (Anthony Towns)
608415d [tests] Unit tests for network-specific config entries (Anthony Towns)
68797e2 ArgsManager: Warn when ignoring network-specific config setting (Anthony Towns)
d1fc4d9 ArgsManager: limit some options to only apply on mainnet when in default section (Anthony Towns)
8a9817d [tests] Use regtest section in functional tests configs (Anthony Towns)
30f9407 [tests] Unit tests for config file sections (Anthony Towns)
95eb66d ArgsManager: support config file sections (Anthony Towns)
4d34fcc ArgsManager: drop m_negated_args (Anthony Towns)
3673ca3 ArgsManager: keep command line and config file arguments separate (Anthony Towns)

Pull request description:

  The weekly meeting on [2017-12-07](http://www.erisian.com.au/meetbot/bitcoin-core-dev/2017/bitcoin-core-dev.2017-12-07-19.00.log.html) discussed allowing options to bitcoin to have some sensitivity to what network is in use. @theuni suggested having sections in the config file:

      <cfields> an alternative to that would be sections in a config file. and on the
                cmdline they'd look like namespaces. so, [testnet] port=5. or -testnet::port=5.

  This approach is (more or less) supported by `boost::program_options::detail::config_file_iterator` -- when it sees a `[testnet]` section with `port=5`, it will treat that the same as "testnet.port=5". So `[testnet] port=5` (or `testnet.port=5` without the section header) in bitcoin.conf and `-testnet.port=5` on the command line.

  The other aspect to this question is possibly limiting some options so that there is no possibility of accidental cross-contamination across networks. For example, if you're using a particular wallet.dat on mainnet, you may not want to accidentally use the same wallet on testnet and risk reusing keys.

  I've set this up so that the `-addnode` and `-wallet` options are `NETWORK_ONLY`, so that if you have a bitcoin.conf:

      wallet=/secret/wallet.dat
      upnp=1

  and you run `bitcoind -testnet` or `bitcoind -regtest`, then the `wallet=` setting will be ignored, and should behave as if your bitcoin.conf had specified:

      upnp=1

      [main]
      wallet=/secret/wallet.dat

  For any `NETWORK_ONLY` options, if you're using `-testnet` or `-regtest`, you'll have to add the prefix to any command line options. This was necessary for `multiwallet.py` for instance.

  I've left the "default" options as taking precedence over network specific ones, which might be backwards. So if you have:

      maxmempool=200
      [regtest]
      maxmempool=100

  your maxmempool will still be 200 on regtest. The advantage of doing it this way is that if you have `[regtest] maxmempool=100` in bitcoin.conf, and then say `bitcoind -regtest -maxmempool=200`, the same result is probably in line with what you expect...

  The other thing to note is that I'm using the chain names from `chainparamsbase.cpp` / `ChainNameFromCommandLine`, so the sections are `[main]`, `[test]` and `[regtest]`; not `[mainnet]` or `[testnet]` as might be expected.

  Thoughts? Ping @MeshCollider @laanwj @jonasschnelli @morcos

Tree-SHA512: f00b5eb75f006189987e5c15e154a42b66ee251777768c1e185d764279070fcb7c41947d8794092b912a03d985843c82e5189871416995436a6260520fb7a4db
2020-05-10 11:15:58 -05:00
Jonas Schnelli
aaf5bf1a7e Merge #12878: [refactor] Config handling refactoring in preparation for network-specific sections
77a733a99 [tests] Add additional unit tests for -nofoo edge cases (Anthony Towns)
af173c2be [tests] Check GetChainName works with config entries (Anthony Towns)
fa27f1c23 [tests] Add unit tests for ReadConfigStream (Anthony Towns)
087c5d204 ReadConfigStream: assume the stream is good (Anthony Towns)
6d5815aad Separate out ReadConfigStream from ReadConfigFile (Anthony Towns)
834d30341 [tests] Add unit tests for GetChainName (Anthony Towns)
11b6b5b86 Move ChainNameFromCommandLine into ArgsManager and rename to GetChainName (Anthony Towns)

Pull request description:

  This does a bit of refactoring of the configuration handling code in order to add additional tests to make adding support for [test]/[regtest] sections in the config file in #11862 easier. Should not cause any behaviour changes.

Tree-SHA512: 8d2ce1449fc180de03414e7e569d1a21ba1e9f6564e13d3faf3961f710adc725fa0d4ab49b89ebd2baa11ea36ac5018377f693a84037d386a8b8697c9d6db3e9
2020-05-09 17:35:59 -05:00
MarcoFalke
7a89b916d1 Merge #12713: Track negated options in the option parser
f7683cba7b Track negated arguments in the argument paser. (Evan Klitzke)
4f872b2450 Add additional tests for GetBoolArg() (Evan Klitzke)

Pull request description:

  This change explicitly enable tracking negated options in the option parser. A negated option is one passed with a `-no` prefix. For example, `-nofoo` is the negated form of `-foo`. Negated options were originally added in the 0.6 release.

  The change here allows code to explicitly distinguish between cases like `-nofoo` and `-foo=0`, which was not possible previously. The option parser does not have any changed semantics as a result of this change, and existing code will parse options just as it did before.

  The motivation for this change is to provide a way to disable options that are otherwise not boolean options. For example, the `-debuglogfile` option is normally interpreted as a string, where the value is the log file name. With this change a user can pass in `-nodebuglogfile` and the code can see that it was explicitly negated, and use that to disable the log file.

  This change originally split out from #12689.

Tree-SHA512: cd5a7354eb03d2d402863c7b69e512cad382781d9b8f18c1ab104fc46d45a712530818d665203082da39572c8a42313c5be09306dc2a7227cdedb20ef7314823
2020-05-09 17:35:59 -05:00
Wladimir J. van der Laan
8700f460e3 Merge #12305: [docs] [refactor] Add help messages for datadir path mangling
5460460 Add AbsPathForConfigVal to consolidate datadir prefixing for path args (James O'Beirne)
a1e1305 Clarify help messages for path args to mention datadir prefix (James O'Beirne)

Pull request description:

  Change `-conf`'s help message to indicate that relative path values will be prefixed by the datadir path. This behavior probably merits clarification; it's kind of confusing when attempting to specify a configuration file in the current directory with `-conf=bitcoin.conf`, but instead loading the `bitcoin.conf` file in ~/.bitcoin datadir.

  ### Edit

  This PR has been modified to document all cases where relative path configurations are modified to be under datadir. A small refactoring has also been added which consolidates this normalization.

Tree-SHA512: be4fc0595fbeba33d17af08f59898af45e76a44f00719ea0282403b155ac6755584604fab765250a3aa14ed6991882c4d1ccbe601184362c5ba97c886bdda344
2020-05-09 17:35:59 -05:00
UdjinM6
538fcf2f1b
Disable qt menu heuristics for openConfEditorAction (#3466)
Thanks to `TextHeuristicRole` set by default qt confuses `openConfEditorAction` with application settings and binds it as if we would set `PreferencesRole` to it. As a result it opens `dash.conf` when user clicks `Preferences...` and not application settings as one would expect. Explicitly setting `NoRole` fixes it.

Note: this issue only appears in some languages e.g. `de`.
2020-05-02 18:50:36 +03:00
dustinface
6e1c5480cd
qt: Maximize the window if the dock icon gets clicked on macOS (#3465) 2020-05-02 18:50:23 +03:00
UdjinM6
3960d622c5
Fix incorrect nTimeFirstKey reset due to missing count of hd pubkeys (#3461) 2020-05-02 18:50:13 +03:00
UdjinM6
d0bb30838b
Various (mostly trivial) PS fixes (#3457)
* Implement GetDsqThreshold to unify dsq rejection threshold calculations

* Use much simpler/lighter criteria to check if a candidate mixing MN is going to be paid in next 8 blocks

Drop CMasternodePayments::IsScheduled()

* Fix decomposition of txes with 2 outputs

Recognise creation of denoms for txes with 1 denom + 1 change

Fixes an issue introduced in #3347

* Tweak few labels

s/anonymize/mix/

* Prefer larger denoms when starting new mixing queues

Fixes an issue introduced in #3346

* Add an explanation about GetDsqThreshold

* Move GetDsqThreshold comment a bit higher
2020-05-02 18:50:03 +03:00
UdjinM6
b0963b079e
Fix deadlocks (#3456)
* Lock mempool before locking cs_wallet

This fixes deadlocks introduced in 78d303c3fd6fe8103f2cec95a2eff0f6a880a46e/#3361

* Fix mempool.cs vs cs_inventory potential deadlock

POTENTIAL DEADLOCK DETECTED
Previous lock order was:
 pnode->cs_sendProcessing  net.cpp:2724
 cs_main  net_processing.cpp:3867 (TRY)
 (1) pto->cs_inventory  net_processing.cpp:4106
 (2) cs  txmempool.cpp:1137
Current lock order is:
 cs_main  wallet/rpcwallet.cpp:468
 (2) mempool.cs  wallet/rpcwallet.cpp:468
 pwallet->cs_wallet  wallet/rpcwallet.cpp:469
 cs_main  wallet/wallet.cpp:4045
 (2) mempool.cs  wallet/wallet.cpp:4045
 cs_wallet  wallet/wallet.cpp:4046
 cs_vNodes  net.cpp:3464
 (1) cs_inventory  ./net.h:1056
2020-05-02 18:49:49 +03:00
thephez
bdce58756a
Remove duplicated condition check (#3464) 2020-04-30 13:29:08 +03:00
dustinface
124824da41
Backport bitcoin#14123 and bitcoin#16720 (#3463)
* Remove obj_c for macOS Dock icon setting

Qt `setWindowIcon()` does this work.

* Use Qt signal for macOS Dock icon click event

This moves the Dock icon click reaction code to the common place and
allows some cleanup in obj_c code.

According to the Apple's docs `class_replaceMethod` behaves as
`class_addMethod`, if the method identified by name does not yet exist;
or as `method_setImplementation`, if it does exist.

* Remove obj_c for macOS Dock icon menu

Qt `setAsDockMenu()` does this work.

* qt: Add GUIUtil::bringToFront

* qt: Use GUIUtil::bringToFront where possible

* qt: All tray menu actions call showNormalIfMinimized

* qt: Replace objc_msgSend with native syntax

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
Co-authored-by: João Barbosa <joao.paulo.barbosa@gmail.com>
2020-04-30 13:28:44 +03:00
10xcryptodev
10baa4a857
Update Windows build instructions (#3453)
* update windows build instructions

* move cross compilation section

* remove 32bit. The additional info about 32bit is described in footnotes

* update doc formating and order
2020-04-30 13:28:12 +03:00
10xcryptodev
7fdc4c7b0d
change miniupnp lib server (#3452)
* change miniupnp lib server

* adding files to URL
2020-04-26 03:41:42 +03:00
UdjinM6
7bca96314b
Merge pull request #3426 from PastaPastaPasta/backport-11687
Backport Wallet refactoring and external wallet files 11687 and 13017
2020-04-26 03:41:19 +03:00
UdjinM6
28a8db3ca7 Fix sourceFile 2020-04-24 17:50:07 -05:00
UdjinM6
97907b051f Fix autobackup functionality 2020-04-23 14:33:31 -05:00
PastaPastaPasta
6f4260f860 bitcoin -> Dash Core
Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-04-23 14:33:31 -05:00
Pasta
02dfb89b02 fix test 50 -> 500
Signed-off-by: Pasta <pasta@dashboost.org>
2020-04-23 14:33:31 -05:00
Pasta
4aa8a9a206 resolve DEFAULT_WALLET_DAT being removed
Signed-off-by: Pasta <pasta@dashboost.org>
2020-04-23 14:33:31 -05:00
Wladimir J. van der Laan
7999080c04 Merge #11687: External wallet files
be8ab7d08 Create new wallet databases as directories rather than files (Russell Yanofsky)
26c06f24e Allow wallet files not in -walletdir directory (Russell Yanofsky)
d8a99f65e Allow wallet files in multiple directories (Russell Yanofsky)

Pull request description:

  This change consists of three commits:

  * The first commit is a pure refactoring that removes the restriction that two wallets can only be opened at the same time if they are contained in the same directory.
  * The second commit removes the restriction that `-wallet` filenames can only refer to files in the `-walletdir` directory.
  * The third commit makes second commit a little safer by changing bitcoin to create wallet databases as directories rather than files, so they can be safely backed up.

  All three commits should be straightforward:

  *  The first commit adds around 20 lines of new code and then updates a bunch of function signatures (generally updating them to take plain fs::path parameters, instead of combinations of strings, fs::paths, and objects like CDBEnv and CWalletDBWrapper).
  * The second commit removes two `-wallet` filename checks and adds some test cases to the multiwallet unit test.
  * The third commit just changes the mapping from specified wallet paths to bdb environment & data paths.

    ---

  **Note:** For anybody looking at this PR for the first time, I think you can skip the comments before _20 Nov_ and start reading at https://github.com/bitcoin/bitcoin/pull/11687#issuecomment-345625565. Comments before  _20 Nov_ were about an earlier version of the PR that didn't include the third commit, and then confusion from not seeing the first commit.

Tree-SHA512: 00bbb120fe0df847cf57014f75f1f7f1f58b0b62fa0b3adab4560163ebdfe06ccdfff33b4231693f03c5dc23601cb41954a07bcea9a4919c8d42f7d62bcf6024
2020-04-23 14:33:31 -05:00
pasta
6db01000cf 13017 continued
Signed-off-by: pasta <pasta@dashboost.org>
2020-04-23 14:33:31 -05:00
Wladimir J. van der Laan
4dcd8d1bea Merge #13017: Add wallets management functions
3c058fd wallet: Add HasWallets (João Barbosa)
373aee2 wallet: Add AddWallet, RemoveWallet, GetWallet and GetWallets (João Barbosa)
6efd964 refactor: Drop CWalletRef typedef (João Barbosa)

Pull request description:

  This is a small step towards dynamic wallet load/unload. The wallets *registry* `vpwallets` is used in several places. With these new functions all `vpwallets` usage are removed and `vpwallets` is now a static variable (no external linkage).

  The typedef `CWalletRef` is also removed as it is narrowly used.

Tree-SHA512: 2ea19da2e17b521ad678bfe10f3257e497ccaf7ab9fd0b6647f9d829f1d6131cfa68db8e8492421711c6da399859432b963a568bdd4ca40a77dd95b597839423
2020-04-23 14:33:31 -05:00
Alexander Block
911b5580e4
Fix typo in error log when EPOLL_CTL_ADD fails for wakeup pipe (#3451) 2020-04-23 12:33:36 +03:00
PastaPastaPasta
b775fa263f
Lower DEFAULT_PRIVATESEND_DENOMS (#3434)
Signed-off-by: pasta <pasta@dashboost.org>
2020-04-22 18:54:45 +03:00
Alexander Block
d59deea77b
Merge pull request #3445 from codablock/pr_epoll
Implement epoll support
2020-04-22 17:10:33 +02:00
Alexander Block
7c4ebe40de
Merge pull request #3450 from codablock/pr_fix_3
Fix handling of disconnected lingering nodes
2020-04-22 16:36:07 +02:00
Alexander Block
aa46b5ccb2 Make epoll the default socketevents mode when possible 2020-04-22 16:17:03 +02:00
Alexander Block
d6b69dbf69 Revert "Only run DisconnectNodes once per second"
This reverts commit 30e4afae00.
2020-04-22 16:05:11 +02:00
Alexander Block
e51580f052 Only linger when the other side has not shutdown/closed the socket yet
Otherwise immediately close the socket and remove the node from the list.
2020-04-22 07:50:40 +02:00
Alexander Block
1df71a0f22 Don't consider disconnecting nodes in GetNodeCount and GetNodeStats 2020-04-22 06:32:32 +02:00
Alexander Block
98ff8feaf2 Revert "Invoke DisconnectNodes from getconnectioncount/getpeerinfo/getnetworkinfo"
This reverts commit 2f1b3a34ab.
2020-04-22 06:32:32 +02:00
Alexander Block
ccb1f84b3a Revert "Invoke DisconnectNodes right before checking for duplicate connections"
This reverts commit 76d7b17dcd.
2020-04-22 06:32:32 +02:00
Alexander Block
33bfaffbea Don't return nodes with fDisconnect=true in FindNode
FindNode is only interested in active connections, especially when called
from OpenNetworkConnection. Connections which are about to get disconnected
and removed should be treated as if they are not existent anymore, as
otherwise there is a small race between disconnecting and reconnecting
nodes, causing OpenNetworkConnection to return early.
2020-04-22 06:32:32 +02:00
Alexander Block
d235364534 Wait one additional second for disconnects 2020-04-21 16:49:36 +02:00
Alexander Block
96faa8155e
Don't disconnect masternode probes for a few seconds (#3449)
* Refactor CMasternodeUtils::ProcessMasternodeConnections to be more readable

* Don't disconnect masternode probes for a few seconds
2020-04-21 16:44:18 +02:00
Alexander Block
608aed3d85
Don't try to connect to itself through CLLMQUtils::GetQuorumConnections (#3448) 2020-04-21 16:43:59 +02:00
Alexander Block
d516e3d1e0 Advance iterator in CConnman::DisconnectNodes when lingering 2020-04-21 08:16:49 +02:00
Alexander Block
3fa94aac56 Implement epoll support 2020-04-20 15:38:19 +02:00
PastaPastaPasta
087d98477b
Merge bitcoin#10387: Eventually connect to NODE_NETWORK_LIMITED peers (#3417)
* Merge #10387: Eventually connect to NODE_NETWORK_LIMITED peers

eb91835 Add setter for g_initial_block_download_completed (Jonas Schnelli)
3f56df5 [QA] add NODE_NETWORK_LIMITED address relay and sync test (Jonas Schnelli)
158e1a6 [QA] fix mininode CAddress ser/deser (Jonas Schnelli)
fa999af [QA] Allow addrman loopback tests (add debug option -addrmantest) (Jonas Schnelli)
6fe57bd Connect to peers signaling NODE_NETWORK_LIMITED when out-of-IBD (Jonas Schnelli)
31c45a9 Accept addresses with NODE_NETWORK_LIMITED flag (Jonas Schnelli)

Pull request description:

  Eventually connect to peers signalling NODE_NETWORK_LIMITED if we are out of IBD.
  Accept and relay NODE_NETWORK_LIMITED peers in addrman.

Tree-SHA512: 8a238fc97f767f81cae1866d6cc061390f23a72af4a711d2f7158c77f876017986abb371d213d1c84019eef7be4ca951e8e6f83fda36769c4e1a1d763f787037
Signed-off-by: Pasta <pasta@dashboost.org>

# Conflicts:
#	src/init.cpp
#	src/protocol.h
#	test/functional/node_network_limited.py

* remove witness

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

* fix test expecting witness flag

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

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
2020-04-19 16:21:47 +03:00
UdjinM6
d663f48085
Lower SELECT_TIMEOUT_MILLISECONDS for USE_WAKEUP_PIPE case (#3444) 2020-04-19 14:48:44 +02:00
Alexander Block
f5f4ccbf24
Merge pull request #3432 from codablock/pr_refactor_sockethandler
Refactor/Prepare CConnman for upcoming epoll support
2020-04-19 14:27:59 +02:00