dash/src/qt
Andrew Chow ed88ba72af Merge #17261: Make ScriptPubKeyMan an actual interface and the wallet to have multiple
3f373659d732a5b1e5fdc692a45b2b8179f66bec Refactor: Replace SigningProvider pointers with unique_ptrs (Andrew Chow)
3afe53c4039103670cec5f9cace897ead76e20a8 Cleanup: Drop unused GUI learnRelatedScripts method (Andrew Chow)
e2f02aa59e3402048269362ff692d49a6df35cfd Refactor: Copy CWallet signals and print function to LegacyScriptPubKeyMan (Andrew Chow)
c729afd0a3b74a3943e4c359270beaf3e6ff8a7b Box the wallet: Add multiple keyman maps and loops (Andrew Chow)
4977c30d59e88a3e5ee248144bcc023debcd895b refactor: define a UINT256_ONE global constant (Andrew Chow)
415afcccd3e5583defdb76e3a280f48e98983301 HD Split: Avoid redundant upgrades (Andrew Chow)
01b4511206e399981a77976deb15785d18db46ae Make UpgradeKeyMetadata work only on LegacyScriptPubKeyMan (Andrew Chow)
4a7e43e8460127a40a7895519587399feff3b682 Store p2sh scripts in AddAndGetDestinationForScript (Andrew Chow)
501acb5538008d98abe79288b92040bc186b93f3 Always try to sign for all pubkeys in multisig (Andrew Chow)
81610eddbc57c46ae243f45d73e715d509f53a6c List output types in an array in order to be iterated over (Andrew Chow)
eb81fc3ee58d3e88af36d8091b9e4017a8603b3c Refactor: Allow LegacyScriptPubKeyMan to be null (Andrew Chow)
fadc08ad944cad42e805228cdd58e0332f4d7184 Locking: Lock cs_KeyStore instead of cs_wallet in legacy keyman (Andrew Chow)
f5be479694d4dbaf59eef562d80fbeacb3bb7dc1 wallet: Improve CWallet:MarkDestinationsDirty (João Barbosa)

Pull request description:

  Continuation of wallet boxes project.

  Actually makes ScriptPubKeyMan an interface which LegacyScriptPubkeyMan. Moves around functions and things from CWallet into LegacyScriptPubKeyMan so that they are actually separate things without circular dependencies.

  ***

  Introducing the `ScriptPubKeyMan` (short for ScriptPubKeyManager) for managing scriptPubKeys and their associated scripts and keys. This functionality is moved over from `CWallet`. Instead, `CWallet` will have a pointer to a `ScriptPubKeyMan` for every possible address type, internal and external. It will fetch the correct `ScriptPubKeyMan` as necessary. When fetching new addresses, it chooses the `ScriptPubKeyMan` based on address type and whether it is change. For signing, it takes the script and asks each `ScriptPubKeyMan` for whether that `ScriptPubKeyMan` considers that script `IsMine`, whether it has that script, or whether it is able to produce a signature for it. If so, the `ScriptPubKeyMan` will provide a `SigningProvider` to the caller which will use that in order to sign.

  There is currently one `ScriptPubKeyMan` - the `LegacyScriptPubKeyMan`. Each `CWallet` will have only one `LegacyScriptPubKeyMan` with the pointers for all of the address types and change pointing to this `LegacyScriptPubKeyMan`. It is created when the wallet is loaded and all keys and metadata are loaded into it instead of `CWallet`. The `LegacyScriptPubKeyMan` is primarily made up of all of the key and script management that used to be in `CWallet`. For convenience, `CWallet` has a `GetLegacyScriptPubKeyMan` which will return the `LegacyScriptPubKeyMan` or a `nullptr` if it does not have one (not yet implemented, but callers will check for the `nullptr`). For purposes of signing, `LegacyScriptPubKeyMan`'s `GetSigningProvider` will return itself rather than a separate `SigningProvider`. This will be different for future `ScriptPubKeyMan`s.

  The `LegacyScriptPubKeyMan` will also handle the importing and exporting of keys and scripts instead of `CWallet`. As such, a number of RPCs have been limited to work only if a `LegacyScriptPubKeyMan` can be retrieved from the wallet. These RPCs are `sethdseed`, `addmultisigaddress`, `importaddress`, `importprivkey`, `importpubkey`, `importmulti`, `dumpprivkey`, and `dumpwallet`. Other RPCs which relied on the wallet for scripts and keys have been modified in order to take the `SigningProvider` retrieved from the `ScriptPubKeyMan` for a given script.

  Overall, these changes should not effect how everything actually works and the user should experience no difference between having this change and not having it. As such, no functional tests were changed, and the only unit tests changed were those that were directly accessing `CWallet` functions that have been removed.

  This PR is the last step in the [Wallet Structure Changes](https://github.com/bitcoin-core/bitcoin-devwiki/wiki/Wallet-Class-Structure-Changes).

ACKs for top commit:
  instagibbs:
    re-utACK 3f373659d7
  Sjors:
    re-utACK 3f373659d732a5b1e5fdc692a45b2b8179f66bec (it still compiles on macOS after https://github.com/bitcoin/bitcoin/pull/17261#discussion_r370377070)
  meshcollider:
    Tested re-ACK 3f373659d732a5b1e5fdc692a45b2b8179f66bec

Tree-SHA512: f8e2b8d9efa750b617691e8702d217ec4c33569ec2554a060141d9eb9b9a3a5323e4216938e2485c44625d7a6e0925d40dea1362b3af9857cf08860c2f344716
2023-03-19 11:08:31 -05:00
..
android
forms fix(gui): remove "Upgrade wallet format" button from "Wallet Repair" tab 2023-02-17 14:21:19 -06:00
locale Merge pull request #4478 from kittywhiskers/undashify 2022-08-11 12:34:55 -04:00
res Merge #20223: build: Drop the leading 0 from the version number 2022-04-28 13:47:53 +03:00
test Merge #17261: Make ScriptPubKeyMan an actual interface and the wallet to have multiple 2023-03-19 11:08:31 -05:00
addressbookpage.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
addressbookpage.h
addresstablemodel.cpp merge bitcoin#20480: Replace boost::variant with std::variant 2022-10-20 16:08:45 -05:00
addresstablemodel.h
appearancewidget.cpp chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
appearancewidget.h chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
askpassphrasedialog.cpp chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
askpassphrasedialog.h merge bitcoin#15450: Create wallet menu option 2022-04-06 13:49:58 +05:30
bantablemodel.cpp Merge #18036: gui: Break trivial circular dependencies 2022-10-16 13:06:40 -05:00
bantablemodel.h Merge #18036: gui: Break trivial circular dependencies 2022-10-16 13:06:40 -05:00
bitcoin.cpp trivial: revert dashification of source and header filenames 2022-08-09 14:16:29 +05:30
bitcoin.h trivial: revert dashification of header guards 2022-08-09 14:16:29 +05:30
bitcoinaddressvalidator.cpp chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
bitcoinaddressvalidator.h
bitcoinamountfield.cpp Merge #14608: qt: Remove the "Pay only required fee..." checkbox 2022-05-30 01:11:05 -04:00
bitcoinamountfield.h Merge #14608: qt: Remove the "Pay only required fee..." checkbox 2022-05-30 01:11:05 -04:00
bitcoingui.cpp fix(qt): Overview page should always be accessible (#5221) 2023-02-27 11:50:02 -06:00
bitcoingui.h revert: revert bitcoin#15454 (Remove the automatic creation and loading of the default wallet) 2022-12-04 18:02:40 -06:00
bitcoinunits.cpp chore: bump copyrights (#4873) 2022-06-08 02:36:46 +03:00
bitcoinunits.h chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
clientmodel.cpp refactor: migrate globals to managed pointers in preparation for deglobalization (#4930) 2022-08-26 16:52:53 -05:00
clientmodel.h refactor: migrate globals to managed pointers in preparation for deglobalization (#4930) 2022-08-26 16:52:53 -05:00
coincontroldialog.cpp Merge #15452: Replace CScriptID and CKeyID in CTxDestination with dedicated types 2023-02-10 23:34:57 +03:00
coincontroldialog.h
coincontroltreewidget.cpp
coincontroltreewidget.h
createwalletdialog.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
createwalletdialog.h Merge #16822: gui: Create wallet menu option follow-ups 2022-04-11 09:40:27 -07:00
csvmodelwriter.cpp
csvmodelwriter.h
dash_locale.qrc
dash.qrc
dashstrings.cpp merge bitcoin#21694: Use XLIFF file to provide more context to Transifex translators 2022-06-11 21:03:04 +05:30
editaddressdialog.cpp chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
editaddressdialog.h
governancelist.cpp chore: add missing copyrights via copyright_header.py insert 2023-01-13 00:49:04 +03:00
governancelist.h chore: add missing copyrights via copyright_header.py insert 2023-01-13 00:49:04 +03:00
guiconstants.h chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
guiutil.cpp merge bitcoin#21016: remove boost::thread_group usage 2023-01-19 03:42:51 +00:00
guiutil.h Merge #17826: qt: Log Qt related info 2022-06-17 04:06:49 +07:00
intro.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
intro.h Merge #15874: Resolve the qt/guiutil <-> qt/optionsmodel CD 2021-11-13 11:04:56 -05:00
macdockiconhandler.h
macdockiconhandler.mm
macnotificationhandler.h
macnotificationhandler.mm
macos_appnap.h
macos_appnap.mm
main.cpp trivial: revert dashification of source and header filenames 2022-08-09 14:16:29 +05:30
masternodelist.cpp feat(qt): add MN type to MN tab (#5201) 2023-02-15 22:59:54 +02:00
masternodelist.h feat(qt): add MN type to MN tab (#5201) 2023-02-15 22:59:54 +02:00
modaloverlay.cpp Merge #15084: gui: don't disable the sync overlay when wallet is disabled 2022-06-18 17:19:47 +05:30
modaloverlay.h Merge #15084: gui: don't disable the sync overlay when wallet is disabled 2022-06-18 17:19:47 +05:30
networkstyle.cpp chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
networkstyle.h chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
notificator.cpp
notificator.h partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
openuridialog.cpp chore: bump copyrights (#4873) 2022-06-08 02:36:46 +03:00
openuridialog.h merge #17165: Remove BIP70 support (#4023) 2022-04-25 12:01:47 +03:00
optionsdialog.cpp refactor: implement c++23 inspired ToUnderlying (#5210) 2023-02-20 13:12:12 +03:00
optionsdialog.h merge bitcoin#21328: pass uint16 CService::port as uint16 2022-11-01 00:28:53 -05:00
optionsmodel.cpp merge bitcoin#18134: Replace std::to_string with locale-independent alternative 2023-01-02 14:19:33 -06:00
optionsmodel.h merge bitcoin#19314: Use uint16_t instead of unsigned short 2022-10-20 16:08:45 -05:00
overviewpage.cpp merge bitcoin#21016: remove boost::thread_group usage 2023-01-19 03:42:51 +00:00
overviewpage.h
paymentserver.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
paymentserver.h partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
peertablemodel.cpp Merge #18060: gui: Drop PeerTableModel dependency to ClientModel 2022-10-16 13:06:40 -05:00
peertablemodel.h Merge #18060: gui: Drop PeerTableModel dependency to ClientModel 2022-10-16 13:06:40 -05:00
qrdialog.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
qrdialog.h refactor(qt): Reuse QRImageWidget in QRDialog (#4853) 2022-06-11 12:18:01 +03:00
qrimagewidget.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
qrimagewidget.h merge bitcoin#15928: Move QRImageWidget to its own file-pair 2021-12-12 20:32:49 +05:30
qvalidatedlineedit.cpp 16659 continuation 2021-12-17 12:02:16 -05:00
qvalidatedlineedit.h
qvaluecombobox.cpp
qvaluecombobox.h
README.md merge #17165: Remove BIP70 support (#4023) 2022-04-25 12:01:47 +03:00
receivecoinsdialog.cpp qt: adds more setPlaceholderText by form .ui instead code aproach 2022-05-30 19:09:39 +07:00
receivecoinsdialog.h
receiverequestdialog.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
receiverequestdialog.h merge bitcoin#15928: Move QRImageWidget to its own file-pair 2021-12-12 20:32:49 +05:30
recentrequeststablemodel.cpp Merge #17634: qt: Fix comparison function signature 2022-06-16 01:34:38 -04:00
recentrequeststablemodel.h Merge #17634: qt: Fix comparison function signature 2022-06-16 01:34:38 -04:00
rpcconsole.cpp refactor: implement c++23 inspired ToUnderlying (#5210) 2023-02-20 13:12:12 +03:00
rpcconsole.h fix(gui): remove "Upgrade wallet format" button from "Wallet Repair" tab 2023-02-17 14:21:19 -06:00
sendcoinsdialog.cpp Merge #16944: gui: create PSBT with watch-only wallet 2023-02-04 10:02:37 -06:00
sendcoinsdialog.h Merge #16944: gui: create PSBT with watch-only wallet 2023-02-04 10:02:37 -06:00
sendcoinsentry.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
sendcoinsentry.h
signverifymessagedialog.cpp Merge #15452: Replace CScriptID and CKeyID in CTxDestination with dedicated types 2023-02-10 23:34:57 +03:00
signverifymessagedialog.h
splashscreen.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
splashscreen.h merge #19099: refactor: Move wallet methods out of chain.h and node.h 2022-06-21 19:08:57 +05:30
trafficgraphdata.cpp chore: add missing copyrights via copyright_header.py insert 2023-01-13 00:49:04 +03:00
trafficgraphdata.h chore: add missing copyrights via copyright_header.py insert 2023-01-13 00:49:04 +03:00
trafficgraphwidget.cpp
trafficgraphwidget.h
transactiondesc.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
transactiondesc.h
transactiondescdialog.cpp
transactiondescdialog.h
transactionfilterproxy.cpp
transactionfilterproxy.h
transactionrecord.cpp merge bitcoin#20480: Replace boost::variant with std::variant 2022-10-20 16:08:45 -05:00
transactionrecord.h
transactiontablemodel.cpp Merge #15098: qt: Show addresses for "SendToSelf" transactions 2022-06-18 17:19:46 +05:30
transactiontablemodel.h
transactionview.cpp feat(qt): Let users resend stuck txes one by one via context menu (#4861) 2022-06-08 00:07:27 +03:00
transactionview.h feat(qt): Let users resend stuck txes one by one via context menu (#4861) 2022-06-08 00:07:27 +03:00
utilitydialog.cpp Merge #18036: gui: Break trivial circular dependencies 2022-10-16 13:06:40 -05:00
utilitydialog.h Merge #18036: gui: Break trivial circular dependencies 2022-10-16 13:06:40 -05:00
walletcontroller.cpp merge bitcoin#19619: Remove wallet.dat path handling from wallet.cpp, rpcwallet.cpp 2022-10-17 08:03:10 +05:30
walletcontroller.h merge bitcoin#16923: Handle duplicate fileid exception 2022-05-13 18:04:31 +05:30
walletframe.cpp fix(qt): Overview page should always be accessible (#5221) 2023-02-27 11:50:02 -06:00
walletframe.h fix(qt): Overview page should always be accessible (#5221) 2023-02-27 11:50:02 -06:00
walletmodel.cpp fix(qt): Ignore change output in reassignAmounts (#5182) 2023-02-09 03:19:49 +03:00
walletmodel.h partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
walletmodeltransaction.cpp fix(qt): Ignore change output in reassignAmounts (#5182) 2023-02-09 03:19:49 +03:00
walletmodeltransaction.h fix(qt): Ignore change output in reassignAmounts (#5182) 2023-02-09 03:19:49 +03:00
walletview.cpp Merge bitcoin-core/gui#11: Remove needless headers from qt/walletview.cpp 2023-01-22 00:27:52 -06:00
walletview.h Merge #18062: gui: Fix unintialized WalletView::progressDialog 2022-10-16 13:06:40 -05:00
winshutdownmonitor.cpp Merge #16263: qt: Use qInfo() if no error occurs 2021-11-18 15:30:54 -05:00
winshutdownmonitor.h

This directory contains the DashQT graphical user interface (GUI). It uses the cross-platform framework Qt.

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

Compile and run

See build instructions (macOS, Windows, Unix, etc).

To run:

./src/qt/dash-qt

Files and directories

forms

Contains Designer UI files. They are created with Qt Creator, but can be edited using any text editor.

locale

Contains translations. They are periodically updated. The process is described here.

res

Resources such as the icon.

test

Tests.

bitcoingui.(h/cpp)

Represents the main window of the Dash 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)

Used to process BIP21 payment URI requests. Also handles URI based application switching (e.g. when following a dash:... 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. Specifically for Qt:

Using Qt Creator as IDE

You can use Qt Creator as an IDE. This is especially useful if you want to change the UI layout.

Download and install the community edition of Qt Creator. Uncheck everything except Qt Creator during the installation process.

Instructions for macOS:

  1. Make sure you installed everything through Homebrew mentioned in the macOS build instructions
  2. Use ./configure with the --enable-debug flag
  3. In Qt Creator do "New Project" -> Import Project -> Import Existing Project
  4. Enter "dash-qt" as project name, enter src/qt as location
  5. Leave the file selection as it is
  6. Confirm the "summary page"
  7. In the "Projects" tab select "Manage Kits..."
  8. Select the default "Desktop" kit and select "Clang (x86 64bit in /usr/bin)" as compiler
  9. Select LLDB as debugger (you might need to set the path to your installation)
  10. Start debugging with Qt Creator (you might need to the executable to "dash-qt" under "Run", which is where you can also add command line arguments)