Introduce disable-wallet / no-wallet mode. #2901

pull jgarzik wants to merge 2 commits into bitcoin:master from jgarzik:no-wallet changing 1 files +117 −109
  1. jgarzik commented at 5:33 PM on August 15, 2013: contributor

    Goal: As one goal is to eventually separate wallet/GUI from public blockchain engine, it is useful to explore what such an engine would look like. As such, disablewallet=1 will enforce pwalletMain==NULL, or "no-wallet mode."

    Many RPCs are disabled. getblocktemplate does continue to work, permitting no-wallet mining.

  2. BitcoinPullTester commented at 6:14 PM on August 15, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/116c9582760e1fc37408ce74abd0769062aa9025 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  3. BitcoinPullTester commented at 7:42 PM on August 15, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/588e13c40f4e66b3d789f9b426ef173acc21d9ed for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  4. jgarzik commented at 8:09 PM on August 15, 2013: contributor

    Completed review of all RPCs for require-wallet status, and fixed a couple bugs found in testing. disable-wallet mode should be working in bitcoind now. These are the RPCs that remain available:

    addnode <node> <add|remove|onetry>
    createmultisig <nrequired> <'["key","key"]'>
    createrawtransaction [{"txid":txid,"vout":n},...] {address:amount,...}
    decoderawtransaction <hex string>
    getaddednodeinfo <dns> [node]
    getbestblockhash
    getblock <hash> [verbose=true]
    getblockcount
    getblockhash <index>
    getconnectioncount
    getdifficulty
    getgenerate
    gethashespersec
    getinfo
    getmininginfo
    getpeerinfo
    getrawmempool
    getrawtransaction <txid> [verbose=0]
    gettxout <txid> <n> [includemempool=true]
    gettxoutsetinfo
    help [command]
    sendrawtransaction <hex string>
    signrawtransaction <hex string> [{"txid":txid,"vout":n,"scriptPubKey":hex,"redeemScript":hex},...] [<privatekey1>,...] [sighashtype="ALL"]
    stop
    submitblock <hex data> [optional-params-obj]
    validateaddress <bitcoinaddress>
    verifychain [check level] [num blocks]
    verifymessage <bitcoinaddress> <signature> <message>
    
    
  5. jgarzik commented at 8:10 PM on August 15, 2013: contributor

    Updating CreateNewBlock() to take a script, rather than a CReserveKey, should make it possible to enable getblocktemplate RPC.

  6. jgarzik commented at 9:06 PM on August 15, 2013: contributor

    disable-wallet mode now skips BDB environment setup, reducing startup RSS here by over 40MB (h/t @gmaxwell)

  7. BitcoinPullTester commented at 9:10 PM on August 15, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/db2b19ee838cdab513a6503ddefc16d985b59e87 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  8. sipa commented at 9:41 PM on August 15, 2013: member

    Interesting how little code changes were necessary.

  9. sipa commented at 10:31 PM on August 15, 2013: member

    Is there a good reason why this isn't intended to be merged? :p

  10. jgarzik commented at 10:37 PM on August 15, 2013: contributor

    Cannot be merged... as-is. I wouldn't mind merging a cleaned up version, which attention paid to indentation and such.

  11. gmaxwell commented at 10:39 PM on August 15, 2013: contributor

    Only argument I can make against it is that it's more configurations to test and getting the 40mbytes back from BDB on walletless nodes would be nice.

  12. jgarzik commented at 10:41 PM on August 15, 2013: contributor

    Also, my paranoid fear is that I missed a spot in review and testing, and someone will figure out a way to crash a node by triggering a wallet lookup somehow, somewhere.

  13. sipa commented at 10:41 PM on August 15, 2013: member

    All P2P-induced calls from main to wallet should go through the registration interface.

  14. jgarzik commented at 11:35 PM on August 15, 2013: contributor

    Code cleaned up, and perhaps merge-worthy.

  15. jgarzik commented at 11:39 PM on August 15, 2013: contributor

    TODO list:

    • getblocktemplate should be re-enabled, in some form (requires a key for the default txout script, due to CreateNewBlock calling convention)
    • I thought of another TODO item, then promptly forgot. Nevertheless, a bullet point list is not a list without at least two items.
  16. luke-jr commented at 6:14 AM on August 16, 2013: member

    Thoughts on just removing getwork, since it's useless with mainnet and getblocktemplate's use of CreateNewBlock doesn't need a generation transaction at all?

  17. gmaxwell commented at 6:20 AM on August 16, 2013: contributor

    Internal miner needs a generation transaction. :-/ But yea, removing getwork sounds great to me, except for the whole not solving the needing a generation transaction bit...

  18. wtogami commented at 12:13 PM on August 17, 2013: contributor

    Why are we keeping the internal miner at all?

  19. gmaxwell commented at 12:27 PM on August 17, 2013: contributor

    Because we have not provided an adequate replacement with the package, and it's commonly used and perfectly reasonable on testnet.

  20. Diapolo commented at 12:40 PM on August 17, 2013: none

    @gmaxwell Agreed, it's the only miner I use with Testnet as it's so damn easy to use and JUST works.

  21. wtogami commented at 5:51 AM on August 18, 2013: contributor

    With getblocktemplate and submitblock working, this type of node could still be used for p2pool or pools, with the payout address arbitrarily elsewhere for security. That is already possible today with normal nodes with a wallet, but this at least shrinks the memory requirement per p2pool node, which is great.

  22. jgarzik commented at 11:39 AM on August 20, 2013: contributor

    The mining-removal discussion is outside the scope of this pull request, and is better discussed in active mailing list threads or pull req #2905

    getblocktemplate can work just fine in disablewallet mode; just needs additional work appended here. Hence "TODO"

  23. laanwj commented at 6:07 AM on August 22, 2013: member

    Nice. Incidentally this would also be the "no wallets loaded" case for multi wallet support.

    Haven't tested yet, but from looking at the code: validateaddress does a IsMine check (dereferencing pWalletMain) when the address is valid. Will this crash?

  24. in src/init.cpp:None in 9c347636ad outdated
     621 | +                return InitError(_("wallet.dat corrupt, salvage failed"));
     622 |          }
     623 | -        if (r == CDBEnv::RECOVER_FAIL)
     624 | -            return InitError(_("wallet.dat corrupt, salvage failed"));
     625 | -    }
     626 | +    } // (1)
    


    Diapolo commented at 1:36 PM on August 24, 2013:

    What does that (1) mean?


    jgarzik commented at 2:14 PM on August 24, 2013:

    Look at the commits one-by-one. In the code movement commit, you see a "if (1) { ... }" change. This comment is a remnant of that change (that should be removed).

  25. jgarzik commented at 4:15 AM on August 25, 2013: contributor

    Rebased on top of #2928 and fixed @Diapolo 's nit.

    getblocktemplate now works in no-wallet mode. OP updated accordingly. Should be merge ready, modulo another IsMine() review. I reviewed quickly based on @laanwj 's comment, but did not see the case. Will look more closely with brain fully engaged before saying it is 100% merge-ready :)

  26. jgarzik commented at 2:03 AM on August 26, 2013: contributor

    Rebased, and fixed the bug found by @laanwj

  27. jgarzik commented at 2:57 AM on August 27, 2013: contributor

    no-wallet mode is now ready for reviewing and merging.

  28. gavinandresen commented at 12:32 AM on August 28, 2013: contributor

    Nit / pet peeve: negative options, because I hate double-negatives (-disablewallet=0 means "yes I want a wallet please").

    Suggest that the option be: -wallet= to mean "no wallet, please." (default right now is -wallet=wallet.dat).

  29. laanwj commented at 11:26 AM on August 29, 2013: member

    What about "-nowallet"?

  30. Diapolo commented at 1:43 PM on August 29, 2013: none

    @laanwj -wallet=0 IS -nowallet, which I would vote for as a name for the switch.

  31. wtogami commented at 10:56 AM on September 8, 2013: contributor

    I change my mind. I like -disablewallet the way it is now. -disablewallet is best as a distinct parameter for a specific purpose. It is more confusing to overload -wallet= with another possible meaning, and you don't want it to attempt load a wallet file of that name if you have a typo.

    Bleh, before we bikeshed on the name, could folks please review the actual code?

  32. Diapolo commented at 11:19 AM on September 8, 2013: none

    As I said, -foo=0 is -nofoo for every parameter we use, why special case this one?

  33. jgarzik commented at 3:36 PM on September 8, 2013: contributor

    -nowallet is fine with me, as long as it does not break, or otherwise require contortions of, the existing wallet pathname support.

    "-nowallet" seems quite natural, but a concern is that people were discussing -wallet=foo.dat -wallet=bar.dat and similar extensions for multiple wallet support.

    I'm happy to go with whatever most people prefer.

  34. in src/bitcoinrpc.cpp:None in b878f6a924 outdated
    1036 | @@ -1034,6 +1037,8 @@ void ServiceConnection(AcceptedConnection *conn)
    1037 |      const CRPCCommand *pcmd = tableRPC[strMethod];
    1038 |      if (!pcmd)
    1039 |          throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found");
    1040 | +    if (pcmd->reqWallet && !pwalletMain)
    1041 | +        throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (disabled)");
    


    sipa commented at 8:35 PM on September 28, 2013:

    I think "Method requires wallet" or something explicitly mentioning why it is disabled is more useful.

  35. in src/init.cpp:None in b878f6a924 outdated
     853 | @@ -848,92 +854,97 @@ bool AppInit2(boost::thread_group& threadGroup)
     854 |  
     855 |      // ********************************************************* Step 8: load wallet
     856 |  
     857 | -    uiInterface.InitMessage(_("Loading wallet..."));
     858 | +    if (fDisableWallet) {
     859 | +        uiInterface.InitMessage(_("Wallet disabled..."));
    


    sipa commented at 8:37 PM on September 28, 2013:

    Pet peeve: don't use "..." when it's not about an ongoing operation.


    Diapolo commented at 12:30 PM on October 3, 2013:

    Agreed, even if this is a minor thing I would use Wallet disabled! here.


    wtogami commented at 7:47 AM on October 25, 2013:

    +1 for Wallet disabled!

  36. in src/init.cpp:None in b878f6a924 outdated
    1015 | +            pwalletMain->ScanForWalletTransactions(pindexRescan, true);
    1016 | +            printf(" rescan      %15"PRI64d"ms\n", GetTimeMillis() - nStart);
    1017 | +            pwalletMain->SetBestChain(CBlockLocator(pindexBest));
    1018 | +            nWalletDBUpdated++;
    1019 | +        }
    1020 | +    } // (1)
    


    sipa commented at 8:37 PM on September 28, 2013:

    This (1) seems incorrect?

  37. sipa commented at 8:41 PM on September 28, 2013: member

    Code looks good, apart from a few nits (see inline), needs rebase though.

    I don't feel strongly about -disablewallet or -nowallet or -wallet=. We just need to know how it may later integrate with multiwallet (which naturally extends nowallet).

  38. init.cpp: cosmetic indent changes, preparing for no-wallet mode 520cc05b89
  39. Add -disablewallet option, to disable wallet support (and BDB) 5d4f3a1f0c
  40. jgarzik commented at 3:20 PM on October 2, 2013: contributor

    Rebased. This is merge-ready, except for option-naming shed-painting.

  41. BitcoinPullTester commented at 7:24 AM on October 4, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/5d4f3a1f0cbdf52257b41ea09d175c0018ad9434 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  42. gavinandresen commented at 1:24 AM on October 24, 2013: contributor

    -disablewallet is a fine shade of paint for the shed; I think you should rebase, sanity test one last time, and merge.

  43. wtogami commented at 11:04 PM on October 27, 2013: contributor

    https://github.com/wtogami/bitcoin/commits/btc-0.8.5-disablewallet Disable Wallet for Bitcoin 0.8.5

    Please s/Wallet disabled.../Wallet disabled!/

  44. wtogami commented at 11:39 PM on October 29, 2013: contributor

    https://bitcointalk.org/index.php?topic=320695.0 If end-users want to help testing of this patch, a backport is included in this build of Bitcoin 0.8.5

  45. wtogami commented at 10:44 PM on November 1, 2013: contributor
    • Rebase
    • disablewallet=1 needs a GUI error message if someone tries it with bitcoin-qt
    • s/Wallet disabled.../Wallet disabled!/
  46. KobuderaRoninShinobi commented at 7:52 AM on November 2, 2013: none

    s/Wallet disabled.../Wallet disabled!/

  47. sipa commented at 5:34 PM on November 9, 2013: member

    @jgarzik Can you rebase please?

  48. laanwj commented at 2:00 PM on November 12, 2013: member

    See #3240

  49. laanwj closed this on Nov 12, 2013

  50. jgarzik deleted the branch on Aug 24, 2014
  51. IntegralTeam referenced this in commit 357b7279de on Jun 4, 2019
  52. DrahtBot locked this on Sep 8, 2021

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: 2026-04-13 18:16 UTC

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