Commit Graph

62 Commits

Author SHA1 Message Date
Ryan Ofsky f9fdcec7e9 settings: Add resetSettings() method
Allows the GUI to clear settings.json file and save settings.json.bak file when
GUI "Reset Options" button is pressed or -resetguisettings command line option
is used. (GUI code already backs up and resets the "guisettings.ini" file this
way, so this just makes the same behavior possible for "settings.json")
2022-05-19 11:32:56 -04:00
Ryan Ofsky 0e55bc6e7f settings: Add update/getPersistent/isIgnored methods
Add interfaces::Node methods to give GUI finer grained control over
settings.json file. Update method is used to write settings to the file,
getPersistent and isIgnored methods are used to find out about settings
file and command line option interactions.
2022-05-19 11:32:56 -04:00
laanwj 848b11615b
Merge bitcoin/bitcoin#22834: net: respect -onlynet= when making outbound connections
0eea83a85e scripted-diff: rename `proxyType` to `Proxy` (Vasil Dimov)
e53a8505db net: respect -onlynet= when making outbound connections (Vasil Dimov)

Pull request description:

  Do not make outbound connections to hosts which belong to a network
  which is restricted by `-onlynet`.

  This applies to hosts that are automatically chosen to connect to and to
  anchors.

  This does not apply to hosts given to `-connect`, `-addnode`,
  `addnode` RPC, dns seeds, `-seednode`.

  Fixes https://github.com/bitcoin/bitcoin/issues/13378
  Fixes https://github.com/bitcoin/bitcoin/issues/22647
  Supersedes https://github.com/bitcoin/bitcoin/pull/22651

ACKs for top commit:
  naumenkogs:
    utACK 0eea83a85e
  prayank23:
    reACK 0eea83a85e
  jonatack:
    ACK 0eea83a85e code review, rebased to master, debug built, and did some manual testing with various config options on signet

Tree-SHA512: 37d68b449dd6d2715843fc84d85f48fa2508be40ea105a7f4a28443b318d0b6bd39e3b2ca2a6186f2913836adf08d91038a8b142928e1282130f39ac81aa741b
2022-03-01 18:32:01 +01:00
Russell Yanofsky f7086fd8ff Add src/wallet/* code to wallet:: namespace 2022-01-06 22:14:16 -05:00
Russell Yanofsky 90fc8b089d Add src/node/* code to node:: namespace 2022-01-06 22:14:16 -05:00
Hennadii Stepanov f47dda2c58
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-

Commits of previous years:
* 2020: fa0074e2d8
* 2019: aaaaad6ac9
2021-12-30 19:36:57 +02:00
Russell Yanofsky ff5f6dea53 scripted-diff: Rename interfaces::WalletClient to interfaces::WalletLoader
Name has been confusing since it was introduced, and it was pointed in
recent review club as https://bitcoincore.reviews/10102 that it was
particularly unclear how interfaces::WalletClient was different from
interfaces::Wallet.

-BEGIN VERIFY SCRIPT-
ren() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; }
ren WalletClient WalletLoader
ren walletClient walletLoader
ren wallet_client wallet_loader
ren "wallet clients release the wallet" "wallet pointer owners release the wallet"
ren "wallet client" "wallet loader"
ren "Wallet client" "Wallet loader"
-END VERIFY SCRIPT-
2021-12-22 13:44:55 -05:00
Vasil Dimov 0eea83a85e
scripted-diff: rename `proxyType` to `Proxy`
-BEGIN VERIFY SCRIPT-
sed -i 's/\<proxyType\>/Proxy/g' $(git grep -l proxyType)
-END VERIFY SCRIPT-
2021-11-24 12:44:07 +01:00
MarcoFalke cf63d635b1
Merge bitcoin/bitcoin#23499: multiprocess: Add interfaces::Node::broadCastTransaction method
0e0f4fdd89 multiprocess: Add interfaces::Node::broadCastTransaction method (Russell Yanofsky)

Pull request description:

  This fixes a null pointer crash in the bitcoin-gui PSBT dialog. The bitcoin-gui interfaces::Node object has a null NodeContext pointer, and can't broadcast transactions directly. It needs to broadcast transactions through the bitcoin-node process instead.

  ---

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10).

ACKs for top commit:
  lsilva01:
    Code Review ACK 0e0f4fd

Tree-SHA512: cd2c1fe8dc15e7cecf01a21d64319d6add1124995305a9ef9cb72f8492dc692c62d4f846182567d47a5048a533178a925419250941a47cb39932467c36bea3e1
2021-11-16 08:42:21 +01:00
W. J. van der Laan 7f0f853373
Merge bitcoin/bitcoin#23005: multiprocess: Delay wallet client construction
ad085f9ba1 multiprocess: Delay wallet client construction (Russell Yanofsky)

Pull request description:

  Delay wallet client construction until after logging, thread and other init for two reasons:

  - More responsive multiprocess GUI startup. When bitcoin-gui is started this moves the call from bitcoin-gui to bitcoin-node that spawns bitcoin-wallet off of the GUI event thread and onto the background GUI init executor thread.

  - Avoids feature_logging.py test failures with bitcoin-node by making bitcoin-wallet logging start after bitcoin-node logging starts,
    because the tests are not written to handle the bitcoin-wallet logging init code running first.

  This partially reverts commit b266b3e0bf, moving wallet client creation back to the place it was located before.

  ---

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10).

ACKs for top commit:
  laanwj:
    code review ACK ad085f9ba1
  hebasto:
    ACK ad085f9ba1, I have reviewed the code and it looks OK.

Tree-SHA512: 74d957ce2ee096db745c517124f60800185814b06c20db676090e10dce1b90311adbab02865a69731f8c39b9365f9ee14be0830ca1368cac9b474801ea92bad5
2021-11-15 18:08:49 +01:00
Russell Yanofsky 0e0f4fdd89 multiprocess: Add interfaces::Node::broadCastTransaction method
This fixes a null pointer crash in the bitcoin-gui PSBT dialog. The
bitcoin-gui interfaces::Node object has a null NodeContext pointer, and
can't broadcast transactions directly. It needs to broadcast
transactions through the bitcoin-node process instead.
2021-11-12 15:20:53 -05:00
Russell Yanofsky a032fa30d2 multiprocess: add interfaces::ExternalSigner class
Add interfaces::ExternalSigner to let signer objects be passed between
processes and signer code to run in the original process, without
multiple processes linking and running signer code.
2021-10-05 11:10:47 -04:00
fanquake d09071da5b
[MOVEONLY] consensus: move amount.h into consensus
Move amount.h to consensus/amount.h.
Renames, adds missing and removes uneeded includes.
2021-09-30 07:41:57 +08:00
Russell Yanofsky ad085f9ba1 multiprocess: Delay wallet client construction
Delay wallet client construction until after logging, thread and other
init for two reasons:

- More responsive multiprocess GUI startup. When bitcoin-gui is started
  this moves the call from bitcoin-gui to bitcoin-node that spawns
  bitcoin-wallet off of the GUI event thread and onto the background GUI
  init executor thread.

- Avoids feature_logging.py test failures with bitcoin-node by making
  bitcoin-wallet logging start after bitcoin-node logging starts,
  because the tests are not written to handle the bitcoin-wallet logging
  init code running first.

This partially reverts commit b266b3e0bf,
moving wallet client creation back to the place it was located before.
2021-09-16 14:17:01 -04:00
Russell Yanofsky e4709c7b56 Start using init makeNode, makeChain, etc methods
Use interfaces::Init::make* methods instead of interfaces::Make*
functions, so interfaces can be constructed differently in different
executables without having to change any code. (So for example
bitcoin-gui can make an interfaces::Node pointer that communicates with
a bitcoin-node subprocess, while bitcoin-qt can make an interfaces::Node
pointer that starts node code in the same process.)
2021-08-17 03:05:15 -05:00
Sjors Provoost 4455145e26
refactor: reduce #ifdef ENABLE_EXTERNAL_SIGNER usage
In particular this make the node interface independent on whether external signer support is compiled.
2021-06-16 10:48:58 +02:00
Sjors Provoost 3f845ea299
node: add externalSigners to interface 2021-05-27 14:01:54 +02:00
Luke Dashjr c77de622dd net: Replace enum CConnMan::NumConnections with enum class ConnectionDirection 2021-03-04 19:54:17 +00:00
Hennadii Stepanov a39f7336a3
net: Add -natpmp command line option 2021-01-07 18:07:09 +02:00
MarcoFalke fa0074e2d8
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2020-12-31 09:45:41 +01:00
Antoine Poinsot 03bfeee957
interface: remove unused estimateSmartFee method from node
Co-Authored-by: MarcoFalke <falke.marco@gmail.com>
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2020-12-03 12:56:36 +01:00
Russell Yanofsky e4f4350471 refactor: Move wallet methods out of chain.h and node.h
Add WalletClient interface so node interface is cleaner and don't need
wallet-specific methods.

The new NodeContext::wallet_client pointer will also be needed to eliminate
global wallet variables like ::vpwallets, because createWallet(), loadWallet(),
getWallets(), etc methods called by the GUI need a way to get a reference to
the list of open wallets if it is no longer a global variable.

Also tweaks splash screen registration for load wallet events to be delayed
until after wallet client is created.
2020-08-27 14:33:00 -04:00
Russell Yanofsky e133631625 gui: Partially revert #10244 gArgs and Params changes
Change gui code to use gArgs, Params() functions directly instead of going
through interfaces::Node.

Remotely accessing bitcoin-node ArgsManager from bitcoin-gui works fine in
https://github.com/bitcoin/bitcoin/pull/10102, when bitcoin-gui spawns a new
bitcoin-node process and controls its startup, but for bitcoin-gui to support
-ipcconnect option in https://github.com/bitcoin/bitcoin/pull/19461 and connect
to an existing bitcoin-node process, it needs ability to parse arguments itself
before connecting out.

This change also simplifies https://github.com/bitcoin/bitcoin/pull/10102 a
bit, by making the bitcoin-gui -> bitcoin-node startup sequence more similar to
the bitcoin-node -> bitcoin-wallet startup sequence where the parent process
parses arguments and passes them to the child process instead of the parent
process using the child process to parse arguments.
2020-08-26 05:52:31 -04:00
Jonas Schnelli b354a1480a Add BlockAndHeaderTipInfo to the node interface/appInit 2020-08-12 16:44:06 +02:00
MarcoFalke 4b705b1c98
Merge #19098: test: Remove duplicate NodeContext hacks
edc316020e test: Remove duplicate NodeContext hacks (Russell Yanofsky)

Pull request description:

  Qt tests currently are currently using two NodeContext structs at the same time, one in interfaces::NodeImpl::m_context, and the other in BasicTestingSetup::m_node, and the tests have hacks transferring state between them.

  Fix this by getting rid of the NodeImpl::m_context struct and making it a pointer. This way a common BitcoinApplication object can be used for all qt tests, but they can still have their own testing setups.

  Non-test code is changing but non-test behavior is still the same as before.

  Motivation for this PR is to be able to remove the "std::move(test.m_node.connman)" and mempool hacks for swapping individual NodeContext members in Qt tests, because followup PR #19099 adds yet another member (wallet_client) that needs to be swapped. After this change, the whole NodeContext struct can be swapped instead of individual members, so the workarounds are less fragile and invasive.

ACKs for top commit:
  MarcoFalke:
    crACK edc316020e 🌮
  promag:
    ACK edc316020e.

Tree-SHA512: c1650e4127f43a4020304ca7c13b5d9122fb5723aacd8fa1cf855d03c6052fcfb7685810aa2a5ef708561015f0022fecaacbad479295104ca45d2c17579466a4
2020-08-07 08:07:37 +02:00
Russell Yanofsky edc316020e test: Remove duplicate NodeContext hacks
Qt tests currently are currently using two NodeContext structs at the same
time, one in interfaces::NodeImpl::m_context, and the other in
BasicTestingSetup::m_node, and the tests have hacks transferring state between
them.

Fix this by getting rid of the NodeImpl::m_context struct and making it a
pointer. This way a common BitcoinApplication object can be used for all qt
tests, but they can still have their own testing setups.

Non-test code is changing but non-test behavior is still the same as before.

Motivation for this PR is to be able to remove the
"std::move(test.m_node.connman)" and mempool hacks for swapping individual
NodeContext members in Qt tests, because followup PR #19099 adds yet another
member (wallet_client) that needs to be swapped. After this change, the whole
NodeContext struct can be swapped instead of individual members, so the
workarounds are less fragile and invasive.
2020-07-13 04:34:27 -04:00
Russell Yanofsky 9c69cfe4c5 Add <datadir>/settings.json persistent settings storage.
Persistent settings are used in followup PRs #15936 to unify gui settings
between bitcoin-qt and bitcoind, and #15937 to add a load_on_startup flag to
the loadwallet RPC and maintain a dynamic list of wallets that should be loaded
on startup that also can be shared between bitcoind and bitcoin-qt.
2020-07-11 05:41:12 -04:00
Pieter Wuille 2ad58381ff Clean up separated ban/discourage interface 2020-07-03 20:43:55 -07:00
Hennadii Stepanov d1ae7c0355
Make GetWarnings() return bilingual_str 2020-06-10 15:01:20 +03:00
Wladimir J. van der Laan 6fe989054f refactor: Change Node::initError to take bilingual_str
Make it consistent with `Chain::initError`.
2020-06-09 15:40:02 +02:00
furszy a06e845e82
BlockTip struct created and connected to notifyHeaderTip and notifyBlockTip signals. 2020-05-23 20:02:10 -03:00
furszy 2f867203b0
Added best block hash to the NotifyHeaderTip and NotifyBlockTip signals.
[ClientModel] best header/block hash cached.
2020-05-23 20:02:04 -03:00
Hennadii Stepanov 1dab574edf
refactor: Pass SynchronizationState enum to GUI
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2020-05-19 02:49:32 +03:00
Hennadii Stepanov 917ca93553
Make ThreadSafe{MessageBox|Question} bilingual 2020-05-05 04:45:59 +03:00
MarcoFalke fae51a5c6f
wallet: Avoid translating RPC errors when loading wallets
Common errors and warnings should be translated when displayed in the
GUI, but not translated when displayed elsewhere. The wallet method
CreateWalletFromFile does not know its caller, so this commit changes it
to return a bilingual_str to the caller.
2020-05-01 07:39:00 -04:00
Russell Yanofsky 1dca9dc4c7 refactor: Change createWallet, fillPSBT argument order
Move output arguments after input arguments for consistency with other methods,
and to work more easily with IPC framework in #10102
2020-03-19 15:26:04 -05:00
Russell Yanofsky 1c2ab1a6d2 refactor: Rename Node::disconnect methods
Avoid overloading method name to work more easily with IPC framework
2020-03-19 15:26:04 -05:00
MarcoFalke aaaaad6ac9
scripted-diff: Bump copyright of files changed in 2019
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2019-12-30 10:42:20 +13:00
John Newbery 869b6314fd [qt] remove unused parameter from getWarnings() 2019-12-15 13:23:30 -03:00
Wladimir J. van der Laan c4b8dd2060
Merge #17297: refactor: Remove addrdb.h dependency from node.h
f44abe4bed refactor: Remove addrdb.h dependency from node.h (Hennadii Stepanov)

Pull request description:

  `node.h` includes `addrdb.h` just for the sake of `banmap_t` type.
  This PR makes dependencies simpler and explicit.

  ~Also needless `typedef` has been removed from `enum BanReason`.~

ACKs for top commit:
  laanwj:
    ACK f44abe4bed
  practicalswift:
    ACK f44abe4bed

Tree-SHA512: 33a1be20e5c629daf4a61ebbf93ea6494b9256887cebd4974de4782f6d324404b6cc84909533d9502b2cc19902083f1f9307d4fb7231e67db5b412b842d13072
2019-11-04 13:18:27 +01:00
Hennadii Stepanov f44abe4bed
refactor: Remove addrdb.h dependency from node.h 2019-10-29 11:30:12 +02:00
Russell Yanofsky e6f4f895d5 Pass NodeContext, ConnMan, BanMan references more places
So g_connman and g_banman globals can be removed next commit.
2019-10-28 10:30:51 -04:00
MarcoFalke facec1c643
wallet: Avoid showing GUI popups on RPC errors 2019-10-08 13:02:14 -04:00
Gregory Sanders b34f0180e3 Revert "gui: Generate bech32 addresses by default (take 2, fixup)"
This reverts commit fa5a4cd813.
2019-09-26 16:23:32 -04:00
Jonas Schnelli 884f7cc81b
Merge #16714: gui: add prune to intro screen with smart default
9924bce317 [gui] intro: enable pruning by default unless disk is big (Sjors Provoost)
c8de347a9d [gui] intro: add prune preference (Sjors Provoost)
1bbc49d207 [gui] intro: inform caller if intro was shown (Sjors Provoost)
1957103786 [gui] add explicit prune setter (Sjors Provoost)
1bccf6a52d [node] add forceSetArg to interface (Sjors Provoost)

Pull request description:

  This adds a checkbox to the intro screen to enable pruning from the get go.

  If the user has plenty of space, it's unchecked by default:

  <img width="671" alt="big" src="https://user-images.githubusercontent.com/10217/63641289-10339000-c6ac-11e9-98d7-caf64dff0da6.png">

  If the user has insufficient space it's checked by default:
  <img width="897" alt="low" src="https://user-images.githubusercontent.com/10217/63641276-d4002f80-c6ab-11e9-9f5b-a53472f814ff.png">

  When the user has barely enough space and is likely to need pruning in the near future, this is shown in yellow and we also check the prune box:

  <img width="662" alt="medium" src="https://user-images.githubusercontent.com/10217/63641294-1c1f5200-c6ac-11e9-8ecb-6b69e42b1ece.png">

  The cut-off for this 10 GB above `m_assumed_blockchain_size` (`=240` in `chainparams.cpp`).

  If the user launches the first time with `-prune=...` then we disable the check box and display the correct size (rounded to GB):
  <img width="658" alt="Schermafbeelding 2019-08-24 om 20 23 14" src="https://user-images.githubusercontent.com/10217/63641351-09594d00-c6ad-11e9-94fe-fe5ed562e109.png">

  The 2 GB default matches the settings default. The user can't change it in the intro screen, but can change it later. I'm tempted to increase that default to 10 GB, and then have the intro screen reduce it if space is really tight.

  Tips for testing:
  * move your existing data dir elsewhere
  * wipe data dir at every restart (behavior is different if it exists)
  * launch with `bitcoin-qt -resetguisettings -lang=en` (there's some space issues in different languages)
  * fake your free space by changing `intro.cpp` line 90: `freeBytesAvailable = 5000000000; // 5 GB`
  * try both testnet and mainnet, because settings are seperate. In particular note how step 7 in `GuiMain` switches where `QTSettings settings` points to; this had me thoroughly confused on testnet, because I was setting them too early.

ACKs for top commit:
  jonasschnelli:
    Tested ACK 9924bce317
  ryanofsky:
    utACK 9924bce317. The changes are very logical, and implement the feature in a clean that way that doesn't add a lot of complication and shouldn't interfere with future improvements. I looked at Luke's branch too, and I think there's also a lot of great stuff there that seems fully compatible with this change.

Tree-SHA512: 9523961451c53aebd347716976bc3a4a398f989dc21e9bbbd357060bd11a8f46c435f068bd421bb31ccb08e55445ef67bc347d8d19a4fb8fde9d6d3f9a3bcbb0
2019-09-12 15:00:51 +02:00
Andrew Chow 9b41cbb28f Expose wallet creation to the GUI via WalletController
Co-authored-by: João Barbosa <joao.paulo.barbosa@gmail.com>
2019-09-05 20:36:57 -04:00
Sjors Provoost 1bccf6a52d
[node] add forceSetArg to interface 2019-08-24 22:36:11 +02:00
MarcoFalke fa5a4cd813
gui: Generate bech32 addresses by default (take 2, fixup) 2019-07-30 13:53:21 -04:00
Russell Yanofsky fa6f402bde
Call node->initError instead of InitError from GUI code
Avoids GUI code calling a node function, and having to live in the same process
as g_ui_signals and uiInterface global variables.
2019-07-11 19:39:55 -04:00
John Newbery 5c759c73b2 [wallet] Move maxTxFee to wallet
This commit moves the maxtxfee setting to the wallet. There is only
one minor behavior change:

- an error message in feebumper now refers to -maxtxfee instead of
maxTxFee.
2019-04-18 11:34:42 -04:00