[Tools] bitcoin-wallet - a tool for creating and managing wallets offline #13926

pull jnewbery wants to merge 2 commits into bitcoin:master from jnewbery:wallet_tool changing 18 files +864 −11
  1. jnewbery commented at 4:04 pm on August 9, 2018: member

    Adds an offline tool bitcoin-wallet-tool for wallet creation and maintenance.

    Currently this tool can create a new wallet file and display information on an existing wallet. It can later be extended to support other common wallet maintenance tasks (eg run the salvage and zapwallettxes maintenance tasks on an existing wallet).

    Doing wallet maintenance tasks in an offline tool makes much more sense (and is potentially safer) than having to spin up a full node.

  2. jnewbery commented at 4:08 pm on August 9, 2018: member

    This is currently a work in progress. It is a rebase of @jonasschnelli’s #8745. Please see that PR for history and context. I’ve volunteered to maintain this through to merge. Thanks Jonas for your work in writing and maintaining this branch so far!

    ~It is currently rebased on top of #12490, which removes a circular dependency and allows it to build. Only the Add wallet inspection and modification tool “bitcoin-wallet-tool” commit is relevant here.~

    ~#12490 can’t be merged until after the V0.17 branch is forked, so detailed review at this point would be immature. Concept and high-level comments most definitely welcomed.~

  3. domob1812 commented at 5:11 pm on August 9, 2018: contributor
    Concept ACK, looks useful. Will that tool also support things like creating addresses or dumping privkeys in the future, or “just” actual maintenance of the wallet file? That’s something that might be useful for offline systems (although you can of course spin up the daemon with an empty data dir).
  4. DrahtBot commented at 6:23 pm on August 9, 2018: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #14372 (msvc: build secp256k1 and leveldb locally by ken2812221)
    • #13787 (Test for Windows encoding issue by ken2812221)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  5. fanquake added the label Scripts and tools on Aug 10, 2018
  6. jnewbery commented at 10:01 am on August 10, 2018: member

    Will that tool also support things like creating addresses or dumping privkeys in the future

    Potentially, yes. That would be a discussion for a future PR though :)

  7. domob1812 commented at 1:17 pm on August 10, 2018: contributor
    @jnewbery: Yes, of course - let’s go in steps. For me, those functions would have been useful from time to time, though, so I’d love to see that added in some follow up. (And am happy to work on it myself if that helps.)
  8. meshcollider commented at 1:37 pm on August 14, 2018: contributor
    Concept ACK, does seem clean and useful to have these as a separate tool.
  9. jnewbery force-pushed on Aug 21, 2018
  10. jnewbery force-pushed on Aug 21, 2018
  11. jnewbery force-pushed on Aug 21, 2018
  12. laanwj commented at 9:13 am on August 22, 2018: member
    Thanks for picking this up, I agree an external wallet manipulation/recovery tool is useful
  13. jnewbery commented at 1:06 pm on August 22, 2018: member
    Thanks all concept ACKers! If you want to help with this PR, please review #12490, since that’s a pre-req to get this to build. That PR just removes deprecated code, so it should be an easy review.
  14. jnewbery force-pushed on Aug 23, 2018
  15. in src/bitcoin-wallet-tool.cpp:22 in 3610183415 outdated
    17+#include <stdio.h>
    18+
    19+
    20+static void SetupWalletToolArgs()
    21+{
    22+    std::string usage;
    


    practicalswift commented at 7:09 am on September 5, 2018:
    Unused variable :-)

    jnewbery commented at 9:23 pm on September 6, 2018:
    removed
  16. in src/wallet/wallettool.h:12 in 3610183415 outdated
     7+
     8+#include <script/ismine.h>
     9+#include <wallet/wallet.h>
    10+
    11+namespace WalletTool {
    12+CWallet* CreateWallet(const std::string name, const fs::path& path);
    


    practicalswift commented at 7:10 am on September 5, 2018:
    name should be passed by const reference?

    jnewbery commented at 9:23 pm on September 6, 2018:
    updated
  17. in src/wallet/wallettool.h:13 in 3610183415 outdated
     8+#include <script/ismine.h>
     9+#include <wallet/wallet.h>
    10+
    11+namespace WalletTool {
    12+CWallet* CreateWallet(const std::string name, const fs::path& path);
    13+CWallet* LoadWallet(const std::string name, const fs::path& path);
    


    practicalswift commented at 7:10 am on September 5, 2018:
    name should be passed by const reference?

    jnewbery commented at 9:23 pm on September 6, 2018:
    updated
  18. jnewbery force-pushed on Sep 6, 2018
  19. jnewbery commented at 9:24 pm on September 6, 2018: member

    Thanks for the review @practicalswift . I’ve fixed your review comments and rebased on the latest #12490.

    ~Since this PR depends on that one, do you mind reviewing that PR?~

  20. jnewbery force-pushed on Sep 7, 2018
  21. jnewbery renamed this:
    [WIP] [Tools] bitcoin-wallet-tool
    [Tools] bitcoin-wallet-tool
    on Sep 7, 2018
  22. jnewbery commented at 11:37 am on September 7, 2018: member

    #12490 has been merged. I’ve rebased on master and removed the [WIP] tag.

    This is ready for review.

  23. in src/bitcoin-wallet-tool-res.rc:20 in 5c1a59df81 outdated
    15+    BLOCK "StringFileInfo"
    16+    BEGIN
    17+        BLOCK "040904E4" // U.S. English - multilingual (hex)
    18+        BEGIN
    19+            VALUE "CompanyName",        "Bitcoin"
    20+            VALUE "FileDescription",    "bitcoin-wallet-tool (CLI Bitcoin wallet editor utility)"
    


    MarcoFalke commented at 12:34 pm on September 7, 2018:
    nit: replace Bitcoin with "PACKAGE_NAME ", since it doesn’t work on other Bitcoin wallets.

    jnewbery commented at 8:42 pm on September 7, 2018:
    agree. Changed
  24. in src/bitcoin-wallet-tool.cpp:74 in 5c1a59df81 outdated
    69+{
    70+    SetupEnvironment();
    71+    RandomInit();
    72+    try {
    73+        if(!WalletAppInit(argc, argv))
    74+        return EXIT_FAILURE;
    


    MarcoFalke commented at 12:38 pm on September 7, 2018:
    nit: This indentation is misleading. Should probably use the clang-format-diff script to fix all of these.

    jnewbery commented at 8:43 pm on September 7, 2018:
    Thanks. I’ve used clang-format-diff to fix these.
  25. MarcoFalke commented at 12:40 pm on September 7, 2018: member
    haven’t looked at the code yet. Just two style nits.
  26. jnewbery force-pushed on Sep 7, 2018
  27. jnewbery commented at 8:43 pm on September 7, 2018: member
    Rebased on master and fixed @MarcoFalke’s comments.
  28. Sjors commented at 2:03 pm on September 8, 2018: member
    How does this compare to #10102 (@ryanofsky) which also creates an independent wallet executable that could, with some tweaks, be used offline? Obviously this change is much simpler.
  29. jnewbery commented at 2:34 pm on September 10, 2018: member

    How does this compare to #10102

    Very different. 10102 is much more ambitious and is a change to the overall architecture of bitcoind. It has dependency on #10973, so I don’t expect it to be merged any time soon. It also doesn’t currently support running the wallet executable separately as far as I’m aware.

    This is a small, self-contained tool for created, inspecting and updating wallet files.

  30. in src/bitcoin-wallet-tool.cpp:1 in f5cb78518a outdated
    0@@ -0,0 +1,103 @@
    1+// Copyright (c) 2016 The Bitcoin Core developers
    


    promag commented at 2:36 pm on September 10, 2018:
    nit, 2018 — 2 more below.
  31. in src/wallet/wallettool.cpp:139 in f5cb78518a outdated
    124+            fprintf(stderr, "Error loading %s: Wallet corrupted", name.c_str());
    125+            return false;
    126+        }
    127+        fprintf(stdout, "Zaptxs successful executed. Please rescan your wallet.\n");
    128+    } else {
    129+        fprintf(stderr, "Unknown command\n");
    


    promag commented at 8:59 pm on September 10, 2018:
    return false?

    jnewbery commented at 6:46 pm on September 11, 2018:
    done
  32. promag commented at 9:01 pm on September 10, 2018: member
    Concept ACK. Are you planning adding tests? In this PR or other?
  33. jnewbery commented at 9:17 pm on September 10, 2018: member

    Are you planning adding tests? In this PR or other?

    Yes, I plan to add tests to this PR.

  34. in src/bitcoin-wallet-tool.cpp:45 in f5cb78518a outdated
    40+    if (!gArgs.ParseParameters(argc, argv, error)) {
    41+        fprintf(stderr, "Error parsing command line arguments: %s\n", error.c_str());
    42+        return EXIT_FAILURE;
    43+    }
    44+    if (argc < 2 || HelpRequested(gArgs)) {
    45+        std::string usage = strprintf(_("%s wallet-tool version"), PACKAGE_NAME) + " " + FormatFullVersion() + "\n" +
    


    practicalswift commented at 7:31 am on September 11, 2018:
    0bitcoin-wallet-tool.cpp:46:29: warning: variable 'usage' is uninitialized when used within its own initialization [-Wuninitialized]
    1                            usage += "\n" + _("Usage:") + "\n" +
    2                            ^~~~~
    

    Should be ; instead of + at the end of the line?

  35. in src/bitcoin-wallet-tool.cpp:102 in f5cb78518a outdated
     97+    ECCVerifyHandle globalVerifyHandle;
     98+    ECC_Start();
     99+    if (!WalletTool::executeWalletToolFunc(method, name))
    100+        return EXIT_FAILURE;
    101+    ECC_Stop();
    102+    return true;
    


    practicalswift commented at 7:32 am on September 11, 2018:
    0bitcoin-wallet-tool.cpp:102:5: warning: bool literal returned from 'main' [-Wmain]
    1    return true;
    2    ^      ~~~~
    
  36. in src/wallet/wallettool.cpp:17 in f5cb78518a outdated
    12+
    13+static CWallet* CreateWallet(const std::string& name, const fs::path& path)
    14+{
    15+    if (fs::exists(path)) {
    16+        fprintf(stderr, "Error: File exists already\n");
    17+        return NULL;
    


    practicalswift commented at 7:32 am on September 11, 2018:
    0src/wallet/wallettool.cpp:17:16: warning: use nullptr [modernize-use-nullptr]
    

    Please replace NULL with nullptr throughout :-)

  37. in src/wallet/wallettool.cpp:81 in f5cb78518a outdated
    76+    LOCK(wallet_instance->cs_wallet);
    77+
    78+    fprintf(stdout, "Wallet info\n===========\n");
    79+    fprintf(stdout, "Encrypted: %s\n", wallet_instance->IsCrypted() ? "yes" : "no");
    80+    fprintf(stdout, "HD (hd seed available): %s\n", wallet_instance->GetHDChain().seed_id.IsNull() ? "no" : "yes");
    81+    fprintf(stdout, "Keypool Size: %lu\n", (unsigned long)wallet_instance->GetKeyPoolSize());
    


    practicalswift commented at 7:35 am on September 11, 2018:
    Why the cast?
  38. jnewbery commented at 6:46 pm on September 11, 2018: member
    Thanks for the review @promag and @practicalswift . All comments addressed in the fixup commit. I’ll squash if you’re happy with the changes.
  39. jonasschnelli commented at 7:09 pm on September 11, 2018: contributor
    Concept ACK Thanks for picking this up…
  40. promag commented at 11:19 pm on September 11, 2018: member

    Segfault with invalid parameter:

    0bitcoin-wallet-tool -foo
    1Error parsing command line arguments: Invalid parameter -foo
    2[1]    16474 segmentation fault  ./src/bitcoin-wallet-tool -foo
    
  41. jnewbery force-pushed on Sep 12, 2018
  42. jnewbery commented at 2:33 pm on September 12, 2018: member
    Thanks @promag . I’ve fixed the segfault and squashed everything into one commit.
  43. in src/wallet/wallettool.cpp:91 in 7c9a7d2ece outdated
    86+bool executeWalletToolFunc(const std::string& method, const std::string& name)
    87+{
    88+    fs::path path = fs::absolute(name, GetWalletDir());
    89+
    90+    if (method == "create") {
    91+        CWallet* wallet_instance = CreateWallet(name, path);
    


    practicalswift commented at 8:21 pm on September 12, 2018:
    wallet_instance leaks?
  44. in src/wallet/wallettool.cpp:97 in 7c9a7d2ece outdated
    92+        if (wallet_instance) {
    93+            WalletShowInfo(wallet_instance);
    94+            wallet_instance->Flush();
    95+        }
    96+    } else if (method == "info") {
    97+        CWallet* wallet_instance = LoadWallet(name, path);
    


    practicalswift commented at 8:21 pm on September 12, 2018:
    wallet_instance leaks?
  45. jnewbery commented at 2:35 pm on September 13, 2018: member
    @practicalswift - I’ve fixed the CWallet leaks in f81d8c8ad4718e2158434bf330962a08d9219b61. Please review - I’ll squash if you’re happy.
  46. in src/Makefile.am:545 in f81d8c8ad4 outdated
    540+  $(LIBLEVELDB) \
    541+  $(LIBLEVELDB_SSE42) \
    542+  $(LIBMEMENV) \
    543+  $(LIBSECP256K1)
    544+
    545+bitcoin_wallet_tool_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
    


    MarcoFalke commented at 2:49 pm on September 13, 2018:
    No need to attempt to link SSL_LIBS. If the tool wanted to upload the private keys, might as well do it without TLS

    MarcoFalke commented at 2:50 pm on September 13, 2018:
    Probably the same for $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)?

    jnewbery commented at 3:15 pm on September 13, 2018:
    Thanks Marco. Fixed.
  47. practicalswift commented at 2:52 pm on September 13, 2018: contributor
    @jnewbery Leaks gone :-)
  48. jnewbery force-pushed on Sep 13, 2018
  49. jnewbery commented at 3:15 pm on September 13, 2018: member
    Addressed #13926 (review) , squashed and pushed.
  50. promag commented at 7:56 pm on September 19, 2018: member

    @jnewbery

     0  bitcoin git:(wallet_tool)  ./src/bitcoin-wallet-tool -name=/tmp/w1 create
     1Topping up keypool...
     2Wallet info
     3===========
     4Encrypted: no
     5HD (hd seed available): yes
     6Keypool Size: 2000
     7Transactions: 0
     8Address Book: 0
     9  bitcoin git:(wallet_tool)  ./src/bitcoin-wallet-tool -name=/tmp/w1 create
    10Error: File exists already
    11  bitcoin git:(wallet_tool)  ./src/bitcoin-wallet-tool -name=/tmp/w1/foo/.. create
    12Topping up keypool...
    13Wallet info
    14===========
    15Encrypted: no
    16HD (hd seed available): yes
    17Keypool Size: 2000
    18Transactions: 0
    19Address Book: 0
    20  bitcoin git:(wallet_tool)  ls /tmp/w1
    21database   db.log     foo        wallet.dat
    

    the 3rd run should fail right?

  51. in src/wallet/wallettool.cpp:96 in db2678145a outdated
    91+    fprintf(stdout, "Keypool Size: %u\n", wallet_instance->GetKeyPoolSize());
    92+    fprintf(stdout, "Transactions: %zu\n", wallet_instance->mapWallet.size());
    93+    fprintf(stdout, "Address Book: %zu\n", wallet_instance->mapAddressBook.size());
    94+}
    95+
    96+bool executeWalletToolFunc(const std::string& method, const std::string& name)
    


    promag commented at 7:59 pm on September 19, 2018:
    nit, s/method/command?

    jnewbery commented at 1:59 pm on September 21, 2018:
    changed
  52. in src/wallet/wallettool.cpp:139 in db2678145a outdated
    134+            fprintf(stderr, "Error loading %s: Wallet corrupted", name.c_str());
    135+            return false;
    136+        }
    137+        fprintf(stdout, "Zaptxs successful executed. Please rescan your wallet.\n");
    138+    } else {
    139+        fprintf(stderr, "Unknown command\n");
    


    promag commented at 7:59 pm on September 19, 2018:

    nit

    0fprintf(stderr, "Invalid command: %s\n", method.c_str());
    

    jnewbery commented at 2:00 pm on September 21, 2018:
    yep. Better
  53. in src/wallet/wallettool.cpp:24 in db2678145a outdated
    18+    wallet->WalletLogPrintf("Releasing wallet\n");
    19+    wallet->Flush();
    20+    delete wallet;
    21+}
    22+
    23+static std::shared_ptr<CWallet> CreateWallet(const std::string& name, const fs::path& path)
    


    promag commented at 8:03 pm on September 19, 2018:
    These could return std::unique_ptr?

    jnewbery commented at 2:00 pm on September 21, 2018:
    Indeed. Fixed

    jnewbery commented at 2:29 pm on September 21, 2018:
    Actually, I’ll keep these as shared

    promag commented at 2:33 pm on September 21, 2018:
    Why?
  54. in src/wallet/wallettool.h:16 in db2678145a outdated
    11+namespace WalletTool {
    12+
    13+std::shared_ptr<CWallet> CreateWallet(const std::string& name, const fs::path& path);
    14+std::shared_ptr<CWallet> LoadWallet(const std::string& name, const fs::path& path);
    15+void WalletShowInfo(CWallet* wallet_instance);
    16+bool executeWalletToolFunc(const std::string& method, const std::string& file);
    


    promag commented at 8:04 pm on September 19, 2018:
    nit, bool ExecuteWalletToolFunc....

    jnewbery commented at 2:01 pm on September 21, 2018:
    fixed
  55. promag commented at 8:06 pm on September 19, 2018: member

    While running

    0./src/bitcoind -wallet=/tmp/w1 -regtest
    

    This happens:

    0./src/bitcoin-wallet-tool -name=/tmp/w1 info
    1libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: BerkeleyBatch: Failed to open database environment.
    2[1]    78930 abort      ./src/bitcoin-wallet-tool -name=/tmp/w1 info
    
  56. in src/Makefile.am:539 in db2678145a outdated
    534+  $(LIBBITCOIN_COMMON) \
    535+  $(LIBBITCOIN_CONSENSUS) \
    536+  $(LIBBITCOIN_UTIL) \
    537+  $(LIBBITCOIN_CRYPTO) \
    538+  $(LIBUNIVALUE) \
    539+  $(LIBBITCOIN_ZMQ) \
    


    MarcoFalke commented at 8:08 pm on September 19, 2018:

    Could also remove these:

     0diff --git a/src/Makefile.am b/src/Makefile.am
     1index 41cd066fa0..fc398a5fd9 100644
     2--- a/src/Makefile.am
     3+++ b/src/Makefile.am
     4@@ -539,8 +539,6 @@ bitcoin_wallet_tool_LDADD = \
     5   $(LIBBITCOIN_CONSENSUS) \
     6   $(LIBBITCOIN_UTIL) \
     7   $(LIBBITCOIN_CRYPTO) \
     8-  $(LIBUNIVALUE) \
     9-  $(LIBBITCOIN_ZMQ) \
    10   $(LIBLEVELDB) \
    11   $(LIBLEVELDB_SSE42) \
    12   $(LIBMEMENV) \
    

    jnewbery commented at 2:02 pm on September 21, 2018:
    removed
  57. in src/Makefile.am:545 in db2678145a outdated
    540+  $(LIBLEVELDB) \
    541+  $(LIBLEVELDB_SSE42) \
    542+  $(LIBMEMENV) \
    543+  $(LIBSECP256K1)
    544+
    545+bitcoin_wallet_tool_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(CRYPTO_LIBS)
    


    MarcoFalke commented at 8:10 pm on September 19, 2018:
    Might need $(MINIUPNPC_LIBS) to pass travis?

    jnewbery commented at 2:02 pm on September 21, 2018:
    added
  58. MarcoFalke commented at 8:11 pm on September 19, 2018: member
    @promag Would be better to write these up as python tests?
  59. promag commented at 8:14 pm on September 19, 2018: member
    @MarcoFalke ok, I’ll push a commit with the above tests and for the remaining commands.
  60. jnewbery commented at 9:23 pm on September 19, 2018: member

    @MarcoFalke @promag Thanks for the review. Will address in due course.

    I’ll push a commit with the above tests and for the remaining commands.

    Awesome. Thanks @promag!

  61. ryanofsky commented at 8:42 pm on September 20, 2018: member
    I think it’d be nice to call the executable bitcoin-wallet instead of bitcoin-wallet-tool. I seems unusual to give a command an extra suffix like -tool, though I guess bitcoin-cli also has a similarly descriptive suffix.
  62. jnewbery commented at 9:28 pm on September 20, 2018: member

    I think it’d be nice to call the executable bitcoin-wallet instead of bitcoin-wallet-tool

    Seems reasonable to me. We already have bitcoin-tx and not bitcoin-tx-tool. I’ll change the name to bitcoin-wallet.

  63. promag commented at 8:33 am on September 21, 2018: member
    @jnewbery should disallow multiple -name, like -name=/tmp/w1 -name=/tmp/w2 info?
  64. jnewbery commented at 2:51 pm on September 21, 2018: member

    While running

    […]

    This happens:

    […]

    I now catch the exception in LoadWallet in wallettool.cpp

  65. jnewbery force-pushed on Sep 21, 2018
  66. jnewbery commented at 2:52 pm on September 21, 2018: member
    Rebased on master and fixed all review comments so far.
  67. in src/bitcoin-wallet.cpp:24 in fdbb2d5872 outdated
    19+const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
    20+
    21+static void SetupWalletToolArgs()
    22+{
    23+    gArgs.AddArg("-?", "This help message", false, OptionsCategory::OPTIONS);
    24+    gArgs.AddArg("-name=<wallet-name>", "Specify wallet name", false, OptionsCategory::OPTIONS);
    


    ryanofsky commented at 3:42 pm on September 21, 2018:
    I think bitcoin-wallet should take the exact same -walletdir=<dir> and -wallet=<path> options as bitcoind and bitcoin-gui. I don’t think there are benefits to giving this tool a new way of locating and referring to wallets. It just seems inconsistent and confusing.

    Sjors commented at 12:51 pm on September 25, 2018:

    There is no -walletdir command for this tool afaik, though that would be useful (no rush).

    -wallet indeed seems better than -name, especially if we ever decide to give wallets names. However for this tool I have a light preference for making it a positional argument, e.g. ./bitcoin-wallet create blah seems more intuitive to me than ./bitcoin-wallet -wallet=blah create.


    promag commented at 5:00 pm on September 25, 2018:
    Also have mixed feeling here. IMO it should be consistent with bitcoind to begin with. For instance, with psql (postgres client) you can set the database in multiple ways: env var, -d option or positional argument.
  68. in src/bitcoin-wallet.cpp:61 in fdbb2d5872 outdated
    50+        fprintf(stdout, "%s", usage.c_str());
    51+        return false;
    52+    }
    53+
    54+    // check for printtoconsole, allow -debug
    55+    g_logger->m_print_to_console = gArgs.GetBoolArg("-printtoconsole", gArgs.GetBoolArg("-debug", false));
    


    ryanofsky commented at 3:45 pm on September 21, 2018:
    I think you might need to add these arguments to SetupWalletToolArgs to prevent them from being rejected.

    jnewbery commented at 6:25 pm on January 11, 2019:
    done
  69. in src/bitcoin-wallet.cpp:70 in fdbb2d5872 outdated
    55+    g_logger->m_print_to_console = gArgs.GetBoolArg("-printtoconsole", gArgs.GetBoolArg("-debug", false));
    56+
    57+    // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
    58+    try {
    59+        SelectParams(gArgs.GetChainName());
    60+    } catch (const std::exception& e) {
    


    ryanofsky commented at 3:48 pm on September 21, 2018:
    This seem to be catching and printing same exception that the caller already catches and prints. I think it’d make sense to drop this catch and just let the caller handle the error, unless this is adding going to add extra information or do something useful.

    jnewbery commented at 6:26 pm on January 11, 2019:
    fixed
  70. in src/bitcoin-wallet.cpp:100 in fdbb2d5872 outdated
    81+
    82+    while (argc > 1 && IsSwitchChar(argv[1][0])) {
    83+        argc--;
    84+        argv++;
    85+    }
    86+    std::vector<std::string> args = std::vector<std::string>(&argv[1], &argv[argc]);
    


    ryanofsky commented at 3:55 pm on September 21, 2018:
    Would probably make sense to pass this vector to ExecuteWalletToolFunc, instead of constructing it and throwing away.

    jnewbery commented at 7:30 pm on January 11, 2019:
    Changed to not construct a vector at all.
  71. in src/wallet/wallettool.cpp:51 in fdbb2d5872 outdated
    43+    fprintf(stdout, "Topping up keypool...\n");
    44+    wallet_instance->TopUpKeyPool();
    45+    return wallet_instance;
    46+}
    47+
    48+static std::shared_ptr<CWallet> LoadWallet(const std::string& name, const fs::path& path)
    


    ryanofsky commented at 3:59 pm on September 21, 2018:
    Isn’t this duplicating a bunch of code already in bitcoind? It seems fragile for bitcoind and bitcoin-wallet to have different code for loading and locating wallets and handling errors.

    jnewbery commented at 7:30 pm on January 11, 2019:
    Yes. I agree that this could be refactored to remove duplicate code. Can we save that for a follow-up PR?
  72. ryanofsky commented at 4:02 pm on September 21, 2018: member
    Reviewed like 75% of this, but wanted to post comments so far.
  73. jnewbery renamed this:
    [Tools] bitcoin-wallet-tool
    [Tools] bitcoin-wallet - a tool for creating and managing wallets offline
    on Sep 21, 2018
  74. promag commented at 10:29 pm on September 21, 2018: member
    nit, add src/bitcoin-wallet to .gitignore.
  75. in src/Makefile.am:539 in fdbb2d5872 outdated
    520@@ -509,6 +521,32 @@ bitcoin_tx_LDADD = \
    521 bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
    522 #
    523 
    524+# bitcoin-wallet-tool binary #
    


    Sjors commented at 12:42 pm on September 25, 2018:
    nit: bitcoin-wallet

    Sjors commented at 7:03 am on October 23, 2018:
    Nag nit (though don’t bother if there’s no other changes needed)

    jnewbery commented at 6:53 pm on January 11, 2019:
    fixed!
  76. Sjors commented at 1:15 pm on September 25, 2018: member

    Concept ACK.

    This tool could also be useful as a migration tool if we ever decide to move away from DBD and deprecate that dependency from bitcoind/qt. Already it could have its own --with-incompatible-bdb configure argument (can wait for a future PR). @theuni should probably take a look at the build system aspects of this.

    Needs testing in Windows

    How do I use this with -testnet? Do we want to ignore bitcoin.conf. If so, that needs mentioning in the help text. Longer term it seems better to support that, e.g. once creating new addresses is possible, addresstype should be honored.

    I assume fresh wallets trigger a rescan because the tool doesn’t know the block height? If so, maybe warn about that, and add a heighthint argument later.

  77. MarcoFalke commented at 6:11 pm on September 25, 2018: member
    Mind to cherry-pick the tests from #14283, so that they can be reviewed in one go with the current code?
  78. promag commented at 6:45 pm on September 25, 2018: member
    @MarcoFalke if the test strategy looks good then I should clean it before.
  79. jonasschnelli commented at 8:43 am on September 27, 2018: contributor

    Tested a bit… I think the help should mention that the created wallet is relative to the Bitcoin data dir (from reading the help, I would have expected that the wallet will be created in the current directory).

    I personally would prefer that the tool does not interact with the datadir. (specify path or expect current dir).

    Also, how can you create a new wallet in the regtest or testnet subdirectory?

  80. ryanofsky commented at 11:56 am on September 27, 2018: member

    I personally would prefer that the tool does not interact with the datadir.

    I think that would be a sensible idea for a low-level wallet debugging tool, but a bad idea for a tool that can replace bitcoind and bitcoin-qt as a way of accessing wallets. I think the least confusing way for bitcoin-wallet to work is for it to use the same configuration bitcoind and bitcoin-qt do, and to open and locate wallets in exactly the same way (with exact same -wallet -walletdir -datadir -regtest -conf etc parameters and defaults).

    Lets think about an actual use case. If a user who runs bitcoind or bitcoin-qt normally encounters a problem that requires them to run “salvage” or “zaptxs”, it would be nice if they could just run bitcoin-wallet salvage or bitcoin-wallet zaptxs from the command line directly, without having to cd into weird directories or specify long data paths or learn an new set of command line arguments different from the existing ones.

    The bitcoin-wallet tool is also going to be extended in the future. I think it’d be nice if it had dump and load subcommands that could be a safe for backing up and transferring wallets into flat files without the user having to know anything about the internal structure of their data dir. I think it’d be nice if there were a shell subcommand that would drop into an rpcconsole like shell and allow running wallets rpc commands in an offline mode.

  81. jnewbery force-pushed on Sep 27, 2018
  82. jnewbery commented at 2:21 pm on September 27, 2018: member
    Cherry picked the changes from #14283 and #14284 and squashed fixup commits. Thanks to @promag and @ken2812221 !
  83. in test/functional/tool_wallet.py:1 in 793cd32ba7 outdated
    0@@ -0,0 +1,101 @@
    1+#!/usr/bin/env python3
    


    ken2812221 commented at 2:57 pm on September 27, 2018:
    Add this file into test_runner.py script list?

    jnewbery commented at 7:40 pm on October 17, 2018:
    done
  84. DrahtBot added the label Needs rebase on Sep 27, 2018
  85. jonasschnelli commented at 6:33 pm on September 27, 2018: contributor

    I think that would be a sensible idea for a low-level wallet debugging tool, but a bad idea for a tool that can replace bitcoind and bitcoin-qt as a way of accessing wallets.

    I’m not sure about this but I can follow your thoughts. I think one can also argue that the wallet-tool is a low-level accessing tool for experts.

    Lets think about an actual use case. If a user who runs bitcoind or bitcoin-qt normally encounters a problem that requires them to run “salvage” or “zaptxs”.

    If you have to salvage or zap transactions, you are in low-level debug mode IMO.

    However, I think we should… a) … interpret the provided wallet name as filename (with optional path components) b) … if wallet has not been found, check the default datadir/walletdir if it contains the wallet c) … allow -regtest/-testnet switch d) … describe the path behaviour in the help-text

  86. ryanofsky commented at 7:38 pm on September 27, 2018: member

    What you’re suggesting sounds good, as long as it doesn’t mean (part (a) is vague) that bitcoin-wallet should interpret the -wallet=<path> option differently from bitcoind and bitcoin-qt

    The salvage and zaptxs subcommands are somewhat low level, but I don’t think a dump command would be so obscure, and I think it would be nice if different various tools understood the same options so for example:

    0bitcoin-qt -testnet -wallet=foo
    1bitcoin-wallet -testnet -wallet=foo dump > foo.txt
    

    could just work without the without the user having to figure out where their datadir is located, where the testnet directory lives inside datadir, whether the testnet directory contains a “wallets” subdirectory, or is from a legacy install that preceded it, and so on.

  87. jnewbery force-pushed on Sep 27, 2018
  88. jnewbery commented at 9:45 pm on September 27, 2018: member
    Rebased on master. tool_wallet.py is failing.
  89. DrahtBot removed the label Needs rebase on Sep 27, 2018
  90. Sjors commented at 11:07 am on September 28, 2018: member

    What happens if you run this tool on a wallet that’s currently opened by bitcoind?

    zapwallettxes is sometimes recommended to deal with stuck transactions. Especially before the GUI had basic RBF support, but might still be useful (though it’s a pretty blunt instrument).

  91. in test/functional/tool_wallet.py:47 in 9258bb73e2 outdated
    42+        wallet_dir = lambda *p: data_dir('wallets', *p)
    43+        data_dir = lambda *p: os.path.join(self.nodes[0].datadir, 'regtest', *p)
    44+
    45+        # TODO calling info on a wallet already opened results in the segfault:
    46+        #  `libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: BerkeleyBatch: Failed to open database environment`
    47+        #  the error must be fixed and tested here
    


    promag commented at 11:26 am on September 28, 2018:

    What happens if you run this tool on a wallet that’s currently opened by bitcoind? @Sjors FYI


    jnewbery commented at 9:05 pm on October 17, 2018:
    This is now fixed, and the test case has been added to tool_wallet.py
  92. in src/wallet/wallettool.cpp:132 in 9258bb73e2 outdated
    127+        std::string backup_filename;
    128+        if (!WalletBatch::Recover(path, (void*)&dummyWallet, WalletBatch::RecoverKeysOnlyFilter, backup_filename)) {
    129+            fprintf(stderr, "Salvage failed\n");
    130+            return false;
    131+        }
    132+        //TODO, set wallets best block to genesis to enforce a rescan
    


    practicalswift commented at 8:54 pm on October 1, 2018:
    nit: Should have a space between // and comment.

    jnewbery commented at 7:44 pm on October 17, 2018:
    fixed
  93. in src/bitcoin-wallet.cpp:79 in 9258bb73e2 outdated
    65+    return true;
    66+}
    67+
    68+int main(int argc, char* argv[])
    69+{
    70+    SetupEnvironment();
    


    ken2812221 commented at 5:10 am on October 8, 2018:
    Could you follow #13883 to add a Windows argument handler here?

    jnewbery commented at 7:46 pm on October 17, 2018:
    done
  94. in test/functional/tool_wallet.py:5 in 9258bb73e2 outdated
    0@@ -0,0 +1,101 @@
    1+#!/usr/bin/env python3
    2+# Copyright (c) 2018 The Bitcoin Core developers
    3+# Distributed under the MIT software license, see the accompanying
    4+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
    5+"""Test bitcoint-wallet-tool.
    


    practicalswift commented at 8:25 pm on October 16, 2018:
    Should be “bitcoin-wallet-tool”? :-)

    jnewbery commented at 7:44 pm on October 17, 2018:
    fixed
  95. jnewbery force-pushed on Oct 17, 2018
  96. jnewbery commented at 9:07 pm on October 17, 2018: member

    I’ve updated the tool to treat -datadir, -wallet, -regtest and -testnet arguments in the same way that bitcoind treats those arguments. I’ve also added help text to explain where it looks for wallet files:

    0wallet-tool is an offline tool for creating and interacting with Bitcoin Core wallet files.
    1By default wallet-tool will act on wallets in the default wallet directory in the datadir.
    2To change the target wallet, use the -datadir, -wallet and -testnet/-regtest arguments.
    

    I believe all comments so far are now addressed.

  97. ken2812221 commented at 10:55 pm on October 17, 2018: contributor
    @jnewbery the filelock on Windows is broken now, so the test would fail. See #14426
  98. jnewbery force-pushed on Oct 18, 2018
  99. jnewbery commented at 3:38 pm on October 18, 2018: member

    New push:

    • Fix the build failure with –disable-wallet
    • skip the test if wallet is not compiled
    • Catch when the wallet file can’t be opened earlier
    • rebased on #14426 to try to fix the windows failure

    This PR now depends on #14426 .

  100. jnewbery force-pushed on Oct 18, 2018
  101. jnewbery force-pushed on Oct 18, 2018
  102. ryanofsky approved
  103. ryanofsky commented at 7:19 pm on October 19, 2018: member
    utACK 719ae605df48fe4dc4d1329b83cb0069160d40dc. There are some things I would want to clean up here (mainly deduping code and sharing more functionality between bitcoind and bitcoind-wallet), but this seems good as a starting point for a new tool that can be extended later.
  104. DrahtBot added the label Needs rebase on Oct 20, 2018
  105. jnewbery force-pushed on Oct 20, 2018
  106. jnewbery commented at 9:51 pm on October 20, 2018: member
    rebased
  107. DrahtBot removed the label Needs rebase on Oct 21, 2018
  108. ryanofsky approved
  109. ryanofsky commented at 9:21 pm on October 22, 2018: member
    utACK ebd8417a6b8fbb1575140f0f04b568f17a47914a. No changes since last review other than rebasing after windows file lock #14426 merge.
  110. in src/bitcoin-wallet.cpp:50 in ebd8417a6b outdated
    45+        return false;
    46+    }
    47+    if (argc < 2 || HelpRequested(gArgs)) {
    48+        std::string usage = strprintf("%s bitcoin-wallet version", PACKAGE_NAME) + " " + FormatFullVersion() + "\n\n" +
    49+                                      "wallet-tool is an offline tool for creating and interacting with Bitcoin Core wallet files.\n" +
    50+                                      "By default wallet-tool will act on wallets in the default wallet directory in the datadir.\n" +
    


    Sjors commented at 7:36 am on October 23, 2018:
    Nit: “the datadir for mainnet” (since testnet=1 in bitcoin.conf is ignored)

    jnewbery commented at 7:33 pm on January 11, 2019:
    fixed
  111. Sjors approved
  112. Sjors commented at 7:39 am on October 23, 2018: member

    My earlier [comment]( #13926 (review)) about -name vs. -wallet is addressed now. I still think ./bitcoin-wallet create blah is more intuitive than ./bitcoin-wallet -wallet=blah create, but can live with both.

    Trying to load a wallet that’s currently opened by bitcoind now nicely returns a Error loading . Is wallet being used by other process?

    Lightly tested ebd8417 on macOS 10.14. If you call bitcoin-wallet -testnet without arguments it crashes with Segmentation fault: 11 instead of showing the help.

  113. in configure.ac:1136 in ebd8417a6b outdated
    1117@@ -1111,7 +1118,7 @@ else
    1118   AC_CHECK_HEADER([openssl/ssl.h],, AC_MSG_ERROR(libssl headers missing),)
    1119   AC_CHECK_LIB([ssl],         [main],SSL_LIBS=-lssl, AC_MSG_ERROR(libssl missing))
    1120 
    1121-  if test x$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests != xnonononono; then
    1122+  if test x$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests != xnononononono; then
    


    MarcoFalke commented at 9:37 pm on November 7, 2018:
    I think you no longer link against libevent, so this could be removed?

    jnewbery commented at 7:36 pm on January 11, 2019:
    removed
  114. meshcollider added the label Wallet on Nov 9, 2018
  115. in src/wallet/wallettool.cpp:61 in ebd8417a6b outdated
    51+        fprintf(stderr, "Error: Wallet files does not exist\n");
    52+        return nullptr;
    53+    }
    54+
    55+    std::shared_ptr<CWallet> wallet_instance(new CWallet(name, WalletDatabase::Create(path)), WalletToolReleaseWallet);
    56+    bool first_run;
    


    practicalswift commented at 8:39 am on November 9, 2018:
    Reduce scope of first_run :-)

    jnewbery commented at 7:36 pm on January 11, 2019:
    fixed :)
  116. meshcollider commented at 2:16 pm on November 12, 2018: contributor

    I think this will be a really useful tool to add more functionality too that isn’t really suited to adding to bitcoind itself. Just testing this (have done some light code review, didn’t look at the build_msvc/ files or configure.ac & Makefile.am changes). A few early comments:

    Some of @ryanofsky’s comments mentioned above still need addressing, e.g. that the -printtoconsole and -debug args still aren’t recognized and error if they are tried to be used. I am slightly worried about the code duplication too but I think its ok.

    Calling info or zaptxs on a non-existent wallet should throw and error, but instead it creates a file and prints info of a wallet containing no keys, transactions, etc. Then calling create on the same wallet name will error that the file already exists.

    One other note, the tool should check a command was provided. Currently it just exits without doing anything if no command is provided.

  117. in src/wallet/wallettool.cpp:125 in 4359b0a96e outdated
    111+            wallet_instance->Flush();
    112+        }
    113+    } else if (command == "info") {
    114+        std::string error;
    115+        if (!WalletBatch::VerifyEnvironment(path, error)) {
    116+            fprintf(stderr, "Error loading %s. Is wallet being used by other process?\n", name.c_str());
    


    meshcollider commented at 2:19 pm on November 12, 2018:
    nit: “another process”

    jnewbery commented at 7:36 pm on January 11, 2019:
    fixed
  118. jnewbery commented at 2:50 pm on November 12, 2018: member
    Thanks for testing @MeshCollider. I intend to pick this up again next week and address all feedback.
  119. practicalswift commented at 8:37 am on December 7, 2018: contributor
    I’m afraid this PR doesn’t compile when rebased on master :-)
  120. in src/bitcoin-wallet.cpp:42 in ebd8417a6b outdated
    37+}
    38+
    39+static bool WalletAppInit(int argc, char* argv[])
    40+{
    41+    SetupWalletToolArgs();
    42+    std::string error;
    


    practicalswift commented at 2:38 pm on January 7, 2019:
    Could use variable name errorMessage instead to avoid shadowing error from src/util/system.h?

    jnewbery commented at 7:58 pm on January 11, 2019:
    fixed
  121. jnewbery force-pushed on Jan 11, 2019
  122. jnewbery force-pushed on Jan 11, 2019
  123. jnewbery force-pushed on Jan 11, 2019
  124. jnewbery force-pushed on Jan 11, 2019
  125. jnewbery commented at 7:59 pm on January 11, 2019: member

    Addressing @MeshCollider’s feedback:

    Some of @ryanofsky’s comments mentioned above still need addressing, e.g. that the -printtoconsole and -debug args still aren’t recognized and error if they are tried to be used. I am slightly worried about the code duplication too but I think its ok.

    These should all be addressed now.

    Calling info or zaptxs on a non-existent wallet should throw and error, but instead it creates a file and prints info of a wallet containing no keys, transactions, etc. Then calling create on the same wallet name will error that the file already exists.

    This is fixed.

    One other note, the tool should check a command was provided. Currently it just exits without doing anything if no command is provided.

    This is fixed.

  126. jnewbery commented at 8:00 pm on January 11, 2019: member

    Latest force-push should address all remaining feedback: https://github.com/bitcoin/bitcoin/compare/21b4b35a8ecf879ec5909820ab36b3aa29358fe7..d05ec61f7659466e911ea3ae48aa583c792d8849

    Thanks everyone for review! Please let me know if I’ve missed anything.

  127. DrahtBot added the label Needs rebase on Jan 15, 2019
  128. jnewbery force-pushed on Jan 15, 2019
  129. jnewbery commented at 4:22 pm on January 15, 2019: member
    rebased
  130. DrahtBot removed the label Needs rebase on Jan 15, 2019
  131. ryanofsky approved
  132. ryanofsky commented at 6:12 pm on January 15, 2019: member

    utACK 7064a9515dd7de8d32a1e4e7c08cb0ce17677b23. Changes since last review: rebase, tweaks like adding better error checking, supporting debug/printtoconsole.

    Deduplicating wallet load & create wallet code between bitcoind & bitcoin-wallet would be nice cleanup to follow up with in the future.

  133. Sjors commented at 1:38 pm on January 17, 2019: member

    I find the following behavior a bit scary:

    0$ src/bitcoin-wallet help zaptxs
    1Zaptxs successful executed. Please rescan your wallet.
    

    I understand that we don’t want to duplicate the help in this initial version, but it should probably throw an error.

    I’m also confused how zaptxs is supposed to work here. In bitcoind -zapwallettxes takes an argument and actually leads to a rescan. When I call bitcoin-wallet zaptxs and then open the zapped wallet the transactions and labels are still there.

    I’m not sure how to test salvage.

    If bitcoin.conf sets testnet=1 there’s no way to acces a mainnet wallet (not a big deal).

    The wallet creation command doesn’t take arguments (like watch-only). I suppose that’s fine for this initial version.

  134. ryanofsky commented at 2:07 pm on January 17, 2019: member

    I think it would be good to merge wallet tool and make a new issue or set of issues to keep track of the usability problems and feature deficits Sjors is bringing up.

    I don’t think we should be trying to perfect this tool in a single github PR. I think it would be better to merge it, mark it as experimental, and continue to develop it in git. This would make any proposed changes easier to understand and discuss.

  135. ryanofsky commented at 2:19 pm on January 17, 2019: member

    The wallet creation command doesn’t take arguments (like watch-only). I suppose that’s fine for this initial version.

    One idea for this might be to remove most functionality from the wallet tool, and just allow it to fill JSONRPCRequest objects and call the limited subset of RPC methods that work offline. This would also let it share named/positional argument parsing code with bitcoin-cli.

  136. Sjors commented at 2:30 pm on January 17, 2019: member
    Either marking as experimental or reducing feature set works for me, though I think the latter is a safer approach.
  137. jnewbery commented at 3:33 pm on January 17, 2019: member

    Thanks for the input @Sjors and @ryanofsky .

    I find the following behavior a bit scary: …

    Good catch! I’ve added that as an error condition (with test) in https://github.com/bitcoin/bitcoin/pull/13926/commits/c904860a24aade9a59f9948eb5e8e3da80a7b12f

    I don’t think we should be trying to perfect this tool in a single github PR

    Yes. Good point. I’ve removed the salvage and zaptxs commands in this PR, so this tool now can only provide info or create a wallet. I’ll move the salvage and zaptxs commands to a follow-up PR. Done in https://github.com/bitcoin/bitcoin/pull/13926/commits/3519b2f0fb0f8fa22a788471d32917cefad61d82.

  138. jnewbery force-pushed on Jan 17, 2019
  139. jgarzik commented at 3:39 pm on January 17, 2019: contributor

    @ryanofsky ’s suggestion matches the original intent when the new tools (e.g. bitcoin-tx) were introduced, and plans were made for others (bitcoin-script, bitcoin-key, and bitcoin-wallet):

    • Start small.
    • Get it in-tree.
    • Discuss and grow from there.

    Once of Linus’s favorite wisdoms was that the Internet is the best test lab in the world, and your goal should be to accelerate changes to the point where they are being tested in the field by real users. Wider audience = more testing and real world feedback.

    Small+shipping is a good risk-adjusting model that maximizes the amount of field testing and review. And the common pattern in OSS of endlessly nitpicking small details winds up being counter-productive to higher code quality (by restricting testing to The People Who Follow This Unmerged PR).

    Getting software into the field also validates basic developer assumptions of the software’s value, utility and design.

  140. Sjors commented at 3:50 pm on January 17, 2019: member

    One more thing: src/bitcoin-wallet needs to be added to .gitignore.

    Otherwise tACK a92b608

  141. jnewbery force-pushed on Jan 17, 2019
  142. jnewbery commented at 3:54 pm on January 17, 2019: member
  143. Sjors commented at 4:01 pm on January 17, 2019: member
    re-tACK 2aeac46
  144. MarcoFalke added this to the milestone 0.18.0 on Jan 17, 2019
  145. MarcoFalke added the label Needs gitian build on Jan 29, 2019
  146. in src/bitcoin-wallet.cpp:65 in 2aeac46d17 outdated
    60+    // check for printtoconsole, allow -debug
    61+    g_logger->m_print_to_console = gArgs.GetBoolArg("-printtoconsole", gArgs.GetBoolArg("-debug", false));
    62+
    63+    if (!fs::is_directory(GetDataDir(false))) {
    64+        fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "").c_str());
    65+        return EXIT_FAILURE;
    


    MarcoFalke commented at 8:57 pm on January 29, 2019:
    This is not defined behavior, since EXIT_FAILURE has no defined type nor value, but you need a bool(false). c.f. https://en.cppreference.com/w/c/program/EXIT_status

    jnewbery commented at 9:42 pm on January 29, 2019:
    I don’t understand this. There are plenty of other locations where return EXIT_FAILURE is used (and even a couple of PRs where return false has been changed to return EXIT_FAILURE - #9067 and #13349)

    MarcoFalke commented at 10:57 pm on January 29, 2019:

    We are not in main here, which has a return type int. The function signature here is static bool WalletAppInit, so the return type is bool. Commonly EXIT_FAILURE is 1, so bool(1) == true, which is off-by-one.

    You can also test this trivially by providing a datadir that does not exist. It will print an error, but continue and print garbage.


    jnewbery commented at 11:08 pm on January 29, 2019:
    Duh. Thanks! I only looked at the github snippet. Will fix.

    jnewbery commented at 9:27 pm on January 30, 2019:
    fixed
  147. MarcoFalke removed the label Needs gitian build on Jan 29, 2019
  148. [tools] Add wallet inspection and modification tool
    This commit adds wallet-tool, a tool for creating and interacting with
    wallet files. Original implementation was by Jonas Schnelli
    <dev@jonasschnelli.ch> with modifications by John Newbery
    <john@johnnewbery.com>
    
    MSVC files were provided by Chun Kuan Lee <ken2812221@gmail.com>:
    
    build: Add MSVC project files for bitcoin-wallet-tool
    49d2374acf
  149. [tests] Add wallet-tool test
    Original tests by João Barbosa <joao.paulo.barbosa@gmail.com>
    
    Additional contribution by John Newbery <john@johnnewbery.com>
    3c3e31c3a4
  150. jnewbery force-pushed on Jan 30, 2019
  151. MarcoFalke commented at 9:33 pm on January 30, 2019: member
    Concept ACK. Going to test and merge this this week. Should be safe, since the only methods are info and create
  152. MarcoFalke referenced this in commit 252fd15add on Jan 31, 2019
  153. MarcoFalke merged this on Jan 31, 2019
  154. MarcoFalke closed this on Jan 31, 2019

  155. jnewbery deleted the branch on Jan 31, 2019
  156. ken2812221 referenced this in commit bef8fdd6e2 on Feb 1, 2019
  157. MarcoFalke referenced this in commit 6a5feb7d82 on Feb 4, 2019
  158. HashUnlimited referenced this in commit 08d5d81f79 on Feb 5, 2019
  159. in src/wallet/wallettool.cpp:20 in 3c3e31c3a4
    15+// queue, which doesn't exist for the bitcoin-wallet. Define our own
    16+// deleter here.
    17+static void WalletToolReleaseWallet(CWallet* wallet)
    18+{
    19+    wallet->WalletLogPrintf("Releasing wallet\n");
    20+    wallet->Flush();
    


    MarcoFalke commented at 6:25 pm on February 6, 2019:
    question: The Flush() calls in this file accept a bool that should be set to true on shutdown?

    jnewbery commented at 5:57 pm on February 12, 2019:

    Yes, you’re right. This got missed out when rebasing on a commit that changed the function signature for Wallet::Flush().

    ~I think the same is true for~ https://github.com/bitcoin/bitcoin/blob/d8794a78a887a920276c7124f1c46d69592c6c4e/src/wallet/wallet.cpp#L96

    EDIT: ignore point about wallet.cpp above

    Fixed: #15390

  160. ken2812221 referenced this in commit 3c6ef0393f on Feb 14, 2019
  161. MarcoFalke referenced this in commit e3b1c7a9d6 on Feb 14, 2019
  162. HashUnlimited referenced this in commit 3933d6669b on Feb 23, 2019
  163. kallewoof referenced this in commit 66c015529e on Oct 4, 2019
  164. Munkybooty referenced this in commit 210c14f2dc on Oct 7, 2021
  165. Munkybooty referenced this in commit a4eaf66e50 on Oct 7, 2021
  166. Munkybooty referenced this in commit 7dddefaea1 on Oct 12, 2021
  167. Munkybooty referenced this in commit af28e203fb on Oct 16, 2021
  168. Munkybooty referenced this in commit de9847a4da on Oct 20, 2021
  169. Munkybooty referenced this in commit df6bfdffbe on Oct 21, 2021
  170. Munkybooty referenced this in commit 5216560bfe on Oct 23, 2021
  171. Munkybooty referenced this in commit d6170438e0 on Oct 26, 2021
  172. Munkybooty referenced this in commit fef13107cc on Oct 28, 2021
  173. Munkybooty referenced this in commit 52c875a607 on Nov 12, 2021
  174. Munkybooty referenced this in commit 6b89cb6952 on Nov 13, 2021
  175. Munkybooty referenced this in commit cc1f8db725 on Nov 14, 2021
  176. pravblockc referenced this in commit 07533e7b11 on Nov 18, 2021
  177. DrahtBot locked this on Oct 30, 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-07-01 10:13 UTC

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