0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-06 14:19:59 -05:00
bitcoin-core/src/qt
Ava Chow 0c3a3c9394
Merge bitcoin/bitcoin#29623: Simplify network-adjusted time warning logic
c6be144c4b Remove timedata (stickies-v)
92e72b5d0d [net processing] Move IgnoresIncomingTxs to PeerManagerInfo (dergoegge)
7d9c3ec622 [net processing] Introduce PeerManagerInfo (dergoegge)
ee178dfcc1 Add TimeOffsets helper class (stickies-v)
55361a15d1 [net processing] Use std::chrono for type-safe time offsets (stickies-v)
038fd979ef [net processing] Move nTimeOffset to net_processing (dergoegge)

Pull request description:

  [An earlier approach](1d226ae1f9/) in #28956 involved simplifying and refactoring the network-adjusted time calculation logic, but this was eventually [left out](https://github.com/bitcoin/bitcoin/pull/28956#issuecomment-1904214370) of the PR to make it easier for reviewers to focus on consensus logic changes.

  Since network-adjusted time is now only used for warning/informational purposes, cleaning up the logic (building on @dergoegge's approach in #28956) should be quite straightforward and uncontroversial. The main changes are:

  - Previously, we would only calculate the time offset from the first 199 outbound peers that we connected to. This limitation is now removed, and we have a proper rolling calculation. I've reduced the set to 50 outbound peers, which seems plenty.
  - Previously, we would automatically use the network-adjusted time if the difference was < 70 mins, and warn the user if the difference was larger than that. Since there is no longer any automated time adjustment, I've changed the warning threshold to ~~20~~ 10 minutes (which is an arbitrary number).
  - Previously, a warning would only be raised once, and then never again until node restart. This behaviour is now updated to  1) warn to log for every new outbound peer for as long as we appear out of sync, 2) have the RPC warning toggled on/off whenever we go in/out of sync, and 3) have the GUI warn whenever we are out of sync (again), but limited to 1 messagebox per 60 minutes
  - no more globals
  - remove the `-maxtimeadjustment` startup arg

  Closes #4521

ACKs for top commit:
  sr-gi:
    Re-ACK [c6be144](c6be144c4b)
  achow101:
    reACK c6be144c4b
  dergoegge:
    utACK c6be144c4b

Tree-SHA512: 1063d639542e882186cdcea67d225ad1f97847f44253621a8c4b36c4d777e8f5cb0efe86bc279f01e819d33056ae4364c3300cc7400c087fb16c3f39b3e16b96
2024-04-30 18:49:34 -04:00
..
android Adjust Gradle properties 2023-10-08 14:01:59 +01:00
forms Merge bitcoin-core/gui#497: Enable users to configure their monospace font specifically 2024-02-07 19:28:37 +00:00
locale qt: 27.0 translations update 2024-03-04 10:02:26 +00:00
res
test Merge bitcoin/bitcoin#26564: test: test_bitcoin: allow -testdatadir=<datadir> 2024-03-11 07:03:02 -04:00
addressbookpage.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
addressbookpage.h gui: Add wallet name to address book page 2023-10-04 17:01:49 -03:00
addresstablemodel.cpp refactor: Drop util::Result operator= 2024-04-25 16:08:24 -04:00
addresstablemodel.h gui: Add wallet name to address book page 2023-10-04 17:01:49 -03:00
askpassphrasedialog.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
askpassphrasedialog.h
bantablemodel.cpp
bantablemodel.h
bitcoin.cpp gui: guard accessing a nullptr 'clientModel' 2024-02-28 17:58:47 -03:00
bitcoin.h gui: return EXIT_FAILURE on post-init fatal errors 2023-06-10 11:10:29 -03:00
bitcoin.qrc
bitcoin_locale.qrc qt: 27.0 translations update 2024-03-04 10:02:26 +00:00
bitcoinaddressvalidator.cpp
bitcoinaddressvalidator.h
bitcoinamountfield.cpp
bitcoinamountfield.h
bitcoingui.cpp gui: guard accessing a nullptr 'clientModel' 2024-02-28 17:58:47 -03:00
bitcoingui.h refactor: Remove call to StartShutdown from qt 2023-12-04 15:39:15 -04:00
bitcoinstrings.cpp qt: Update translation source file for v27.0 string freeze 2024-02-13 11:11:52 +00:00
bitcoinunits.cpp
bitcoinunits.h
clientmodel.cpp refactor: gui, simplify boost signals disconnection 2024-02-29 14:40:01 -03:00
clientmodel.h refactor: gui, simplify boost signals disconnection 2024-02-29 14:40:01 -03:00
coincontroldialog.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
coincontroldialog.h qt: remove confusing "Dust" label from coincontrol / sendcoins dialog 2023-07-03 18:06:48 +02:00
coincontroltreewidget.cpp
coincontroltreewidget.h
createwalletdialog.cpp gui: remove legacy wallet creation 2023-10-06 17:20:54 -03:00
createwalletdialog.h gui: remove legacy wallet creation 2023-10-06 17:20:54 -03:00
csvmodelwriter.cpp
csvmodelwriter.h
editaddressdialog.cpp wallet: Replace use of purpose strings with an enum 2023-04-11 15:55:31 -04:00
editaddressdialog.h
guiconstants.h Merge bitcoin-core/gui#553: Change address / amount error background 2024-02-07 18:03:11 +00:00
guiutil.cpp Merge bitcoin/bitcoin#29623: Simplify network-adjusted time warning logic 2024-04-30 18:49:34 -04:00
guiutil.h [net processing] Move nTimeOffset to net_processing 2024-04-10 16:15:46 +02:00
initexecutor.cpp refactor: Extract util/exception from util/system 2023-03-13 17:09:47 +01:00
initexecutor.h
intro.cpp Merge bitcoin-core/gui#658: Intro: Never change the prune checkbox after the user has touched it 2024-02-12 12:08:46 +00:00
intro.h GUI/Intro: Never change the prune checkbox after the user has touched it 2023-06-29 23:24:39 +00:00
macdockiconhandler.h
macdockiconhandler.mm
macnotificationhandler.h
macnotificationhandler.mm
macos_appnap.h
macos_appnap.mm
main.cpp refactor: Remove hooking code for urlDecode 2024-04-24 23:23:38 +02:00
Makefile
modaloverlay.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
modaloverlay.h
networkstyle.cpp scripted-diff: Remove unused chainparamsbase includes 2023-05-09 15:49:19 +02:00
networkstyle.h refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
notificator.cpp refactor: Avoid implicit-signed-integer-truncation-or-sign-change in FreedesktopImage 2024-03-21 19:33:10 +01:00
notificator.h
openuridialog.cpp
openuridialog.h
optionsdialog.cpp gui: accomodate unix socket Proxy in updateDefaultProxyNets() 2024-03-01 14:47:29 -05:00
optionsdialog.h
optionsmodel.cpp [clang-tidy] Enable the misc-no-recursion check 2024-04-07 14:04:45 +01:00
optionsmodel.h GUI: OptionsDialog: Replace verbose two-option font selector with simple combobox with Custom... choice 2023-07-21 17:47:17 +00:00
overviewpage.cpp GUI: Move "embedded font or not" decision into new OptionsModel::getFontForMoney method 2023-07-21 17:45:21 +00:00
overviewpage.h GUI: Move "embedded font or not" decision into new OptionsModel::getFontForMoney method 2023-07-21 17:45:21 +00:00
paymentserver.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
paymentserver.h scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
peertablemodel.cpp
peertablemodel.h
peertablesortproxy.cpp
peertablesortproxy.h
platformstyle.cpp
platformstyle.h
psbtoperationsdialog.cpp scripted-diff: Use DataStream in most places 2023-11-28 12:42:37 +01:00
psbtoperationsdialog.h qt, refactor: Drop superfluous type conversions 2023-10-23 15:06:29 +01:00
qrimagewidget.cpp
qrimagewidget.h
qvalidatedlineedit.cpp
qvalidatedlineedit.h
qvaluecombobox.cpp
qvaluecombobox.h
README.md
receivecoinsdialog.cpp GUI: Support translating address type dropdown entries 2023-03-31 12:21:11 +01:00
receivecoinsdialog.h
receiverequestdialog.cpp
receiverequestdialog.h
recentrequeststablemodel.cpp
recentrequeststablemodel.h
rpcconsole.cpp [net processing] Use std::chrono for type-safe time offsets 2024-04-10 16:15:46 +02:00
rpcconsole.h gui: Update Node window title with chain type 2023-09-18 00:46:09 -03:00
sendcoinsdialog.cpp qt, test: Recognize dialog object by name 2024-02-19 13:53:47 +00:00
sendcoinsdialog.h Merge bitcoin-core/gui#719: Remove confusing "Dust" label from coincontrol / sendcoins dialog 2023-07-04 16:03:30 +01:00
sendcoinsentry.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
sendcoinsentry.h
sendcoinsrecipient.h scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
signverifymessagedialog.cpp
signverifymessagedialog.h
splashscreen.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
splashscreen.h
trafficgraphwidget.cpp clang-tidy: Add performance-type-promotion-in-math-fn check 2023-03-26 20:18:03 +01:00
trafficgraphwidget.h
transactiondesc.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
transactiondesc.h
transactiondescdialog.cpp
transactiondescdialog.h
transactionfilterproxy.cpp
transactionfilterproxy.h
transactionoverviewwidget.cpp
transactionoverviewwidget.h
transactionrecord.cpp Merge bitcoin-core/gui#119: Replace send-to-self with dual send+receive entries 2023-09-22 18:29:51 +01:00
transactionrecord.h Merge bitcoin-core/gui#119: Replace send-to-self with dual send+receive entries 2023-09-22 18:29:51 +01:00
transactiontablemodel.cpp doc: fix typos 2023-11-07 10:21:51 +09:00
transactiontablemodel.h
transactionview.cpp gui: fix crash on selecting "Mask values" in transaction view 2023-10-31 00:27:26 +01:00
transactionview.h
utilitydialog.cpp Modify command line help to show support for BIP21 URIs 2024-02-01 00:57:14 -03:00
utilitydialog.h
walletcontroller.cpp qt: Avoid error prone leading spaces in translatable strings 2023-10-23 15:06:42 +01:00
walletcontroller.h Merge bitcoin-core/gui#738: Add menu option to migrate a wallet 2023-09-20 22:32:31 +01:00
walletframe.cpp refactor: Move fs.* to util/fs.* 2023-03-23 12:55:18 +01:00
walletframe.h
walletmodel.cpp wallet: return and display signer error 2024-04-16 17:47:43 +02:00
walletmodel.h wallet: return and display signer error 2024-04-16 17:47:43 +02:00
walletmodeltransaction.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
walletmodeltransaction.h
walletview.cpp refactor: Avoid implicit-integer-sign-change in processNewTransaction 2024-03-21 19:40:55 +01:00
walletview.h
winshutdownmonitor.cpp refactor: Remove call to StartShutdown from qt 2023-12-04 15:39:15 -04:00
winshutdownmonitor.h qt: Avoid non-self-contained Windows header 2024-01-25 10:26:26 +00:00

This directory contains the source code for the Bitcoin Core graphical user interface (GUI). It uses the Qt cross-platform framework.

The current precise version for Qt 5 is specified in qt.mk.

Compile and run

See build instructions: Unix, macOS, Windows, FreeBSD, NetBSD, OpenBSD

When following your systems build instructions, make sure to install the Qt dependencies.

To run:

./src/qt/bitcoin-qt

Files and Directories

forms/

  • A directory that contains Designer UI files. These files specify the characteristics of form elements in XML. Qt UI files can be edited with Qt Creator or using any text editor.

locale/

  • Contains translations. They are periodically updated and an effort is made to support as many languages as possible. The process of contributing translations is described in doc/translation_process.md.

res/

  • Contains graphical resources used to enhance the UI experience.

test/

  • Functional tests used to ensure proper functionality of the GUI. Significant changes to the GUI code normally require new or updated tests.

bitcoingui.(h/cpp)

  • Represents the main window of the Bitcoin UI.

*model.(h/cpp)

  • The model. When it has a corresponding controller, it generally inherits from QAbstractTableModel. Models that are used by controllers as helpers inherit from other Qt classes like QValidator.
  • ClientModel is used by the main application bitcoingui and several models like peertablemodel.

*page.(h/cpp)

  • A controller. :NAMEpage.cpp generally includes :NAMEmodel.h and forms/:NAME.page.ui with a similar :NAME.

*dialog.(h/cpp)

  • Various dialogs, e.g. to open a URL. Inherit from QDialog.

paymentserver.(h/cpp)

  • (Deprecated) Used to process BIP21 payment URI requests. Also handles URI-based application switching (e.g. when following a bitcoin:... link from a browser).

walletview.(h/cpp)

  • Represents the view to a single wallet.

Other .h/cpp files

  • UI elements like BitcoinAmountField, which inherit from QWidget.
  • bitcoinstrings.cpp: automatically generated
  • bitcoinunits.(h/cpp): BTC / mBTC / etc. handling
  • callback.h
  • guiconstants.h: UI colors, app name, etc.
  • guiutil.h: several helper functions
  • macdockiconhandler.(h/mm): macOS dock icon handler
  • macnotificationhandler.(h/mm): display notifications in macOS

Contribute

See CONTRIBUTING.md for general guidelines.

Note: Do not change local/bitcoin_en.ts. It is updated automatically.

Using Qt Creator as an IDE

Qt Creator is a powerful tool which packages a UI designer tool (Qt Designer) and a C++ IDE into one application. This is especially useful if you want to change the UI layout.

Download Qt Creator

On Unix and macOS, Qt Creator can be installed through your package manager. Alternatively, you can download a binary from the Qt Website.

Note: If installing from a binary grabbed from the Qt Website: During the installation process, uncheck everything except for Qt Creator.

macOS
brew install qt-creator
Ubuntu & Debian
sudo apt-get install qtcreator

Setup Qt Creator

  1. Make sure you've installed all dependencies specified in your systems build instructions
  2. Follow the compile instructions for your system, run ./configure with the --enable-debug flag
  3. Start Qt Creator. At the start page, do: New -> Import Project -> Import Existing Project
  4. Enter bitcoin-qt as the Project Name and enter the absolute path to src/qt as Location
  5. Check over the file selection, you may need to select the forms directory (necessary if you intend to edit *.ui files)
  6. Confirm the Summary page
  7. In the Projects tab, select Manage Kits...

macOS

  • Under Kits: select the default "Desktop" kit
  • Under Compilers: select "Clang (x86 64bit in /usr/bin)"
  • Under Debuggers: select "LLDB" as debugger (you might need to set the path to your LLDB installation)

Ubuntu & Debian

Note: Some of these options may already be set

  • Under Kits: select the default "Desktop" kit
  • Under Compilers: select "GCC (x86 64bit in /usr/bin)"
  • Under Debuggers: select "GDB" as debugger
  1. While in the Projects tab, ensure that you have the bitcoin-qt executable specified under Run
  • If the executable is not specified: click "Choose...", navigate to src/qt, and select bitcoin-qt
  1. You're all set! Start developing, building, and debugging the Bitcoin Core GUI