Refactor: separate gui from wallet and node #10244

pull ryanofsky wants to merge 21 commits into bitcoin:master from ryanofsky:pr/ipc-local changing 65 files +2250 −1087
  1. ryanofsky commented at 7:37 pm on April 20, 2017: member

    This is a refactoring PR that does not change behavior in any way. This change:

    1. Creates abstract Node and Wallet interfaces in src/interface/
    2. Updates Qt code to call the new interfaces. This largely consists of diffs of the form:
    0-    InitLogging();
    1-    InitParameterInteraction();
    2+    node.initLogging();
    3+    node.initParameterInteraction();
    

    This change allows followup PR #10102 (makes bitcoin-qt control bitcoind over an IPC socket) to work without any significant updates to Qt code. Additionally:

    • It provides a single place to describe the interface between GUI and daemon code.
    • It can make better GUI testing possible, because Node and Wallet objects have virtual methods that can be overloaded for mocking.
    • It can be used to help make the GUI more responsive (see #10504)

    Other notes:

    • I used python scripts hide-globals.py and replace-syms.py to identify all the places where Qt code was accessing libbitcoin global variables and calling functions accessing those global variables.
    • These changes were originally part of #10102. Thanks to @JeremyRubin for the suggestion of splitting them out.

    Commits:

  2. laanwj commented at 7:41 pm on April 20, 2017: member
    ClientModel and WalletModel were already meant as abstraction layer for accessing the core from the GUI. What is your rationale for adding another layer?
  3. ryanofsky commented at 7:47 pm on April 20, 2017: member

    ClientModel and WalletModel were already meant as abstraction layer for accessing the core from the GUI. What is your rationale for adding another layer?

    ClientModel and WalletModel might have been intended to be an abstraction layer, but they are not functioning like one. There are libbitcoin functions and global variables accessed all over Qt code right now. With this change, all of these calls (there are around 200 of them) are stripped out of Qt code and moved into a one file: src/ipc/local/interfaces.cpp.

  4. jonasschnelli commented at 7:48 pm on April 20, 2017: contributor

    I once did a similar thing,.. but stopped at some point and now I know why. It’s an impressive code change and I kinda like a central point (your interfaces.cpp) where communication between the node, the wallet and the GUI happens.

    I also agree with @laanwj that the clientmodel (node) and the walletmodal (wallet) are originally though to be that layer. Though, there are many violations AFAIK.

    What would be the downsides of using the exiting layers (clientmodel / walletmodel) better?

  5. jonasschnelli added the label GUI on Apr 20, 2017
  6. ryanofsky commented at 8:10 pm on April 20, 2017: member

    What would be the downsides of using the exiting layers (clientmodel / walletmodel) better?

    If you look at the ClientModel class, you can see it is doing a lot more work than the ipc::local::Node class is. Similarly with WalletModel and ipc::local::Wallet. The ipc classes are just simple shims around low-level node and wallet functionality, while Qt objects implement higher level logic specific to our current GUI. I think ClientModel and WalletModel classes are still useful after this change. They will just have 1 job instead of 2. Instead of serving as both abstraction layers and MVC model classes, they will serve only as MVC model classes.

    Also, and in more concrete terms, the reason these interfaces live outside the src/qt directory is that with #10102, they need to be accessed not only by bitcoin-qt but also by bitcoind (specifically inside the StartServer function in src/ipc/server.cpp which is called here: https://github.com/ryanofsky/bitcoin/commit/ab0afba3a44255b3eec80f4eebe45a851ae23927#diff-6e30027c2045842fe842430d98d099fb

  7. ryanofsky force-pushed on Apr 20, 2017
  8. jonasschnelli commented at 11:09 am on April 21, 2017: contributor
    The general IPC interface makes sense to me. The main problem I see for any type of low latency IPC/RPC is the missing asynchronity. Take getWalletTxDetails. This IPC call may take 2-3 seconds depending on the communication protocol and database you are using. Ideally the GUI is design to handle it asynchronous (like an RPC call) otherwise this will lead to GUI thread freezes. Not sure if this would be solvable as a generic part in the IPC layer of if the wallet/GUI logic must handle it.
  9. ryanofsky commented at 11:32 am on April 21, 2017: member

    The main problem I see for any type of low latency IPC/RPC is the missing asynchronity.

    Not sure if you saw the comments about this in the other pr starting here: #10102 (comment)

    These changes are orthogonal to event processing / blocking issues in the UI. If UI blocked before, it will still block after these changes, if UI didn’t block before, it won’t start blocking now because of these changes. If remote calls are too slow because of socket/serialization overhead, we can process UI events in the background while they are being made. There are many ways to accomplish this, with one possible way described in that comment above. If anything, having calls get funnelled through an IPC framework makes it easier, not harder to add more asynchronicity.

  10. ryanofsky commented at 11:50 am on April 21, 2017: member
    Also would point out that Node and Wallet interfaces in ipc/interfaces.h were mainly designed with goal of changing existing Qt code as little as possible. They aren’t in any way set in stone, and I would expect them to evolve over time. Probably some calls will get consolidated, others will get broken up, calls that currently return big chunks of data will be made streaming, etc.
  11. jonasschnelli commented at 11:51 am on April 21, 2017: contributor

    Thinking again and discussing this with @sipa / @laanwj, I think we should use the existing client-/walletmodal as node/wallet abstraction (including a possible IPC abstraction).

    What’s missing in the first place are better asynchronous messaging between the GUI and the wallet/node.

    IMO using a thread with queue for general node/wallet communication (and eventual additional threads for procedures that usually take longer) seems after a low hanging fruit with direct benefits.

    Using QT slots/signals for all(most?) communication would be required anyways and would be beneficial even without IPC and therefor should be done first.

  12. ryanofsky commented at 12:00 pm on April 21, 2017: member

    What’s missing in the first place are better asynchronous messaging between the GUI and the wallet/node.

    Again I think this is (and should be) an independent issue, but if you want to flesh out some more concrete suggestions and I would be happy to hear them.

    IMO using a thread with queue for general node/wallet communication (and eventual additional threads for procedures that usually take longer) seems after a low hanging fruit with direct benefits.

    This is exactly what the change I was suggesting in #10102 (comment) does.

  13. laanwj commented at 12:10 pm on April 21, 2017: member

    Using QT slots/signals for all(most?) communication would be required anyways and would be beneficial even without IPC and therefor should be done first.

    This was my point too. Making the GUI asynchronous would avoid ever hard-freezing the GUI. Modern operating systems assume that an application has crashed if its GUI thread is unresponsive. This is a priority for improving user experience. For example: Currently, if e.g. a transaction is sent while the cs_main lock is held the entire thing hangs for a moment. Ideally it would display a modal dialog with a status, or progress animation instead. There are similar issues at startup.

    Sure, this is only partially related to IPC work: When the GUI already would communicate with Qt signals and slots with the core backend (similar to how RPCConsole and RPCThread communicate, for example), it could be mostly oblivious whether this backend exists in-process or communicates over a pipe.

    Although it’s laudable that you’re working on this, it looks to me that what you are doing currently is simply replicating what we do now but replacing direct core calls with IPC calls. The drawback is that it calcifies some things that shouldn’t have been designed that way in the first place (e.g. into multiple abstraction layers), making it harder to improve later.

  14. ryanofsky commented at 12:59 pm on April 21, 2017: member

    The drawback is that it calcifies some things

    Could you be more concrete about this? I don’t see how it is true. Direct calls before are still direct calls now. If we want to follow the RPCConsole / RPCExecutor model in other parts of Qt code, I don’t see how any of the changes I’ve made for IPC make this more difficult.

  15. ryanofsky commented at 1:32 pm on April 21, 2017: member

    I had a look at discussion in IRC (https://botbot.me/freenode/bitcoin-core-dev/msg/84348426/)

    With respect, what I think you guys are missing on the WalletModel/ClientModel topic is that the ipc::local::WalletImpl and ipc::local::NodeImpl classes in ipc/local/interfaces.cpp are only temporarily being created and invoked within the bitcoin-qt process. In the next PR they are created and run in the bitcoind process instead of bitcoin-qt. That’s the reason these classes do not reside in the src/qt directory and one reason why they don’t really substitute for the WalletModel/ClientModel classes. See my previous comment for details and a code pointer: #10244 (comment).

    However, I do see that it is kind of silly to have cases where Qt code calls a WalletModel/ClientModel method that merely forwards to a WalletImpl/NodeImpl method. I can easily clear this up by inlining these WalletModel/ClientModel methods, which would make the classes more lean.

    Also, if this PR will be too difficult to review because of its size (https://botbot.me/freenode/bitcoin-core-dev/msg/84348447/), I can easily decompose it into smaller PRs that could be gradually merged. It is already broken up into separate commits, and many of the individual commits could be further broken up (right now they try to group together related changes).

  16. ryanofsky force-pushed on Apr 27, 2017
  17. ryanofsky force-pushed on Apr 27, 2017
  18. ryanofsky force-pushed on Apr 28, 2017
  19. ryanofsky force-pushed on Apr 28, 2017
  20. ryanofsky force-pushed on May 9, 2017
  21. ryanofsky force-pushed on May 17, 2017
  22. ryanofsky force-pushed on May 23, 2017
  23. ryanofsky force-pushed on May 24, 2017
  24. ryanofsky force-pushed on May 24, 2017
  25. ryanofsky force-pushed on May 24, 2017
  26. ryanofsky force-pushed on May 25, 2017
  27. ryanofsky force-pushed on May 25, 2017
  28. ryanofsky force-pushed on May 31, 2017
  29. ryanofsky force-pushed on May 31, 2017
  30. ryanofsky force-pushed on Jun 1, 2017
  31. ryanofsky force-pushed on Jun 1, 2017
  32. ryanofsky commented at 7:00 pm on June 1, 2017: member

    @laanwj and @jonasschnelli can you let me know if you still see issues with this approach?

    On the Qt model class issue, I pulled out a bunch of model methods that were just wrapping IPC calls so it should be clearer what actual work walletmodel.cpp and clientmodel.cpp are doing. I also added a little blurb to the IPC README describing what the distinction between Qt model classes and the IPC interface classes is supposed to be.

    On the asynchronous GUI issue, I created #10504 for more discussion, but think that issue is mostly unrelated to the changes in this PR, except as far as some changes here might potentially make it easier to identify blocking calls and make them asynchronous.

  33. laanwj added this to the "Blockers" column in a project

  34. ryanofsky force-pushed on Jun 2, 2017
  35. ryanofsky force-pushed on Jun 5, 2017
  36. ryanofsky force-pushed on Jun 12, 2017
  37. ryanofsky force-pushed on Jun 15, 2017
  38. laanwj commented at 1:38 pm on June 15, 2017: member
    Concept ACK on the approach, moving things to interfaces instead of global calls is usually good as it makes it easier to see what the interface to the core is.
  39. jonasschnelli commented at 1:58 pm on June 15, 2017: contributor
    Concept ACK. I think we could try to rebase and get this in once 0.15 has been split off
  40. ryanofsky referenced this in commit e7280bf8de on Jun 15, 2017
  41. ryanofsky referenced this in commit 3a43bb9487 on Jun 15, 2017
  42. ryanofsky force-pushed on Jun 15, 2017
  43. ryanofsky force-pushed on Jun 15, 2017
  44. ryanofsky force-pushed on Jun 19, 2017
  45. ryanofsky force-pushed on Jul 5, 2017
  46. laanwj removed this from the "Blockers" column in a project

  47. ryanofsky referenced this in commit 30d2100875 on Jul 11, 2017
  48. ryanofsky force-pushed on Jul 11, 2017
  49. ryanofsky referenced this in commit b937494640 on Jul 18, 2017
  50. ryanofsky force-pushed on Jul 19, 2017
  51. ryanofsky force-pushed on Jul 20, 2017
  52. ryanofsky force-pushed on Aug 14, 2017
  53. ryanofsky referenced this in commit 893b4c4692 on Aug 25, 2017
  54. ryanofsky force-pushed on Aug 25, 2017
  55. ryanofsky referenced this in commit 1ea3597452 on Aug 25, 2017
  56. ryanofsky force-pushed on Aug 25, 2017
  57. ryanofsky force-pushed on Sep 21, 2017
  58. ryanofsky force-pushed on Sep 21, 2017
  59. ryanofsky force-pushed on Sep 27, 2017
  60. ryanofsky force-pushed on Sep 28, 2017
  61. ryanofsky force-pushed on Sep 28, 2017
  62. ryanofsky force-pushed on Sep 28, 2017
  63. ryanofsky commented at 1:14 pm on November 1, 2017: member

    @promag re: https://botbot.me/freenode/bitcoin-core-dev/msg/92986206/

    <promag> to change the current wallet from widgets to qtquick would take several PR’s (which would sit there for a long time) <promag> dunno if the IPC PR from ryanofsky is going forward <promag> both require lots of changes to the wallet ui code <promag> that’s why I think adding IPC to glue a new wallet ui is probably easier <promag> we could have both bitcoin-qt and bitcoin-quick and later drop support for the first <promag> anyway, moving to qtquick is something IMHO we should plan

    I don’t think you need any IPC stuff for this. This PR by itself, which is a refactoring, provides interfaces for GUI code to access node&wallet state while being less tied to their internals. The Node and Wallet interfaces here would probably have to be extended in various ways to do things you’d want in a more modern UI, but they do provide a base of functionality that someone could use to implement one.

  64. MarcoFalke referenced this in commit 4ed818060e on Nov 15, 2017
  65. ryanofsky force-pushed on Nov 29, 2017
  66. ryanofsky force-pushed on Nov 29, 2017
  67. ryanofsky renamed this:
    [qt] Add abstraction layer for accessing node and wallet functionality from gui
    Refactor: separate gui from wallet and node
    on Dec 1, 2017
  68. ryanofsky force-pushed on Dec 1, 2017
  69. ryanofsky commented at 10:37 pm on December 1, 2017: member
  70. ryanofsky force-pushed on Dec 7, 2017
  71. ryanofsky force-pushed on Dec 7, 2017
  72. ryanofsky force-pushed on Dec 31, 2017
  73. ryanofsky force-pushed on Jan 4, 2018
  74. ryanofsky force-pushed on Jan 11, 2018
  75. ryanofsky force-pushed on Jan 11, 2018
  76. ryanofsky force-pushed on Jan 17, 2018
  77. jonasschnelli referenced this in commit 10d10d7fad on Jan 18, 2018
  78. ryanofsky force-pushed on Jan 22, 2018
  79. ryanofsky force-pushed on Feb 1, 2018
  80. ryanofsky force-pushed on Feb 9, 2018
  81. ryanofsky force-pushed on Feb 12, 2018
  82. ryanofsky force-pushed on Feb 14, 2018
  83. ryanofsky force-pushed on Feb 23, 2018
  84. ryanofsky force-pushed on Feb 26, 2018
  85. ryanofsky force-pushed on Mar 7, 2018
  86. in src/qt/bitcoin.cpp:29 in 9cdbd195ba outdated
    26@@ -27,16 +27,14 @@
    27 #endif
    28 
    29 #include <init.h>
    


    jamesob commented at 7:58 pm on March 8, 2018:

    Seems like we should be able to remove init.h inclusions from src/qt. I tried this removal locally and it compiles okay.

     0 $ git grep init.h src/qt
     1
     2src/qt/bitcoin.cpp:#include <init.h>
     3src/qt/bitcoingui.cpp:#include <init.h>
     4src/qt/coincontroldialog.cpp:#include <init.h>
     5src/qt/guiutil.cpp:#include <init.h>
     6src/qt/optionsmodel.cpp:#include <init.h>
     7src/qt/signverifymessagedialog.cpp:#include <init.h>
     8src/qt/splashscreen.cpp:#include <init.h>
     9src/qt/utilitydialog.cpp:#include <init.h>
    10src/qt/winshutdownmonitor.cpp:#include <init.h>
    

    jamesob commented at 7:48 pm on March 9, 2018:

    Oops, nevermind; the include should stay in some files:

    0 $ for i in Interrupt Shutdown ShutdownRequested InitParameter AppInit HelpMessageMode HelpMessage LicenseInfo; do git grep "${i}*()" src/qt | cut -d':' -f 1 | sort -u; done
    1
    2src/qt/bitcoin.cpp
    3src/qt/bitcoingui.cpp
    4src/qt/bitcoingui.h
    5src/qt/splashscreen.cpp
    6src/qt/winshutdownmonitor.cpp
    7src/qt/utilitydialog.cpp
    

    ryanofsky commented at 3:36 pm on March 13, 2018:

    #10244 (review)

    Seems like we should be able to remove init.h

    Removed in a few places in d5c84fdb9d1b6863018a3206e33bb4d57ce2b3fa, 990f4e4503d5f0eaaa3b724d2d9a2396c57a6ff1, and 2da306b742c4487b1fbcee75ece66f1d14a5dfc0.

  87. in src/interface/wallet.cpp:421 in 9cdbd195ba outdated
    416+            }
    417+        }
    418+        return result;
    419+    }
    420+    bool hdEnabled() override { return m_wallet.IsHDEnabled(); }
    421+    OutputType getDefaultAddressType() { return g_address_type; }
    


    jamesob commented at 8:47 pm on March 8, 2018:
    Needs override?

    ryanofsky commented at 3:43 pm on March 13, 2018:

    #10244 (review)

    Needs override?

    Added in 2a2c549eb7c45cff1ef21a9b1b3b9a5d1d1cec37.

  88. in src/interface/wallet.cpp:15 in 9ac4cfdf91 outdated
    10+#include <memory>
    11+#include <string>
    12+#include <utility>
    13+#include <vector>
    14+
    15+class CScheduler;
    


    jamesob commented at 9:42 pm on March 8, 2018:
    Unused?

    ryanofsky commented at 3:42 pm on March 13, 2018:

    #10244 (review)

    Unused?

    Removed in 3495f5a3a1f3fe587f9013442084a77955c3564b. I think this somehow got pulled in from my changes in #10973.

  89. in src/qt/peertablemodel.cpp:65 in bcd694497a outdated
    64             cachedNodeStats.clear();
    65-            std::vector<CNodeStats> vstats;
    66-            if(g_connman)
    67-                g_connman->GetNodeStats(vstats);
    68+
    69+            interface::Node::NodesStats nodes;
    


    jamesob commented at 2:48 pm on March 9, 2018:
    The naming of nodes is a little confusing (would expect it to be a vector of interface::Node instances), especially when elements of it are named node in the loop below. Does node_stats make more sense?

    ryanofsky commented at 3:36 pm on March 13, 2018:

    #10244 (review)

    The naming of nodes is a little confusing

    Renamed node and nodes in 2504665640b434fd150ffe0f04f7a3aade7de8d4.

  90. in src/qt/rpcconsole.cpp:895 in 07cdbb757f outdated
    869@@ -863,7 +870,7 @@ void RPCConsole::on_lineEdit_returnPressed()
    870         std::string strFilteredCmd;
    871         try {
    872             std::string dummy;
    873-            if (!RPCParseCommandLine(dummy, cmd.toStdString(), false, &strFilteredCmd)) {
    874+            if (!RPCParseCommandLine(nullptr, dummy, cmd.toStdString(), false, &strFilteredCmd)) {
    


    jamesob commented at 3:51 pm on March 9, 2018:
    Since we’re passing in nullptr for node here, is it worth adding && node to line 306 (or something similar) to be cautious?

    ryanofsky commented at 3:36 pm on March 13, 2018:

    #10244 (review)

    Since we’re passing in nullptr for node here, is it worth adding && node to line 306 (or something similar) to be cautious?

    Went with an assert in a0fa93d471a9deb986e4207dd09f679b655cae49

  91. in src/interface/wallet.cpp:90 in c664c43658 outdated
    85+    bool getPrivKey(const CKeyID& address, CKey& key) override { return m_wallet.GetKey(address, key); }
    86+    bool isSpendable(const CTxDestination& dest) override { return IsMine(m_wallet, dest) & ISMINE_SPENDABLE; }
    87+    bool haveWatchOnly() override { return m_wallet.HaveWatchOnly(); };
    88+    bool setAddressBook(const CTxDestination& dest, const std::string& name, const std::string& purpose) override
    89+    {
    90+        LOCK(m_wallet.cs_wallet);
    


    jamesob commented at 4:39 pm on March 9, 2018:
    Looks like this is already acquired as-needed in CWallet::SetAddressBook, but maybe this acquisition is intentional.

    ryanofsky commented at 3:39 pm on March 13, 2018:

    #10244 (review)

    Looks like this is already acquired as-needed in CWallet::SetAddressBook, but maybe this acquisition is intentional.

    Good catch, removed locks in setAddressBook and delAddressBook in 7fcc6e43025fb2692acdd722dab2ef9598711377 and a25886384f7c2e3f5b2f86ef28fd86d4ccc7e3d7.

  92. sipa commented at 5:29 pm on March 9, 2018: member

    After reading the discussion again, Concept ACK.

    While WalletModel and ClientModel were designed as an abstraction for the “core”, they’re incomplete in that regard (many direct calls bypass the abstraction), and a bit too high level (having significant logic of their own).

    I guess we can see this PR as introducing a perfect abstraction, with no logic of its own. @ryanofsky What do you think the future responsibilities of WalletModel and ClientModel should be? Should they be turned into logic on the core side (abstracted by the new interfaces), or just inlined into the calls sites inside the GUI?

  93. ryanofsky commented at 6:20 pm on March 9, 2018: member

    @ryanofsky What do you think the future responsibilities of WalletModel and ClientModel should be? Should they be turned into logic on the core signed, abstracted by the new interfaces, or just inlined into the calls sites inside the GUI?

    I think if model code is just calling interface functions it should probably be inlined. But if model code is doing something useful to support the gui, like caching, it should be kept. If there is model code that makes too many assumptions about node/wallet internals, or implements functionality that could be useful for RPCs, I think it should be moved into the core and wrapped by new interfaces.

    Example of code that could be inlined:

    https://github.com/bitcoin/bitcoin/blob/9cdbd195ba85b1af12fe8c55db3880df73e107ff/src/qt/walletmodel.cpp#L354-L366

    Example of code that should be kept:

    https://github.com/bitcoin/bitcoin/blob/9cdbd195ba85b1af12fe8c55db3880df73e107ff/src/qt/clientmodel.cpp#L73-L86

    An example of code that should be probably be moved into the core is a lot of the startup and config code in qt/bitcoin.cpp.

  94. in src/interface/node.cpp:204 in a5cbfc01b6 outdated
    192+        int* returned_target,
    193+        FeeReason* reason) override
    194+    {
    195+        FeeCalculation fee_calc;
    196+        CHECK_WALLET(return GetMinimumFee(tx_bytes, coin_control, ::mempool, ::feeEstimator, &fee_calc));
    197+        if (returned_target) *returned_target = fee_calc.returnedTarget;
    


    jamesob commented at 6:24 pm on March 9, 2018:
    Dead code?

    ryanofsky commented at 3:35 pm on March 13, 2018:

    #10244 (review)

    Dead code?

    The returned_target output isn’t used here but is needed a little later from SendCoinsDialog::updateSmartFeeLabel in the “Remove direct bitcoin calls from qt/sendcoinsdialog.cpp” commit.


    jamesob commented at 8:04 pm on March 13, 2018:
    Ah sorry, what I meant was that, because of the way CHECK_WALLET works, it doesn’t look like we’ll ever make it to this line or the one below it.

    ryanofsky commented at 8:45 pm on March 13, 2018:

    #10244 (review)

    Ah sorry, what I meant was that, because of the way CHECK_WALLET works, it doesn’t look like we’ll ever make it to this line or the one below it.

    :man_facepalming: Good catch, fixed in 8aced6d22ddf6cf2af6ed02ad8344b583c238b9f


    ryanofsky commented at 9:35 pm on March 13, 2018:

    #10244 (review)

    Previous comment looks a little odd in gmail. Github apparently tries to render :man_facepalming: as ['FACE PALM', 'ZERO WIDTH JOINER', 'MALE SIGN', 'VARIATION SELECTOR-16'] in unicode.

  95. in src/interface/wallet.h:277 in 9ec1240f5e outdated
    225+struct WalletAddress
    226+{
    227+    CTxDestination dest;
    228+    isminetype is_mine;
    229+    std::string name;
    230+    std::string purpose;
    


    jamesob commented at 6:37 pm on March 9, 2018:
    Could define a ctor here to avoid the emplace_back-related boilerplate above, but that’s just minor style.

    ryanofsky commented at 3:35 pm on March 13, 2018:

    #10244 (review)

    Could define a ctor here to avoid the emplace_back-related boilerplate above, but that’s just minor style.

    Nice, done in c6bf991ce90e8c290bff56f74de900f5b27af793.

  96. in src/interface/wallet.h:14 in ffe5e3487d outdated
    10@@ -11,6 +11,7 @@
    11 #include <functional>
    12 #include <map>
    13 #include <memory>
    14+#include <set>
    


    jamesob commented at 6:50 pm on March 9, 2018:
    Appears to be unused.

    ryanofsky commented at 3:38 pm on March 13, 2018:

    #10244 (review)

    Appears to be unused.

    Removed in 113a1bc44fa1df87e494b71ae5dd53567ab72f30

  97. in src/interface/wallet.h:312 in 80d9a255f6 outdated
    293+{
    294+    CTransactionRef tx;
    295+    std::vector<isminetype> txin_is_mine;
    296+    std::vector<isminetype> txout_is_mine;
    297+    std::vector<CTxDestination> txout_address;
    298+    std::vector<isminetype> txout_address_is_mine;
    


    jamesob commented at 7:11 pm on March 9, 2018:
    This may not be practical to change for legacy reasons, but I find the naming here confusing; it makes me think bool and not vector. Something like my_txout_addresses (and likewise for two others above) seems clearer.

    ryanofsky commented at 3:35 pm on March 13, 2018:

    #10244 (review)

    This may not be practical to change for legacy reasons, but I find the naming here confusing; it makes me think bool and not vector. Something like my_txout_addresses (and likewise for two others above) seems clearer.

    I think I disagree. A name like my_txout_addresses to me suggests a list of addresses, not a list of isminetype statuses. I think it should be pretty clear in context (e.g. wtx.txout_is_mine[i] or txout_is_mine.emplace_back) that these are vectors and not singular values, but it’s not a problem to to rename the struct members if there’s a different suggestion. Maybe it could be good to change the suffixes from _is_mine to _isminetype to make it clearer values are enums and not bools.


    jamesob commented at 8:06 pm on March 13, 2018:
    Oh, you’re totally right; I misunderstood the content of these vectors. Thanks for the clarification.
  98. jamesob commented at 7:40 pm on March 9, 2018: member

    Concept ACK

    This represents a good deal of progress towards decomposing the code into its three major subsystems, regardless of how or if we approach actual process separation. Consolidating and making explicit the interfaces these subsystems expose and depend on will make it easier to reason about the best way to move forward. Evaluating whether to use this or that IPC mechanism or how to approach GUI asynchronicity will be framed nicely by the low-risk, low-overhead boundaries that @ryanofsky has defined in this changeset. On top of that, there are numerous readability improvements, e.g. consolidating lock acquisition, extracting functions, and cleaning up naming. I think this is great work.

    I’ll be testing this thoroughly in the next few days.

  99. ryanofsky force-pushed on Mar 13, 2018
  100. ryanofsky commented at 6:42 pm on March 13, 2018: member

    @jamesob, thanks for the review, really appreciate you looking at this so thoroughly!


    Added 11 commits 9cdbd195ba85b1af12fe8c55db3880df73e107ff -> 7fcc6e43025fb2692acdd722dab2ef9598711377 (pr/ipc-local.53 -> pr/ipc-local.54, compare) Squashed 7fcc6e43025fb2692acdd722dab2ef9598711377 -> de2a1dca1a1e158b9352ff466cbd790ec9ef18ca (pr/ipc-local.54 -> pr/ipc-local.55)

  101. ryanofsky force-pushed on Mar 13, 2018
  102. ryanofsky commented at 9:08 pm on March 13, 2018: member
    Added 1 commits de2a1dca1a1e158b9352ff466cbd790ec9ef18ca -> 8aced6d22ddf6cf2af6ed02ad8344b583c238b9f (pr/ipc-local.55 -> pr/ipc-local.56, compare) Squashed 8aced6d22ddf6cf2af6ed02ad8344b583c238b9f -> 76ed998e79e21d1b2a524ec4850c91e03030f5fe (pr/ipc-local.56 -> pr/ipc-local.57) Rebased 76ed998e79e21d1b2a524ec4850c91e03030f5fe -> aa57e3dafaee4ec9383483997768d7db5ce8880a (pr/ipc-local.57 -> pr/ipc-local.58) due to conflict with #11041. Rebased aa57e3dafaee4ec9383483997768d7db5ce8880a -> 84e80629d10cb48009b84e131ee61e0a8b9ad171 (pr/ipc-local.58 -> pr/ipc-local.59) due to conflict with #9680.
  103. ryanofsky force-pushed on Mar 14, 2018
  104. in src/interface/node.cpp:55 in fc7de6d6fb outdated
    17+{
    18+    void parseParameters(int argc, const char* const argv[]) override
    19+    {
    20+        gArgs.ParseParameters(argc, argv);
    21+    }
    22+    void readConfigFile(const std::string& conf_path) override { gArgs.ReadConfigFile(conf_path); }
    


    Sjors commented at 3:36 pm on March 14, 2018:
    Tested that custom config files still work.
  105. in src/qt/bitcoin.cpp:185 in fc7de6d6fb outdated
    179@@ -178,11 +180,7 @@ class BitcoinCore: public QObject
    180 {
    181     Q_OBJECT
    182 public:
    183-    explicit BitcoinCore();
    184-    /** Basic initialization, before starting initialization/shutdown thread.
    185-     * Return true on success.
    


    Sjors commented at 3:58 pm on March 14, 2018:
    Nit: this comment disappeared?

    ryanofsky commented at 9:12 pm on March 15, 2018:

    #10244 (review)

    In commit “Remove direct bitcoin calls from qt/bitcoin.cpp”

    Nit: this comment disappeared?

    BitcoinCore::baseInitialize is replaced by Node::baseInitialize and I don’t think it’s helpful to mention gui threads in comments outside of the gui code, so the comment is different there. I could add a comment at the call site in the gui code, but there’s already a pretty good one there:

    https://github.com/bitcoin/bitcoin/blob/fc7de6d6fb8a73347f7bc97d57634e4627c66c2e/src/qt/bitcoin.cpp#L686-L689

    Anyway, happy to make improvements if there is a suggestion.

  106. in src/interface/node.cpp:67 in fc7de6d6fb outdated
    25+    void initParameterInteraction() override { InitParameterInteraction(); }
    26+    std::string getWarnings(const std::string& type) override { return GetWarnings(type); }
    27+    bool baseInitialize() override
    28+    {
    29+        return AppInitBasicSetup() && AppInitParameterInteraction() && AppInitSanityChecks() &&
    30+               AppInitLockDataDirectory();
    


    Sjors commented at 4:02 pm on March 14, 2018:
    Nice & short :-)
  107. in src/qt/bitcoin.cpp:296 in fc7de6d6fb outdated
    291@@ -313,8 +292,7 @@ void BitcoinCore::shutdown()
    292     try
    293     {
    294         qDebug() << __func__ << ": Running Shutdown in thread";
    295-        Interrupt();
    296-        Shutdown();
    297+        m_node.appShutdown();
    


    Sjors commented at 4:07 pm on March 14, 2018:
    Since this is inside a try {} catch it means exceptions can bubble up through the interface. Would that be useful to document in the interface header? Or should that be obvious?

    ryanofsky commented at 9:17 pm on March 15, 2018:

    #10244 (review)

    In commit “Remove direct bitcoin calls from qt/bitcoin.cpp”

    Since this is inside a try {} catch it means exceptions can bubble up through the interface. Would that be useful to document in the interface header? Or should that be obvious?

    I definitely think it’s useful to document when functions may throw specific exceptions (or when they are guaranteed not to throw). I’m not sure how useful it is just to document the fact that functions can throw exceptions. I think this is just a basic assumption in c++ when you haven’t disabled exceptions at compile time. Anyway, I’m happy to add a comment if you have a suggestion for one.

  108. in src/qt/optionsmodel.cpp:106 in a98a981367 outdated
    102@@ -108,27 +103,27 @@ void OptionsModel::Init(bool resetSettings)
    103 #ifdef ENABLE_WALLET
    104     if (!settings.contains("bSpendZeroConfChange"))
    105         settings.setValue("bSpendZeroConfChange", true);
    106-    if (!gArgs.SoftSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool()))
    107+    if (!m_node.softSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool()))
    


    Sjors commented at 5:31 pm on March 14, 2018:
    Tested that this still behaves, i.e. parameters override QT setting.
  109. in src/qt/optionsmodel.cpp:313 in a98a981367 outdated
    314-                StartMapPort();
    315-            } else {
    316-                InterruptMapPort();
    317-                StopMapPort();
    318-            }
    319+            m_node.mapPort(value.toBool());
    


    Sjors commented at 5:39 pm on March 14, 2018:
    I didn’t test, but refactor looks correct.
  110. in src/qt/bitcoin.cpp:598 in 2f54f5ae95 outdated
    587@@ -588,7 +588,7 @@ int main(int argc, char *argv[])
    588     // but before showing splash screen.
    589     if (gArgs.IsArgSet("-?") || gArgs.IsArgSet("-h") || gArgs.IsArgSet("-help") || gArgs.IsArgSet("-version"))
    590     {
    591-        HelpMessageDialog help(nullptr, gArgs.IsArgSet("-version"));
    592+        HelpMessageDialog help(*node, nullptr, gArgs.IsArgSet("-version"));
    


    Sjors commented at 5:59 pm on March 14, 2018:
    Tested that -version and --help still work
  111. in src/interface/node.cpp:268 in 8dc1a54f19 outdated
    81+    {
    82+        return MakeHandler(::uiInterface.ShowProgress.connect(fn));
    83+    }
    84+    std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) override
    85+    {
    86+        CHECK_WALLET(
    


    Sjors commented at 6:04 pm on March 14, 2018:

    Tested that “forgetting” #ifdef ENABLE_WALLET around a handleLoadWallet call indeed makes the compiler fail, although it may have failed due to something else. The error isn’t very clear:

    0Undefined symbols for architecture x86_64:
    1  "SplashScreen::ConnectWallet(std::__1::unique_ptr<interface::Wallet, std::__1::default_delete<interface::Wallet> >)", referenced from:
    2      std::__1::__function::__func<SplashScreen::subscribeToCoreSignals()::$_0, std::__1::allocator<SplashScreen::subscribeToCoreSignals()::$_0>, void (std::__1::unique_ptr<interface::Wallet, std::__1::default_delete<interface::Wallet> >)>::operator()(std::__1::unique_ptr<interface::Wallet, std::__1::default_delete<interface::Wallet> >&&) in libbitcoinqt.a(libbitcoinqt_a-splashscreen.o)
    3ld: symbol(s) not found for architecture x86_64
    

    Also checked that QT still works with --disable-wallet.


    ryanofsky commented at 9:06 pm on March 15, 2018:

    #10244 (review)

    In commit “Remove direct bitcoin calls from qt/splashscreen.cpp”

    The error isn’t very clear

    That error isn’t directly related to this code. If you disabled the same #ifdef on master while still including wallet/wallet.h you would see the error. The error is just saying that the code can’t be linked because it is taking the address of a function (SplashScreen::ConnectWallet) that isn’t defined.

    If you want to test the runtime error in this method, you could try disabling the same #ifdef and passing a null function pointer in.

    Note that I would like to get rid of the checks for the ENABLE_WALLET macro both in this function and its caller. But the refactoring required to do this would make this PR bigger and require changes to both gui code and wallet code instead of just gui code, so I’ve opted towards a compromise for now that avoids any uses ENABLE_WALLET in the Node interface definition, but does fall back to them in a few places in the implementation.

  112. in src/interface/node.cpp:184 in bd0f3916aa outdated
    109+            LOCK(::cs_main);
    110+            tip = ::chainActive.Tip();
    111+        }
    112+        return GuessVerificationProgress(::Params().TxData(), tip);
    113+    }
    114+    bool isInitialBlockDownload() override { return IsInitialBlockDownload(); }
    


    Sjors commented at 6:19 pm on March 14, 2018:
    Tested that IDB progress indicators still work.
  113. in src/qt/bitcoingui.cpp:754 in bd0f3916aa outdated
    731@@ -732,7 +732,7 @@ void BitcoinGUI::updateNetworkState()
    732 
    733     QString tooltip;
    734 
    735-    if (clientModel->getNetworkActive()) {
    736+    if (m_node.getNetworkActive()) {
    


    Sjors commented at 6:21 pm on March 14, 2018:
    Tested that network connections count tooltip still works and that I can toggle the connection.
  114. in src/interface/node.cpp:148 in bd0f3916aa outdated
    70@@ -65,6 +71,56 @@ class NodeImpl : public Node
    71     }
    72     std::string helpMessage(HelpMessageMode mode) override { return HelpMessage(mode); }
    73     bool getProxy(Network net, proxyType& proxy_info) override { return GetProxy(net, proxy_info); }
    74+    size_t getNodeCount(CConnman::NumConnections flags) override
    75+    {
    76+        return g_connman ? g_connman->GetNodeCount(flags) : 0;
    77+    }
    78+    int64_t getTotalBytesRecv() override { return g_connman ? g_connman->GetTotalBytesRecv() : 0; }
    


    Sjors commented at 6:22 pm on March 14, 2018:
    Tested that peers tab still shows bytes sent / received per peer.
  115. in src/interface/node.cpp:117 in a82693c0bd outdated
    101@@ -101,6 +102,14 @@ class NodeImpl : public Node
    102         }
    103         return false;
    104     }
    105+    bool getBanned(banmap_t& banmap) override
    


    Sjors commented at 6:29 pm on March 14, 2018:
    Tested that I’m able to ban and unban peers in the UI (TIL about that feature).
  116. in src/interface/node.cpp:125 in 9b73244060 outdated
    111@@ -110,6 +112,29 @@ class NodeImpl : public Node
    112         }
    113         return false;
    114     }
    115+    bool ban(const CNetAddr& net_addr, BanReason reason, int64_t ban_time_offset) override
    


    Sjors commented at 6:32 pm on March 14, 2018:
    Did you mean to do this ban stuff in a82693c0bdda423c23aa607d9c696b9c9aeff7a2? Or is it here because banning from the RPC console interacts with the ban table UI?

    ryanofsky commented at 9:07 pm on March 15, 2018:

    #10244 (review)

    In commit “Remove direct bitcoin calls from qt/rpcconsole.cpp”

    Did you mean to do this ban stuff in a82693c? Or is it here because banning from the RPC console interacts with the ban table UI?

    The ban() function is only called from rpcconsole.cpp, not bantablemodel.cpp, and since the changes in this PR are grouped by file, it’s in the rpcconsole.cpp commit 9b73244060ae47d7dddee1c9e63c4d1f704685cd rather than bantablemodel.cpp commit a82693c0bdda423c23aa607d9c696b9c9aeff7a2.

  117. in src/qt/rpcconsole.cpp:680 in 9b73244060 outdated
    672@@ -665,7 +673,7 @@ void RPCConsole::setClientModel(ClientModel *model)
    673 
    674         //Setup autocomplete and attach it
    675         QStringList wordList;
    676-        std::vector<std::string> commandList = tableRPC.listCommands();
    677+        std::vector<std::string> commandList = m_node.listRpcCommands();
    


    Sjors commented at 6:34 pm on March 14, 2018:
    Tested that console autocomplete still works.
  118. in src/interface/node.cpp:243 in 16123b1818 outdated
    193@@ -192,6 +194,18 @@ class NodeImpl : public Node
    194     std::vector<std::string> listRpcCommands() override { return ::tableRPC.listCommands(); }
    195     void rpcSetTimerInterfaceIfUnset(RPCTimerInterface* iface) override { RPCSetTimerInterfaceIfUnset(iface); }
    196     void rpcUnsetTimerInterface(RPCTimerInterface* iface) override { RPCUnsetTimerInterface(iface); }
    197+    std::vector<std::unique_ptr<Wallet>> getWallets() override
    198+    {
    199+#ifdef ENABLE_WALLET
    200+        std::vector<std::unique_ptr<Wallet>> wallets;
    201+        for (CWalletRef wallet : ::vpwallets) {
    202+            wallets.emplace_back(MakeWallet(*wallet));
    


    Sjors commented at 8:09 pm on March 14, 2018:
    Has anyone tested a rebased #11383 or #12610 with this?

    ryanofsky commented at 9:07 pm on March 15, 2018:

    #10244 (review)

    In commit “Remove most direct bitcoin calls from qt/walletmodel.cpp”

    Has anyone tested a rebased #11383 or #12610 with this?

    I assume one of those PRs will be merged before this one, but this PR will work fine with either of them. This PR just replaces CWallet references in GUI code with interface::Wallet references, and tweaks calls to wallet methods and access to wallet globals like ::vpwallets to go through the interface. This is pretty straightforward to do regardless of the multiwallet implementation.

  119. in src/interface/wallet.cpp:124 in 16123b1818 outdated
    62 public:
    63     WalletImpl(CWallet& wallet) : m_wallet(wallet) {}
    64 
    65+    bool encryptWallet(const SecureString& wallet_passphrase) override
    66+    {
    67+        return m_wallet.EncryptWallet(wallet_passphrase);
    


    Sjors commented at 8:30 pm on March 14, 2018:
    I tested encrypting a wallet and using it to send.
  120. in src/interface/wallet.cpp:227 in 16123b1818 outdated
    146+                fail_reason, coin_control, sign)) {
    147+            return {};
    148+        }
    149+        return std::move(pending);
    150+    }
    151+    bool transactionCanBeAbandoned(const uint256& txid) override { return m_wallet.TransactionCanBeAbandoned(txid); }
    


    Sjors commented at 8:31 pm on March 14, 2018:
    I tested bumping the fee.
  121. in src/interface/wallet.cpp:231 in 16123b1818 outdated
    150+    }
    151+    bool transactionCanBeAbandoned(const uint256& txid) override { return m_wallet.TransactionCanBeAbandoned(txid); }
    152+    bool abandonTransaction(const uint256& txid) override
    153+    {
    154+        LOCK2(cs_main, m_wallet.cs_wallet);
    155+        return m_wallet.AbandonTransaction(txid);
    


    Sjors commented at 8:33 pm on March 14, 2018:
    I tested abandoning a transaction (after bumping it)
  122. in src/interface/wallet.cpp:144 in 16123b1818 outdated
    77+    }
    78+    bool backupWallet(const std::string& filename) override { return m_wallet.BackupWallet(filename); }
    79+    bool getPubKey(const CKeyID& address, CPubKey& pub_key) override { return m_wallet.GetPubKey(address, pub_key); }
    80+    bool getPrivKey(const CKeyID& address, CKey& key) override { return m_wallet.GetKey(address, key); }
    81+    bool isSpendable(const CTxDestination& dest) override { return IsMine(m_wallet, dest) & ISMINE_SPENDABLE; }
    82+    bool haveWatchOnly() override { return m_wallet.HaveWatchOnly(); };
    


    Sjors commented at 8:36 pm on March 14, 2018:
    I didn’t check any of the watch-only and isMine stuff.
  123. in src/qt/sendcoinsdialog.cpp:196 in 16123b1818 outdated
    194@@ -193,7 +195,7 @@ void SendCoinsDialog::setModel(WalletModel *_model)
    195             settings.remove("nSmartFeeSliderPosition");
    196         }
    197         if (settings.value("nConfTarget").toInt() == 0)
    198-            ui->confTargetSelector->setCurrentIndex(getIndexForConfTarget(model->getDefaultConfirmTarget()));
    199+            ui->confTargetSelector->setCurrentIndex(getIndexForConfTarget(model->node().getTxConfirmTarget()));
    


    Sjors commented at 8:39 pm on March 14, 2018:
    Are you sure this is correct? Not sure how ::nTxConfirmTarget relates to getDefaultConfirmTarget

    ryanofsky commented at 9:09 pm on March 15, 2018:

    #10244 (review)

    In commit “Remove most direct bitcoin calls from qt/walletmodel.cpp”

    Are you sure this is correct? Not sure how ::nTxConfirmTarget relates to getDefaultConfirmTarget

    Yes, they are the same. Names aren’t the same because I wanted the new method name to match the name of the existing global variable:

    https://github.com/bitcoin/bitcoin/blob/6acd8700bc0ee1d10207a362c1e07372ba274041/src/qt/walletmodel.cpp#L742-L745

    https://github.com/bitcoin/bitcoin/blob/16123b181840d93ff2107313546e6d0fa3971583/src/interface/node.cpp#L184

    The relevant commit is 16123b181840d93ff2107313546e6d0fa3971583 (you have to expand the walletmodel.cpp diff to see it in github).

  124. in src/qt/walletmodel.cpp:507 in 16123b1818 outdated
    422@@ -502,21 +423,21 @@ static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly
    423 void WalletModel::subscribeToCoreSignals()
    424 {
    425     // Connect signals to wallet
    426-    wallet->NotifyStatusChanged.connect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1));
    427-    wallet->NotifyAddressBookChanged.connect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6));
    


    Sjors commented at 8:43 pm on March 14, 2018:
    Why is _6 dropped here?

    ryanofsky commented at 9:14 pm on March 15, 2018:

    #10244 (review)

    In commit “Remove most direct bitcoin calls from qt/walletmodel.cpp”

    Why is _6 dropped here?

    The signature of NotifyAddressBookChanged is changed above. Instead of receiving both WalletModel and CWallet pointers, it now only receives a WalletModel pointer, which wraps access to the underlying wallet:

    https://github.com/bitcoin/bitcoin/blob/1a54b215a94b0cd8f922eb2e062ea99aa0b25242/src/qt/walletmodel.cpp#L463-L465

    https://github.com/bitcoin/bitcoin/blob/16123b181840d93ff2107313546e6d0fa3971583/src/qt/walletmodel.cpp#L385-L387

  125. in src/interface/wallet.cpp:151 in 18104eb9b1 outdated
     98@@ -95,6 +99,10 @@ class WalletImpl : public Wallet
     99     {
    100         return m_wallet.SetAddressBook(dest, name, purpose);
    101     }
    102+    bool delAddressBook(const CTxDestination& dest) override
    103+    {
    104+        return m_wallet.DelAddressBook(dest);
    


    Sjors commented at 8:47 pm on March 14, 2018:
    Tested using and deleting entries from address book.
  126. in src/qt/bitcoin.cpp:639 in a728cf8dac outdated
    629@@ -630,7 +630,7 @@ int main(int argc, char *argv[])
    630     }
    631 #ifdef ENABLE_WALLET
    632     // Parse URIs on command line -- this can affect Params()
    633-    PaymentServer::ipcParseCommandLine(argc, argv);
    634+    PaymentServer::ipcParseCommandLine(*node, argc, argv);
    


    Sjors commented at 8:49 pm on March 14, 2018:
    Lightly tested BIP-21 URI.
  127. Sjors approved
  128. Sjors commented at 8:53 pm on March 14, 2018: member

    tACK 84e80629d to the degree that I understand the code.

    This change makes code easier to understand for me. The interfaces could use more documentation, especially the various initialization steps, but that can wait. Thanks for splitting into incremental commits; that did make review less daunting.

    Since QT doesn’t have amazing test coverage, I left a bunch of comments on stuff I manually tested. Those are FYI or asking for clarification, unless clearly marked otherwise.

    I encountered a situation once where I was unable to change tabs (macOS). I had to switch to master, compile and then switch back to your branch and compile again to make it work again. Could be unrelated, but I’ve never seen that before.

    schermafbeelding 2018-03-14 om 16 10 27

  129. meshcollider commented at 9:40 pm on March 14, 2018: contributor
    Concept ACK, on my to-do list to review
  130. ryanofsky commented at 4:19 pm on March 16, 2018: member
    Thank you for the review and testing!
  131. jamesob commented at 8:23 pm on March 23, 2018: member
    Going to hold off on testing this one until it’s rebased.
  132. ryanofsky force-pushed on Mar 23, 2018
  133. ryanofsky commented at 9:48 pm on March 23, 2018: member

    Going to hold off on testing this one until it’s rebased.

    Rebased 84e80629d10cb48009b84e131ee61e0a8b9ad171 -> b39555ae6eeb205706922766463a80cfe09153be (pr/ipc-local.59 -> pr/ipc-local.60) Rebased b39555ae6eeb205706922766463a80cfe09153be -> 19a268c1f500e0c8793da6714a9d093d57bfe8f7 (pr/ipc-local.60 -> pr/ipc-local.61)

  134. ryanofsky force-pushed on Mar 26, 2018
  135. in src/interface/node.cpp:92 in 19a268c1f5 outdated
    83+    bool getProxy(Network net, proxyType& proxy_info) override { return GetProxy(net, proxy_info); }
    84+    size_t getNodeCount(CConnman::NumConnections flags) override
    85+    {
    86+        return g_connman ? g_connman->GetNodeCount(flags) : 0;
    87+    }
    88+    bool getNodesStats(NodesStats& stats) override
    


    jamesob commented at 6:17 pm on March 26, 2018:
    Tested viewing peers and associated node stats via debug window.
  136. in src/interface/node.cpp:125 in 19a268c1f5 outdated
    116+            g_connman->GetBanned(banmap);
    117+            return true;
    118+        }
    119+        return false;
    120+    }
    121+    bool ban(const CNetAddr& net_addr, BanReason reason, int64_t ban_time_offset) override
    


    jamesob commented at 6:19 pm on March 26, 2018:
    Tested banning a peer via Debug window -> Peers.
  137. in src/interface/node.cpp:133 in 19a268c1f5 outdated
    124+            g_connman->Ban(net_addr, reason, ban_time_offset);
    125+            return true;
    126+        }
    127+        return false;
    128+    }
    129+    bool unban(const CSubNet& ip) override
    


    jamesob commented at 6:19 pm on March 26, 2018:
    Tested unbanning a peer via Debug window -> Peers.
  138. in src/interface/node.cpp:141 in 19a268c1f5 outdated
    132+            g_connman->Unban(ip);
    133+            return true;
    134+        }
    135+        return false;
    136+    }
    137+    bool disconnect(NodeId id) override
    


    jamesob commented at 6:19 pm on March 26, 2018:
    Tested disconnecting a peer via Debug window -> Peers.
  139. jamesob approved
  140. jamesob commented at 9:56 pm on March 26, 2018: member

    Tested ACK https://github.com/bitcoin/bitcoin/pull/10244/commits/19a268c1f500e0c8793da6714a9d093d57bfe8f7

    Left a few inline comments indicating things I manually tested, but quickly gave that up in favor of documenting a manual test plan:

    • Send: tested sending a transaction to self with automatic coin selection
      • Select custom fee, minimum fee display (getMinimumFee)
      • Use recommended fee for 2 block conf. time (estimateSmartFee)
    • Transactions -> right click on row -> Increase transaction fee: after sending with recommended fee, test bumping the fee
    • Send: tested sending a transaction to self with manual coin selection, custom fee address, subtract fee from amount, RBF enabled
    • Send -> Choose previously used address -> New: append to the address book
      • Found (and subsequently abandoned) #12796
    • Send -> Choose previously used address: delete from the address book
    • Settings -> Encrypt Wallet…: encrypt existing wallet
    • Send: send from encrypted wallet
    • Settings -> Change Passphrase…: change wallet passphrase
    • Send -> Coin Control Features -> Inputs: lock/unlock UTXO from the coin selection interface
    • Transactions -> right click on row -> Edit label: edit transaction label after send (failed)
      • Fails on master as well, will investigate and maybe file a bug later

    I’ve spent the better part of the day in QT (Ubuntu 17.10) with this changeset and I wasn’t able to find any issues. Nice work!

  141. in src/qt/walletmodel.cpp:80 in 19a268c1f5 outdated
    79@@ -120,52 +80,30 @@ void WalletModel::pollBalanceChanged()
    80     // Get required locks upfront. This avoids the GUI from getting stuck on
    


    jnewbery commented at 4:39 pm on March 27, 2018:
    I think this comment is now invalid Get required locks upfront...

    ryanofsky commented at 3:39 pm on March 30, 2018:

    #10244 (review)

    I think this comment is now invalid Get required locks upfront…

    Thanks, updated comment in 21af27fce86a7332f61eaa848f1322fd895186e3.

  142. in src/qt/walletmodel.cpp:372 in 19a268c1f5 outdated
    369 }
    370 
    371 bool WalletModel::changePassphrase(const SecureString &oldPass, const SecureString &newPass)
    372 {
    373     bool retval;
    374     {
    


    jnewbery commented at 4:53 pm on March 27, 2018:
    Any reason to leave this code block in, now that LOCK has been removed? Also, can you just return m_wallet->changeWalletPassphrase(oldPass, newPass) rather than have in intermediary bool?

    ryanofsky commented at 3:39 pm on March 30, 2018:

    #10244 (review)

    Any reason to leave this code block in

    Cleaned up in b567137579942826a3dd80d0af21b651728f379e

  143. in src/qt/walletmodel.cpp:22 in 19a268c1f5 outdated
    14@@ -15,6 +15,8 @@
    15 #include <qt/transactiontablemodel.h>
    16 
    17 #include <chain.h>
    18+#include <interface/handler.h>
    19+#include <interface/node.h>
    20 #include <key_io.h>
    21 #include <keystore.h>
    22 #include <validation.h>
    


    jnewbery commented at 5:04 pm on March 27, 2018:

    You no longer need the following includes:

    • consensus/validation.h
    • chain.h
    • keystore.h
    • validation.h
    • net.h
    • policy/fees.h
    • policy/rbf.h
    • sync.h
    • ui_interface.h
    • util.h
    • wallet/wallet.h
    • wallet/feebumper.h
    • wallet/walletdb.h

    In fact, there are many headers that no longer need to be included in lots of the qt files. Perhaps worth adding a commit at the end of this PR to remove them?


    ryanofsky commented at 3:39 pm on March 30, 2018:

    #10244 (review)

    You no longer need the following includes:

    Thanks, ran IWYU in 901ffe77d75e318458dc7544b822181515498265, which got rid of everything you listed except:

    0+#include <ui_interface.h>                 // for ChangeType, CClientUIInterface
    1+#include <util.h>                         // for ArgsManager, gArgs
    2+#include <wallet/wallet.h>                // for CRecipient, DEFAULT_DISABLE...
    
  144. in src/interface/wallet.h:286 in 19a268c1f5 outdated
    277+    {
    278+    }
    279+};
    280+
    281+//! Collection of wallet balances.
    282+struct WalletBalances
    


    jnewbery commented at 5:18 pm on March 27, 2018:
    Would it make sense to update the SetBalance() functions to take a WalletBalances as their arguments?

    ryanofsky commented at 3:38 pm on March 30, 2018:

    #10244 (review)

    Would it make sense to update the SetBalance() functions to take a WalletBalances as their arguments?

    Done in a415fa2845f843db2ceb6512537cbb2e63b5b474

  145. jnewbery commented at 6:45 pm on March 27, 2018: member

    Tested ACK 025e11b7e800de8265c33fa8efdc035282524dcd

    There’s too much code here for me to closely review all the changes, but I’ve had a look through all the commits and kicked the tires. We’d preferably get this PR merged early in a release cycle to get plenty of soaking.

    This is definitely a big step in the right direction in clearly splitting qt from node code.

  146. ryanofsky force-pushed on Mar 31, 2018
  147. ryanofsky commented at 10:51 am on March 31, 2018: member

    Rebased 19a268c1f500e0c8793da6714a9d093d57bfe8f7 -> 6ddaaaabfec1df43857089cfd232548d0952cb21 (pr/ipc-local.61 -> pr/ipc-local.62) Added 4 commits 6ddaaaabfec1df43857089cfd232548d0952cb21 -> a415fa2845f843db2ceb6512537cbb2e63b5b474 (pr/ipc-local.62 -> pr/ipc-local.63, compare) implementing jnewbery review suggestions Squashed a415fa2845f843db2ceb6512537cbb2e63b5b474 -> d792df74338771174087480a70a7ad48e4e79ab7 (pr/ipc-local.63 -> pr/ipc-local.64)


    Added 2 commits d792df74338771174087480a70a7ad48e4e79ab7 -> 9948724c84ba6e31d106c6dae2c901fdc4e85a9c (pr/ipc-local.64 -> pr/ipc-local.65, compare) to finish WalletBalances suggestion from jnewbery and address blocking GUI concerns from laanwj Squashed 9948724c84ba6e31d106c6dae2c901fdc4e85a9c -> 4bf295201d0f1059d9670329cb412fd074910319 (pr/ipc-local.65 -> pr/ipc-local.66)

  148. ryanofsky force-pushed on Apr 2, 2018
  149. ryanofsky referenced this in commit d792df7433 on Apr 2, 2018
  150. ryanofsky force-pushed on Apr 2, 2018
  151. ryanofsky referenced this in commit 3bf8ff616c on Apr 2, 2018
  152. jnewbery commented at 7:54 pm on April 2, 2018: member
    Needs rebase to fix unrelated travis failure
  153. ryanofsky force-pushed on Apr 2, 2018
  154. ryanofsky referenced this in commit 32ef63ce48 on Apr 2, 2018
  155. ryanofsky commented at 8:32 pm on April 2, 2018: member

    Needs rebase to fix unrelated travis failure

    Rebased 4bf295201d0f1059d9670329cb412fd074910319 -> e73a9f589f6ddeb0e350d887cd1f98fc55aac632 (pr/ipc-local.66 -> pr/ipc-local.67). Looks like failure in mempool_persist test: https://travis-ci.org/bitcoin/bitcoin/jobs/361243719#L2810

  156. jnewbery commented at 8:45 pm on April 2, 2018: member

    Looks like failure in mempool_persist test

    Ah. The new linter lint-include-guards was also failing, which is what required a rebase.

    I think mempool_persist was broken by https://github.com/bitcoin/bitcoin/commit/cb1e319fe9e198c9c5cf5236fe9af5a3d748b9e8. Will open an issue.

  157. Add src/interface/README.md ea73b84d2d
  158. ryanofsky force-pushed on Apr 3, 2018
  159. ryanofsky referenced this in commit bb6011ba38 on Apr 3, 2018
  160. ryanofsky commented at 6:43 pm on April 3, 2018: member
    Rebased e73a9f589f6ddeb0e350d887cd1f98fc55aac632 -> 4678ff464f03c09feb0e237343f2af329293343a (pr/ipc-local.67 -> pr/ipc-local.68) due to conflict with #12846.
  161. ryanofsky commented at 6:52 pm on April 3, 2018: member

    @laanwj or @jonasschnelli I wonder if it may be a good time to merge this given recent testing and discussion (https://botbot.me/freenode/bitcoin-core-dev/msg/98388625/). Review status:

    Tested ACKs

    • jnewbery #10244#pullrequestreview-107372769, partial code review
    • jamesob #10244#pullrequestreview-107016963
    • Sjors #10244#pullrequestreview-103872908

    Concept ACKs

    All the changes in this PR are limited to the GUI code and only affect bitcoin-qt (not bitcoind).

  162. jamesob commented at 7:27 pm on April 3, 2018: member

    Tested ACK https://github.com/bitcoin/bitcoin/pull/10244/commits/4678ff464f03c09feb0e237343f2af329293343a

    Ran through the same test plan I posted above earlier.

  163. Sjors commented at 1:13 pm on April 4, 2018: member
    Some linter unhappiness:
  164. jnewbery commented at 1:23 pm on April 4, 2018: member

    Some linter unhappiness

    Rebasing on master will resolve this.

    Edit: oops, not true.

  165. Remove direct bitcoin calls from qt/bitcoin.cpp 71e0d90876
  166. Remove direct bitcoin calls from qt/optionsmodel.cpp c0f2756be5
  167. Remove direct bitcoin calls from qt/bitcoingui.cpp 3d619e9d36
  168. Remove direct bitcoin calls from qt/utilitydialog.cpp c2f672fb19
  169. Remove direct bitcoin calls from qt/splashscreen.cpp 5fba3af21e
  170. Remove direct bitcoin calls from qt/clientmodel.cpp fe6f27e6ea
  171. Remove direct bitcoin calls from qt/intro.cpp d7c2c95948
  172. Remove direct bitcoin calls from qt/peertablemodel.cpp e0b66a3b7c
  173. Remove direct bitcoin calls from qt/bantablemodel.cpp 3034a462a5
  174. Remove direct bitcoin calls from qt/rpcconsole.cpp 582daf6d22
  175. Remove direct bitcoin calls from qt/optionsdialog.cpp 90d4640b7e
  176. Remove most direct bitcoin calls from qt/walletmodel.cpp a0704a8996
  177. Remove direct bitcoin calls from qt/coincontroldialog.cpp 827de038ab
  178. Remove direct bitcoin calls from qt/addresstablemodel.cpp 3ec2ebcd9b
  179. Remove direct bitcoin calls from qt/paymentserver.cpp 3cab2ce5f9
  180. Remove direct bitcoin calls from qt transaction table files 58845587e1
  181. Remove direct bitcoin access from qt/guiutil.cpp e872c93ee8
  182. Remove direct bitcoin calls from qt/sendcoinsdialog.cpp 56f33ca349
  183. Use WalletBalances struct in Qt
    Suggested by John Newbery <john@johnnewbery.com>
    https://github.com/bitcoin/bitcoin/pull/10244#discussion_r177504284
    9a61eed1fc
  184. Add developer notes about blocking GUI code 9960137697
  185. in src/interface/wallet.h:2 in 4678ff464f outdated
    0@@ -0,0 +1,348 @@
    1+#ifndef BITCOIN_INTERFACE_INTERFACES_H
    2+#define BITCOIN_INTERFACE_INTERFACES_H
    


    MarcoFalke commented at 2:07 pm on April 4, 2018:
    “wrong” include guard. Also might want to add the usual (c) header?
  186. ryanofsky force-pushed on Apr 4, 2018
  187. ryanofsky commented at 9:07 pm on April 4, 2018: member
    Updated 4678ff464f03c09feb0e237343f2af329293343a -> 996013769711bd507cdcd6dde88cbd59fcd4fbad (pr/ipc-local.68 -> pr/ipc-local.69) from https://github.com/jnewbery/bitcoin/commits/pr10244_fix_guards_copyright (thanks @jnewbery!). Only change is fixing the bad include guard and adding copyrights.
  188. laanwj merged this on Apr 5, 2018
  189. laanwj closed this on Apr 5, 2018

  190. laanwj referenced this in commit 5f0c6a7b0e on Apr 5, 2018
  191. tmornini commented at 2:19 am on April 6, 2018: none
    Congrats. 🎉
  192. ken2812221 commented at 5:54 am on April 7, 2018: contributor
    This PR broke the gitian build on windows https://bitcoin.jonasschnelli.ch/builds/559/build_win.log
  193. ryanofsky commented at 7:26 am on April 7, 2018: member

    This PR broke the gitian build on windows

    Error is:

    0qt/guiutil.cpp:235:24: error: Node in namespace :: does not name a type
    1 bool isDust(interface::Node& node, const QString& address, const CAmount& amount)
    2                        ^
    3qt/guiutil.cpp: In function bool GUIUtil::isDust(int&, const QString&, const CAmount&):
    4qt/guiutil.cpp:240:31: error: request for member getDustRelayFee in node, which is of non-class type int
    5     return IsDust(txOut, node.getDustRelayFee());
    

    It seems like this is happening because microsoft has some headers that do #define interface struct: https://stackoverflow.com/questions/25234203/what-is-the-interface-keyword-in-msvc

    I think I’ll open a followup PR to rename interface directory & namespace to interfaces to avoid this problem.

  194. ryanofsky referenced this in commit 825d0b97be on Apr 7, 2018
  195. ryanofsky referenced this in commit 17780d6f35 on Apr 7, 2018
  196. MarcoFalke referenced this in commit 048ac8326b on Apr 7, 2018
  197. stamhe referenced this in commit 9a5266a2c1 on Jun 27, 2018
  198. stamhe referenced this in commit 7515758626 on Jun 27, 2018
  199. HashUnlimited referenced this in commit d8efbba486 on Aug 3, 2018
  200. HashUnlimited referenced this in commit ef26bf507e on Aug 15, 2018
  201. lionello referenced this in commit 2a7e699324 on Nov 7, 2018
  202. lionello referenced this in commit a80610813c on Nov 7, 2018
  203. joemphilips referenced this in commit 58ec30a836 on Nov 9, 2018
  204. joemphilips referenced this in commit 0dafd2f691 on Nov 9, 2018
  205. meshcollider referenced this in commit 2607d960a0 on Mar 21, 2019
  206. jasonbcox referenced this in commit 23a0cd463c on May 3, 2019
  207. jonspock referenced this in commit 0cee17731a on Jun 13, 2019
  208. jonspock referenced this in commit 354ea0c449 on Jun 13, 2019
  209. PastaPastaPasta referenced this in commit 6bfb836bf9 on Jan 17, 2020
  210. in src/qt/walletmodel.cpp:90 in a0704a8996 outdated
    94+    if (!m_wallet->tryGetBalances(new_balances, numBlocks)) {
    95         return;
    96+    }
    97 
    98-    if(fForceCheckBalanceChanged || chainActive.Height() != cachedNumBlocks)
    99+    if(fForceCheckBalanceChanged || m_node.getNumBlocks() != cachedNumBlocks)
    


    ryanofsky commented at 7:04 pm on February 12, 2020:

    In commit “Remove most direct bitcoin calls from qt/walletmodel.cpp” (a0704a8996bb950ae3c4d5b5a30e9dfe34cde1d3)

    Bug here: m_node.getNumBlocks() should have been just numBlocks, see #18123

  211. PastaPastaPasta referenced this in commit 4d560c1f55 on Feb 12, 2020
  212. luke-jr referenced this in commit 92e048d412 on Feb 22, 2020
  213. luke-jr referenced this in commit 5e8217691e on Feb 22, 2020
  214. luke-jr referenced this in commit e9aec6ef89 on Mar 5, 2020
  215. ryanofsky added this to the "Done" column in a project

  216. luke-jr referenced this in commit 0e9e25ade0 on May 6, 2020
  217. dodifirmansah commented at 6:28 am on June 9, 2020: none
    10000000
  218. ryanofsky referenced this in commit a1647c3679 on Jul 7, 2020
  219. ryanofsky referenced this in commit 29e8689442 on Jul 7, 2020
  220. ryanofsky referenced this in commit 6a48a575d1 on Jul 14, 2020
  221. ryanofsky referenced this in commit 45fee5b4e6 on Jul 14, 2020
  222. ryanofsky referenced this in commit 47a89fbe38 on Jul 14, 2020
  223. ryanofsky referenced this in commit f3ace3d21f on Jul 14, 2020
  224. ryanofsky referenced this in commit 5adf00eb1e on Jul 16, 2020
  225. ryanofsky referenced this in commit a3cda11b8c on Aug 26, 2020
  226. ryanofsky referenced this in commit e133631625 on Aug 26, 2020
  227. MarcoFalke referenced this in commit 93ab136a33 on Aug 26, 2020
  228. sidhujag referenced this in commit 797191d45b on Aug 26, 2020
  229. xdustinface referenced this in commit 70d2b3772c on Aug 28, 2020
  230. xdustinface referenced this in commit 52fb668d25 on Aug 28, 2020
  231. xdustinface referenced this in commit e4ab0f95d2 on Aug 28, 2020
  232. xdustinface referenced this in commit b78ee33d9c on Aug 28, 2020
  233. xdustinface referenced this in commit 3f816245d7 on Aug 28, 2020
  234. xdustinface referenced this in commit e9ee0a9521 on Aug 29, 2020
  235. xdustinface referenced this in commit 7a5030ea2f on Aug 29, 2020
  236. xdustinface referenced this in commit 2a658d57b5 on Aug 30, 2020
  237. xdustinface referenced this in commit c35696a419 on Aug 30, 2020
  238. xdustinface referenced this in commit 4056606b52 on Aug 30, 2020
  239. xdustinface referenced this in commit 3c969d2981 on Aug 30, 2020
  240. xdustinface referenced this in commit 498e008fcd on Sep 27, 2020
  241. xdustinface referenced this in commit d21d019cc8 on Sep 29, 2020
  242. xdustinface referenced this in commit 58978a0c43 on Sep 29, 2020
  243. xdustinface referenced this in commit 3a8a0e1dc6 on Oct 1, 2020
  244. xdustinface referenced this in commit bf15977228 on Oct 1, 2020
  245. xdustinface referenced this in commit d80df13719 on Oct 2, 2020
  246. xdustinface referenced this in commit 18cc7fbe36 on Oct 2, 2020
  247. xdustinface referenced this in commit 3097ba795d on Oct 2, 2020
  248. xdustinface referenced this in commit a244af2d66 on Oct 2, 2020
  249. xdustinface referenced this in commit 02f2712933 on Oct 5, 2020
  250. xdustinface referenced this in commit 4e99da5e72 on Oct 5, 2020
  251. xdustinface referenced this in commit 1133dfc1ce on Oct 5, 2020
  252. xdustinface referenced this in commit eacac3d742 on Oct 5, 2020
  253. xdustinface referenced this in commit cee8c151fa on Oct 14, 2020
  254. UdjinM6 referenced this in commit 74f4d2a898 on Oct 14, 2020
  255. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me