Commit Graph

11609 Commits

Author SHA1 Message Date
Andrew Chow 174f7c8080 Use a struct for arguments and nested map for categories
Instead of a single map with the category and name as the key,
make m_available_args contain maps. The key will be the category and
the value is a map which actually contains the arguments for that
category. The nested map's key is the argument name, while the value
is a struct that contains the help text and whether the argument is
a debug only argument.
2018-05-30 11:09:15 -04:00
Wladimir J. van der Laan fd96d54f39
Merge #13194: Remove template matching and pseudo opcodes
c814e2e7e8 Remove template matching and pseudo opcodes (Pieter Wuille)

Pull request description:

  The current code contains a rather complex script template matching engine, which is only used for 3 particular script types (P2PK, P2PKH, multisig). The first two of these are trivial to match for otherwise, and a specialized matcher for multisig is both more compact and more efficient than a generic one.

  The goal is being more flexible, so that for example larger standard multisigs inside SegWit outputs are easier to implement.

  As a side-effect, it also gets rid of the pseudo opcodes hack.

Tree-SHA512: 643b409c5c36821519f613a43efd399af0ec99b6131f35cd4024decfb2d483d719e0e921cd088bc9832a7ac797cb4a6b1158b8574c82f7fbebb75f1b31b359df
2018-05-30 16:50:43 +02:00
Wladimir J. van der Laan 3d4fa83587 Stop translating command line options
Many options are extremely technical, and refer internals, making it
difficult to translate usefully. This came up in discussion of e.g.
 #10949. If a message is not understood by translators (which are
typically end-users, not developers) they'll either translate it
literally, making it harder to understand instead of easier, with the
added drawback of the user no longer being able to google it.

Also the translation was only working for bitcoin-qt as with
the console programs, there is no translation backend. So it was
injecting never-used translation messages for bitcoin-cli, -tx.

For these reasons, stop translating options help completely. This should
not affect the output **in any way** except for bitcoin-qt when a
non-English language is configured in the locale.

This implements #10962.
2018-05-30 14:23:35 +02:00
Pieter Wuille c814e2e7e8 Remove template matching and pseudo opcodes
The current code contains a rather complex script template matching engine,
which is only used for 3 particular script types (P2PK, P2PKH, multisig).
The first two of these are trivial to match for otherwise, and a specialized
matcher for multisig is both more compact and more efficient than a generic
one.

The goal is being more flexible, so that for example larger standard multisigs
inside SegWit outputs are more easy to implement.

As a side-effect, it also gets rid of the pseudo opcodes hack.
2018-05-29 14:40:18 -07:00
Wladimir J. van der Laan 70d3541313
Merge #13134: net: Add option `-enablebip61` to configure sending of BIP61 notifications
87fe292d89 doc: Mention disabling BIP61 in bips.md (Wladimir J. van der Laan)
fe16dd8226 net: Add option `-enablebip61` to configure sending of BIP61 notifications (Wladimir J. van der Laan)

Pull request description:

  This commit adds a boolean option `-peersendreject`, defaulting to `1`, that can be used to disable the sending of [BIP61](https://github.com/bitcoin/bips/blob/master/bip-0061.mediawiki) `reject` messages. This functionality has been requested for various reasons:

  - security (DoS): reject messages can reveal internal state that can be used to target certain resources such as the mempool more easily.

  - bandwidth: a typical node sends lots of reject messages; this counts against upstream bandwidth. Also the reject messages tend to be larger than the message that was rejected.

  On the other hand, reject messages can be useful while developing client software (I found them indispensable while creating bitcoin-submittx), as well as for our own test cases, so whatever the default becomes on the long run, IMO the functionality should be retained as option. But that's a discussion for later, for now it's simply a node operator decision.

  Also adds a RPC test that checks the functionality.

Tree-SHA512: 9488cc53e13cd8e5c6f8eb472a44309572673405c1d1438c3488f627fae622c95e2198bde5ed7d29e56b948e2918bf1920239e9f865889f4c37c097c37a4d7a9
2018-05-29 15:31:54 +02:00
Wladimir J. van der Laan 3fd0c2336a
Merge #13273: Qt/Bugfix: fix handling default wallet with no name
13c3a659c0 Qt/Bugfix: fix handling default wallet with no name (João Barbosa)

Pull request description:

  If one loads a wallet via RPC (`loadwallet w2`), then select w2, select back to the default wallet (which is an empty string), that default wallet cannot be access through the RPC console because the current code only points to the wallet endpoint if the wallet name is not empty.

  This is a quick fix that reenables accessing the default wallet in case an additional wallet has been loaded.

  Using "" for the default wallet may not be ideal in other cases and it may make more sense to change it at a deeper level (wallet.cpp). See discussion here which where the reasons for the current behaviour in master:
  https://github.com/bitcoin/bitcoin/pull/11687#issuecomment-370862718

  @jnewbery @promag @ryanofsky

Tree-SHA512: 74b935886b4e4a6033a2f5e1f44bb69a252e31f4021e19a2054445a8e3e4db1d8ee256290850a84d8569d2d0e21412fce0170e7f0e881259156057587181ee05
2018-05-29 15:24:26 +02:00
Wladimir J. van der Laan 56fe3dc235
Merge #13142: Separate IsMine from solvability
c004ffc9b4 Make handling of invalid in IsMine more uniform (Pieter Wuille)
a53f0feff8 Add some checks for invalid recursion in IsMine (Pieter Wuille)
b5802a9f5f Simplify IsMine logic (Pieter Wuille)
4e91820531 Make IsMine stop distinguishing solvable/unsolvable (Pieter Wuille)
6d714c3419 Make coincontrol use IsSolvable to determine solvability (Pieter Wuille)

Pull request description:

  Our current `IsMine` logic does several things with outputs:
  * Determine "spendability" (roughly corresponding to "could we sign for this")
  * Determine "watching" (is this an output directly or indirectly a watched script)
  * Determine invalidity (is this output definitely not legally spendable, detecting accidental uncompressed pubkeys in witnesses)
  * Determine "solvability" (would we be able to sign for this ignoring the fact that we may be missing some private keys).

  The last item (solvability) is mostly unrelated and only rarely needed (there is just one instance, inside the wallet's coin control logic). This PR changes that instance to use the separate `IsSolvable` function, and stop `IsMine` from distinguishing between solvable and unsolvable.

  As an extra, this also simplifies the `IsMine` logic and adds some extra checks (which wouldn't be hit unless someone adds already invalid scripts to their wallet).

Tree-SHA512: 95a6ef75fbf2eedc5ed938c48a8e5d77dcf09c933372acdd0333129fb7301994a78498f9aacce2c8db74275e19260549dd67a83738e187d40b5090cc04f33adf
2018-05-29 15:12:16 +02:00
Wladimir J. van der Laan a315b79ad2
Merge #13275: Qt: use [default wallet] as name for wallet with no name
2885c131b6 Qt: use [default wallet] as name for wallet with no name (Jonas Schnelli)

Pull request description:

  Loading a wallet from a state where only the default wallet was active results in using an empty string for the initial/default wallet name.

  This is a GUI only quick-fix that overrides wallet(s) with name "" to "[default wallet]". Does not affect `getwalletinfo` or `listwallets`.

  Also, unsure if it should be fixed at a deeper level and if – instead of [default wallet] – it should use `wallet.dat` (the filename of the default wallet).

Tree-SHA512: 1d50dbb200b23df5ac53ce15aeb6453af4da354d6e6e53fe33ff075b477493254d6028b6d3569a7804b1aa616cb9a988a53de818937e37cdcb19cb70a90e2a88
2018-05-28 17:10:36 +02:00
Wladimir J. van der Laan 14a4b49663
Merge #13300: qa: Initialize lockstack to prevent null pointer deref
fa9da85b7c qa: Initialize lockstack to prevent null pointer deref (MarcoFalke)

Pull request description:

  It is currently impossible to call debug methods such as `AssertLock(Not)Held` on a thread without running into undefined behavior, unless a lock was pushed on the stack in this thread.

  Initializing the global `lockstack` seems to fix both issues.

Tree-SHA512: 8cb76b22cb31887ddf15742fdc790f01e8f04ed837367d0fd4996535748d124342e8bfde68952b903847b96ad33406c64907a53ebab9646f78d97fa4365c3061
2018-05-28 16:28:46 +02:00
Wladimir J. van der Laan f5a7733ff7
Merge #13306: build: split warnings out of CXXFLAGS
9e305b56f5 build: split warnings out of CXXFLAGS (Cory Fields)

Pull request description:

  CXXFLAGS should not be modified anyway. Also, this will enable us to selectively disable warnings.

  As discussed with @sipa on IRC. Intention is to be able to filter out warnings from leveldb code so that we can be more aggressive with what we enable.

Tree-SHA512: 1bf686250f7a59c0aff04371f87c5db4e8f5bde604c6ab75e568326fb6d7733f26b113fa52dc1c836fa10baa76770d479a0e5f82a4a1905947dd7f245e0560f4
2018-05-28 16:01:48 +02:00
Pieter Wuille c004ffc9b4 Make handling of invalid in IsMine more uniform 2018-05-24 10:29:02 -07:00
Wladimir J. van der Laan f8be434133
Merge #13284: gui: fix visual "overflow" of amount input.
5f3cbde9de Increased max width of amount field to prevent number overflow bug. (Brandon Ruggles)

Pull request description:

  Fixes #13231.

  I was able to reproduce this bug within my own Fedora 27 VM. Following @jonasschnelli's advice, I first tried to change `setAlignment(Qt::AlignRight);` to `setAlignment(Qt::AlignLeft);`, however, I realized that this wouldn't fix the underlying overflow problem, as it would only make it easier to see the most significant digits under certain scenarios. The reason for the overflow is that Fedora uses plus and minus buttons on the Qt spin box class, rather than up and down arrows, which is what happens on **most** other operating systems. These plus and minus buttons take up more width, and therefore provide less space for text.

  The solution I went with was the second suggestion by @jonasschnelli, which was to just increase the maximum width of the amount box. After some experimentation, 240 seemed to be the smallest max width that would allow as many digits as one would want in the amount box without overflow, even with the plus and minus buttons in Fedora.

  Please let me know if there are any issues with this PR and I will work to fix them. Thank you!

Tree-SHA512: 155f34cec74af46ec1fe723a5241798d8e15607a4e1cdc493014dcc0ae9818a001c7901831168b5f26a6953ec5a992e4a67c57db1ad377bcf10f12941688ee93
2018-05-24 15:52:21 +02:00
MarcoFalke 536120ec39
Merge #13291: test: Don't include torcontrol.cpp into the test file
97c112d4ca Declare TorReply parsing functions in torcontrol_tests (Ben Woosley)

Pull request description:

  These methods are standalone string parsing methods which were included
  into test via an include of torcontrol.cpp, which is bad practice.

  ~~Splitting them out reveals that they were the only torcontrol.cpp
  methods under test, so the test file is renamed tor_reply_tests.cpp.~~

  Introduced in #10408

Tree-SHA512: 8ff11a9c900a88f910a73dfe16f43581a567e9d60e9298a8a963fc9dd7cffb4d97a644da677610aafb7d89f1dd1cede9afeae2c6344305e021a9a322dbcea0ac
2018-05-24 09:09:35 -04:00
MarcoFalke a9b6957383
Merge #13314: Fix FreeBSD build by including utilstrencodings.h
c865ee1e73 Fix FreeBSD build by including utilstrencodings.h (Wladimir J. van der Laan)

Pull request description:

  `random.cpp` needs to explicitly include `utilstrencodings.h` to get `ARRAYLEN`. This fixes the FreeBSD build.

  This was broken in 84f41946b9 (#13236).

Tree-SHA512: bdc2a28411ae217e40697c0315ef5a37cc2f5b6bc7bbde16684fb7343d1c1c620d67777a88e609a2190115edb08b823cfb5d31ed16356a7cb0d00c3b6f877c0e
2018-05-24 09:04:38 -04:00
Wladimir J. van der Laan 6378eef18f
Merge #13063: Use shared pointer to retain wallet instance
80b4910f7d wallet: Use shared pointer to retain wallet instance (João Barbosa)

Pull request description:

  Currently there are 3 places where it makes sense to retain a wallet shared pointer:
   - `vpwallets`;
   - `interfaces::Wallet` interface instance - used by the UI;
   - wallet RPC functions - given by `GetWalletForJSONRPCRequest`.

  The way it is now it is possible to have, for instance, listunspent RPC and in parallel unload the wallet (once #13111 is merged) without blocking. Once the RPC finishes, the shared pointer will release the wallet.

  It is also possible to get all existing wallets without blocking because the caller keeps a local list of shared pointers.

  This is mostly relevant for wallet unloading.

  This PR replaces #11402.

Tree-SHA512: b7e37c7e1ab56626085afe2d40b1628e8d4f0dbda08df01b7e618ecd2d894ce9b83d4219443f444ba889096286eff002f163cb0a48f37063b62e9ba4ccfa6cce
2018-05-24 11:58:41 +02:00
Wladimir J. van der Laan c865ee1e73 Fix FreeBSD build by including utilstrencodings.h
`random.cpp` needs to explicitly include `utilstrencodings.h` to get
`ARRAYLEN`. This fixes the FreeBSD build.

This was broken in 84f41946b9.
2018-05-24 09:51:47 +02:00
Wladimir J. van der Laan 7f4db9a7c3
Merge #13151: net: Serve blocks directly from disk when possible
0bf431870e net: Serve blocks directly from disk when possible (Wladimir J. van der Laan)

Pull request description:

  In `ProcessGetBlockData`, send the block data directly from disk if type MSG_WITNESS_BLOCK is requested. This is a valid shortcut as the on-disk format matches the network format.

  This is expected to increase performance because a deserialization and subsequent serialization roundtrip is avoided.

Tree-SHA512: 9a9500b4c1354eaae1a6f1c6ef2416c1c1985029852589266f3a70e808f6c7482c135e9ab251a527566935378ab7c32dba4ed43ba5451e802d8e72b77d1ba472
2018-05-23 19:51:28 +02:00
Wladimir J. van der Laan 3c2a41a9fc
Merge #13011: Cache witness hash in CTransaction
fac1223a56 Cache witness hash in CTransaction (MarcoFalke)
faab55fbb1 Make CMutableTransaction constructor explicit (MarcoFalke)

Pull request description:

  This speeds up:
  * compactblocks (v2)
  * ATMP
  * validation and miner (via `BlockWitnessMerkleRoot`)
  * sigcache (see also unrelated #13204)
  * rpc and rest (nice, but irrelevant)

  This presumably slows down rescan, which uses a `CTransaction` and its `GetHash`, but never uses the `GetWitnessHash`. The slow down is proportional to the number of witness transactions in the rescan window. I.e. early in the chain there should be no measurable slow down. Later in the chain, there should be a slow down, but acceptable given the speedups in the modules mentioned above.

Tree-SHA512: 443e86acfcceb5af2163e68840c581d44159af3fd1fce266cab3504b29fcd74c50812b69a00d41582e7e1c5ea292f420ce5e892cdfab691da9c24ed1c44536c7
2018-05-23 19:26:18 +02:00
Wladimir J. van der Laan b9551d3663
Merge #10757: RPC: Introduce getblockstats to plot things
41d0476f62 Tests: Add data file (Anthony Towns)
4cbfb6aad9 Tests: Test new getblockstats RPC (Jorge Timón)
35e77a0288 RPC: Introduce getblockstats (Jorge Timón)
cda8e36f01 Refactor: RPC: Separate GetBlockChecked() from getblock() (Jorge Timón)

Pull request description:

  It returns per block statistics about several things. It should be easy to add more if people think of other things to add or remove some if I went too far (but once written, why not keep it? EDIT: answer: not to test or maintain them).

  The currently available options are: minfee,maxfee,totalfee,minfeerate,maxfeerate,avgfee,avgfeerate,txs,ins,outs (EDIT: see updated list in the rpc call documentation)

  For the x axis, one can use height or block.nTime (I guess I could add mediantime if there's interest [EDIT: nobody showed interest but I implemented mediantime nonetheless, in fact there's no distinction between x or y axis anymore, that's for the caller to judge]).

  To calculate fees, -txindex is required.

Tree-SHA512: 2b2787a3c7dc4a11df1fce62c8a4c748f5347d7f7104205d5f0962ffec1e0370c825b49fd4d58ce8ce86bf39d8453f698bcd46206eea505f077541ca7d59b18c
2018-05-23 19:00:48 +02:00
Cory Fields 9e305b56f5 build: split warnings out of CXXFLAGS
CXXFLAGS should not be modified anyway. Also, this will enable us to
selectively disable warnings.
2018-05-22 17:47:11 -04:00
Jorge Timón 35e77a0288
RPC: Introduce getblockstats 2018-05-22 23:26:32 +02:00
João Barbosa 80b4910f7d wallet: Use shared pointer to retain wallet instance 2018-05-22 16:56:20 +01:00
MarcoFalke 6916024768
Merge #13282: trivial: Mark overrides as such.
60ebc7da4c trivial: Mark overrides as such. (Daniel Kraft)

Pull request description:

  This trivial change adds the `override` keyword to some methods that override virtual base class / interface methods.  This ensures that any future changes to the interface's method signatures which are not correctly mirrored in the subclasses will break at compile time with a clear error message, rather than at runtime.

Tree-SHA512: cc1bfa5f03b5e29d20e3eab07b0b5fa2f77b47f79e08263dbff43e4f463e9dd8f4f537e2c8c9b6cb3663220dcf40cfd77723cd9fcbd623c9efc90a4cd44facfc
2018-05-22 06:44:44 -04:00
MarcoFalke fa9da85b7c
qa: Initialize lockstack to prevent null pointer deref 2018-05-22 06:31:26 -04:00
Ben Woosley 97c112d4ca
Declare TorReply parsing functions in torcontrol_tests
Rather than including the implementation file into the test,
which is bad practice.
2018-05-21 10:53:18 -07:00
John Newbery be87c6f837 [wallet] Fix incorrect comment for DeriveNewSeed. 2018-05-21 12:57:40 -04:00
Daniel Kraft 60ebc7da4c trivial: Mark overrides as such.
This trivial change adds the "override" keyword to some methods of
subclasses meant to override interface methods.  This ensures that any
future change to the interface' method signatures which are not correctly
mirrored in the subclass will break at compile time with a clear error message,
rather than fail at runtime (which is harder to debug).
2018-05-20 09:15:39 +02:00
Brandon Ruggles 5f3cbde9de Increased max width of amount field to prevent number overflow bug. 2018-05-20 01:09:16 -04:00
John Newbery 79053a5f2b [rpc] [wallet] Add 'hdmasterkeyid' alias return values.
Restores the  return value in getwalletinfo() and getaddressinfo()
RPC methods for backwards compatibility
2018-05-19 11:21:20 -04:00
John Newbery c75c351419 [refactor] manually change remaining instances of master key to seed. 2018-05-19 11:21:15 -04:00
John Newbery 131d4450b9 scripted-diff: Rename master key to seed
-BEGIN VERIFY SCRIPT-

ren() { git grep -l "\<$1\>" 'src/*.cpp' 'src/*.h' test | xargs sed -i "s:\<$1\>:$2:g"; }
ren GenerateNewHDMasterKey  GenerateNewSeed
ren DeriveNewMasterHDKey    DeriveNewSeed
ren SetHDMasterKey          SetHDSeed
ren hdMasterKeyID           hd_seed_id
ren masterKeyID             seed_id
ren SetMaster               SetSeed
ren hdmasterkeyid           hdseedid
ren hdmaster                hdseed

-END VERIFY SCRIPT-
2018-05-19 11:16:00 -04:00
Jonas Schnelli 2885c131b6
Qt: use [default wallet] as name for wallet with no name 2018-05-19 11:24:40 +02:00
João Barbosa 13c3a659c0
Qt/Bugfix: fix handling default wallet with no name 2018-05-18 19:59:25 +02:00
Wladimir J. van der Laan d9ebb63919
Merge #13176: Improve CRollingBloomFilter performance: replace modulus with FastMod
9aac9f90d5 replace modulus with FastMod (Martin Ankerl)

Pull request description:

  Not sure if this is optimization is necessary, but anyway I have some spare time so here it is. This replaces the slow modulo operation with a much faster 64bit multiplication & shift. This works when the hash is uniformly distributed between 0 and 2^32-1. This speeds up the benchmark by a factor of about 1.3:

  ```
  RollingBloom, 5, 1500000, 3.73733, 4.97569e-07, 4.99002e-07, 4.98372e-07 # before
  RollingBloom, 5, 1500000, 2.86842, 3.81630e-07, 3.83730e-07, 3.82473e-07 # FastMod
  ```

  Be aware that this changes the internal data of the filter, so this should probably
  not be used for CBloomFilter because of interoperability problems.

Tree-SHA512: 04104f3fb09f56c9d14458a6aad919aeb0a5af944e8ee6a31f00e93c753e22004648c1cd65bf36752b6addec528d19fb665c27b955ce1666a85a928e17afa47a
2018-05-18 18:46:35 +02:00
Wladimir J. van der Laan 1a8b12c69c
Merge #13265: wallet: Exit SyncMetaData if there are no transactions to sync
b0d2ca9fb6 wallet: Exit SyncMetaData if there are no transactions to sync (Wladimir J. van der Laan)

Pull request description:

  Instead of crash with an assertion error, simply exit the function `SyncMetaData` if there is no metadata to sync.

  Fixes #13110.

Tree-SHA512: 44c4789497b5b63963bef66d8b695987dde80764199f6ea0f2c974be19d29c2663f32446a663a2ee9029e143e5d1d9e8a591e52e6e7e795b982782626bec25bb
2018-05-18 12:53:16 +02:00
Jonas Schnelli e54550303b
Merge #13097: ui: Support wallets loaded dynamically
2e7513471 fixup! ui: Support wallets loaded dynamically (João Barbosa)
0e674ba55 ui: Support wallets loaded dynamically (João Barbosa)
1c8fe0bf9 ui: Remove unnecessary variable fFirstWallet (João Barbosa)

Pull request description:

  Add support in the UI for wallets loaded dynamically.

Tree-SHA512: 4016d61580b31e28c49861b1cb0e77fac5417f9676a6ce6156be28cb6059fdf3d3dd4d57dbbc22a574ad428c2a4a3702aedca596a84e644ce148e1084feb29c9
2018-05-18 10:10:46 +02:00
Jonas Schnelli 2a7c53bc2a
Merge #13264: [qt] Satoshi unit
c722f00a7 [qt] Added satoshi unit "Satoshi (sat)" will be displayed in dropdowns and status bars. "sat" will be used when appended to numbers. (GreatSock)
4ddbcbf8c [qt] BitcoinUnits::format with zero decimals Formatting with zero decimals will now result in 123 instead of 123.0 (GreatSock)

Pull request description:

  This adds satoshi as an additional amount unit for the GUI.

Tree-SHA512: c166c96c9a434b6ac700e1628e54f2dbb132c5232d949c0b464f61276a91d56f9bab4a62d50780535f1d34eaac6484f693a1e0611cd7c9d1ed5ebee066c0dd08
2018-05-18 09:17:20 +02:00
João Barbosa 2e75134719 fixup! ui: Support wallets loaded dynamically 2018-05-18 00:46:44 +01:00
Wladimir J. van der Laan b0d2ca9fb6 wallet: Exit SyncMetaData if there are no transactions to sync
Instead of crash with an assertion error, simply exit the function
`SyncMetaData` if there is no metadata to sync.

Fixes #13110.
2018-05-17 22:07:32 +02:00
MarcoFalke 1b53e4f67c
Merge #13236: break circular dependency: random/sync -> util -> random/sync
84f41946b9 break circular dependency: random/sync -> util -> random/sync (Chun Kuan Lee)

Pull request description:

  LogPrintf  has acutally been moved to logging.h

Tree-SHA512: a7135f5fea421e62f010f2e434873bd1c1738f115453377dada7d24900b3b095535d8aa0462c3acffdacf2f4e819e05ad39b13f2de5a36ac8f7b8467c639a0db
2018-05-17 12:26:02 -04:00
GreatSock c722f00a7e [qt] Added satoshi unit
"Satoshi (sat)" will be displayed in dropdowns and status bars.
"sat" will be used when appended to numbers.
2018-05-17 16:14:49 +02:00
GreatSock 4ddbcbf8c4 [qt] BitcoinUnits::format with zero decimals
Formatting with zero decimals will now result in 123 instead of 123.0
2018-05-17 15:50:09 +02:00
Chun Kuan Lee 84f41946b9 break circular dependency: random/sync -> util -> random/sync 2018-05-17 08:13:54 +00:00
Luke Dashjr 82dda6bed9
GUI: Allow generating Bech32 addresses with a legacy-address default 2018-05-17 09:40:50 +08:00
Luke Dashjr 7ab1c6f6a7
GUI: Rephrase Bech32 checkbox text/tooltip
- "Bech32" isn't very user-friendly
- You don't spend from addresses
2018-05-17 09:31:35 +08:00
João Barbosa 0e674ba557 ui: Support wallets loaded dynamically 2018-05-16 20:48:48 +01:00
João Barbosa 1c8fe0bf90 ui: Remove unnecessary variable fFirstWallet 2018-05-16 20:48:48 +01:00
Wladimir J. van der Laan 4cfe17c338
Merge #10740: [wallet] `loadwallet` RPC - load wallet at runtime
cd53981 [docs] Add release notes for `loadwallet` RPC. (John Newbery)
a46aeb6 [wallet] [tests] Test loadwallet (John Newbery)
5d15260 [wallet] [rpc] Add loadwallet RPC (John Newbery)
876eb64 [wallet] Pass error message back from CWallet::Verify() (John Newbery)
e0e90db [wallet] Add CWallet::Verify function (John Newbery)
470316c [wallet] setup wallet background flushing in WalletInit directly (John Newbery)
59b87a2 [wallet] Fix potential memory leak in CreateWalletFromFile (John Newbery)

Pull request description:

  Adds a `loadwallet` RPCs. This allows wallets to be loaded dynamically during runtime without having to stop-start the node with new `-wallet` params.

  Includes functional tests and release notes.

  Limitations:

  - currently this functionality is only available through the RPC interface.
  - wallets loaded in this way will not be displayed in the GUI.

Tree-SHA512: f80dfe32b77f5c97ea3732ac538de7d6ed7e7cd0413c2ec91096bb652ad9bccf05d847ddbe81e7cd3cd44eb8030a51a5f00083871228b1b9b0b8398994f6f9f1
2018-05-16 21:39:17 +02:00
Wladimir J. van der Laan 11e7bdfd90
Merge #13023: Fix some concurrency issues in ActivateBestChain()
dd435ad Add unit tests for signals generated by ProcessNewBlock() (Jesse Cohen)
a3ae8e6 Fix concurrency-related bugs in ActivateBestChain (Jesse Cohen)
ecc3c4a Do not unlock cs_main in ABC unless we've actually made progress. (Matt Corallo)

Pull request description:

  Originally this PR was just to add tests around concurrency in block validation - those tests seem to have uncovered another bug in ActivateBestChain - this now fixes that bug and adds tests.

  ActivateBestChain (invoked after a new block is validated) proceeds in steps - acquiring and releasing cs_main while incrementally disconnecting and connecting blocks to sync to the most work chain known (FindMostWorkChain()). Every time cs_main is released the result of FindMostWorkChain() can change - but currently that value is cached across acquisitions of cs_main and only refreshed when an invalid chain is explored. It needs to be refreshed every time cs_main is reacquired. The test added in 6094ce7304 will occasionally fail without the commit fixing this issue 26bfdbaddb

  Original description below
  --

  After a bug discovered where UpdatedBlockTip() notifications could be triggered out of order (#12978), these unit tests check certain invariants about these signals.

  The scheduler test asserts that a SingleThreadedSchedulerClient processes callbacks fully and sequentially.

  The block validation test generates a random chain and calls ProcessNewBlock from multiple threads at random and in parallel. ValidationInterface callbacks verify that the ordering of BlockConnected BlockDisconnected and UpdatedBlockTip events occur as expected.

Tree-SHA512: 4102423a03d2ea28580c7a70add8a6bdb22ef9e33b107c3aadef80d5af02644cdfaae516c44933924717599c81701e0b96fbf9cf38696e9e41372401a5ee1f3c
2018-05-16 18:30:35 +02:00
John Newbery 5d152601e9 [wallet] [rpc] Add loadwallet RPC
The new `loadwallet` RPC method allows an existing wallet to be loaded
dynamically at runtime.

`unloadwallet` and `createwallet` are not implemented. Notably,
`loadwallet` can only be used to load existing wallets, not to create a
new wallet.
2018-05-16 12:00:01 -04:00