Commit Graph

14611 Commits

Author SHA1 Message Date
Matt Corallo efac91e654 Always wait for threadGroup to exit in bitcoind shutdown
This resolves a possible-assert-on-shutdown race introduced in
1f668b6468 when early shutdown
occurs.

Previously this was not done to avoid any cases where the
threadGroup might not exit due to a blocking thread, but at this
point the threadGroup isn't used all that much, plus Qt already
does this, and its good to keep their init/shutdown consistent.

For those curious, the threadGroup is only used in a few places:
 * Its used to run the CCheckQueues in script validation, but these
   use the boost mutex/condition variable primitives, so they
   respect the interrupt pretty trivially.
 * Its used for the import thread, which should exit rather quickly
   as mostly it just calls LoadExternalBlockFile, which has an
   interruption_point right before each block loaded.
 * Its used in the scheduler thread, which is only used for:
   * validationinterface has an effectively-dummy reference to it.
   * wallet compaction, which should not last long
   * addr/banlist dumping from CConnman, which should also be fast
2017-08-01 16:35:02 -04:00
Wladimir J. van der Laan f66c596505
Merge #10788: [RPC] Fix addwitnessaddress by replacing ismine with producesignature
e222dc2 Replace ismine with producesignature check in witnessifier (Andrew Chow)

Pull request description:

  Instead of using ismine to check whether an address can be spent by us, make the witness version of the script or address first and then use ProduceSignature with the DummySignatureCreator to check if we can
  solve for the script.

  This is to fix cases where we don't have all of the private keys (for something like a multisig address) but have the redeemscript so we can witnessify it.

Tree-SHA512: 371777aee839cceb41f099109a13689120d35cf3880cde39216596cc2aac5cc1096af7d9cf07ad9306c3b05c073897f4518a7e97f0b88642f1e3b80b799f481e
2017-08-01 14:27:01 +02:00
Wladimir J. van der Laan 754aa02b8a
Merge #10526: Force on-the-fly compaction during pertxout upgrade
efeb273 Force on-the-fly compaction during pertxout upgrade (Pieter Wuille)

Pull request description:

  It seems that LevelDB tends to leave the old "per txid" UTXO entries in the database lying around for a significant amount of time during and after the per-txout upgrade. This introduces a `CompactRange` function in the database wrapper, and invokes it after every batch of updates in `CCoinsViewDB::Upgrade()`. This lowers temporary disk usage during and after the upgrade.

Tree-SHA512: fbf964c0a33f4e73709c999c8a2bfdef974779c15820907398a2f8828f5fa3e4e153ddd9031d6fc5083be81e22b999b9bd826fd063ad8b88f55c5e8342503290
2017-08-01 13:07:53 +02:00
Wladimir J. van der Laan bd924241e7
Merge #10758: Fix some chainstate-init-order bugs.
c0025d0 Fix segfault when shutting down before fully loading (Matt Corallo)
1385697 Order chainstate init more logically. (Matt Corallo)
ff3a219 Call RewindBlockIndex even if we're about to run -reindex-chainstate (Matt Corallo)
b0f3249 More user-friendly error message if UTXO DB runs ahead of block DB (Matt Corallo)
eda888e Fix some LoadChainTip-related init-order bugs. (Matt Corallo)

Pull request description:

  This does a number of things to clean up chainstate init order,
  fixing some issues as it goes:

  * Order chainstate init more logically - first all of the
    blocktree-related loading, then coinsdb, then
    pcoinsTip/chainActive. Only create objects as needed.

  * More clearly document exactly what is and isn't called in
    -reindex and -reindex-chainstate both with comments noting
    calls as no-ops and by adding if guards.

  * Move the writing of fTxIndex to LoadBlockIndex - this fixes a
    bug introduced in d6af06d68a where
    InitBlockIndex was writing to fTxIndex which had not yet been
    checked (because LoadChainTip hadn't yet initialized the
    chainActive, which would otherwise have resulted in
    InitBlockIndex being a NOP), allowing you to modify -txindex
    without reindex, potentially corrupting your chainstate!

  * Rename InitBlockIndex to LoadGenesisBlock, which is now a more
    natural name for it. Also check mapBlockIndex instead of
    chainActive, fixing a bug where we'd write the genesis block out
    on every start.

  * Move LoadGenesisBlock further down in init. This is a more logical
    location for it, as it is after all of the blockindex-related
    loading and checking, but before any of the UTXO-related loading
    and checking.

  * Give LoadChainTip a return value - allowing it to indicate that
    the UTXO DB ran ahead of the block DB. This just provides a nicer
    error message instead of the previous mysterious
    assert(!setBlockIndexCandidates.empty()) error.

  * Calls ActivateBestChain in case we just loaded the genesis
    block in LoadChainTip, avoiding relying on the ActivateBestChain
    in ThreadImport before continuing init process.

  * Move all of the VerifyDB()-related stuff into a -reindex +
    -reindex-chainstate if guard. It couldn't do anything useful
    as chainActive.Tip() would be null at this point anyway.

Tree-SHA512: 3c96ee7ed44f4130bee3479a40c5cd99a619fda5e309c26d60b54feab9f6ec60fabab8cf47a049c9cf15e88999b2edb7f16cbe6819e97273560b201a89d90762
2017-08-01 12:58:38 +02:00
Wladimir J. van der Laan 42307c4bf3
qt: Periodic translations update
Tree-SHA512: 08b255a0f90eac4a68dbcd7f8cb497c8f0c70a9248ba29f460b31fd4dafcdf14589cbd4518ba803233349643749a03c7fbd3829caf6dc2cdadac8737f3440819
2017-07-31 12:19:05 +02:00
Wladimir J. van der Laan af563971fc
Merge #10949: Clarify help message for -discardfee
bdd5543 Clarify help message for -discardfee (Alex Morcos)

Pull request description:

Tree-SHA512: 7c2f644d1c18e18f11fd85a7b6ca38c480e1ee3932daa4bb19a3965b88146dda899ead0f34d8da02db640598197167bcf69d511501b729e3a8b5b7b6adf08d4e
2017-07-31 12:03:17 +02:00
Wladimir J. van der Laan df3a6f4ee4
Merge #10948: p2p: Hardcoded seeds update pre-0.15 branch
f0acedd p2p: Hardcoded seeds update pre-0.15 branch (Wladimir J. van der Laan)

Pull request description:

  Just the usual
  ```bash
      curl -s http://bitcoin.sipa.be/seeds.txt.gz | gzip -dc > seeds_main.txt
      python3 makeseeds.py < seeds_main.txt > nodes_main.txt
      python3 generate-seeds.py . > ../../src/chainparamsseeds.h
  ```

Tree-SHA512: d73bbdca7de9cf9dd674abb402d6389ac961cb3daf7e3f32534524f6584cdb99b269320b8ab8f42f5d461f611948c6b80ae51ffe3a1312e8fc5e5266bd98be72
2017-07-31 11:33:55 +02:00
Wladimir J. van der Laan 2a50b11586
Merge #10945: Update defaultAssumeValid according to release-process.md.
9a8b054 Update defaultAssumeValid according to release-process.md. (Gregory Maxwell)

Pull request description:

  Updated for block 477890.

Tree-SHA512: 70bca3d81ac170506fba984a97cd44fccaae7da2e709925747fed0e3f763a799b0e89f0b9ed8869b1a55892580594be7b648d3b3635faaee6d85ef6db468dee5
2017-07-31 10:46:22 +02:00
Wladimir J. van der Laan f0aceddf88 p2p: Hardcoded seeds update pre-0.15 branch 2017-07-30 14:04:51 +02:00
Alex Morcos bdd5543ad6 Clarify help message for -discardfee 2017-07-28 09:54:59 -04:00
Wladimir J. van der Laan 70888a39c4
Merge #10885: Reject invalid wallets
d84e78e [wallet] Specify wallet name in wallet loading errors (John Newbery)
a6da027 Reject invalid wallet files (João Barbosa)
3ef77a0 Reject duplicate wallet filenames (João Barbosa)

Pull request description:

  This PR prevents loading the same wallet more than once in a multi wallet scenario. It also prevents loading with invalid files: non regular files or symlinks.

Tree-SHA512: 45bf814096bb788db1c76ff334e679a10686cee7d9c8cd48fe5d924031353ace271f6fb0d4af49a34246d336945515c176920a552be7b9fbe07ab8e00e5f6e5e
2017-07-28 12:54:31 +02:00
John Newbery d84e78ec39 [wallet] Specify wallet name in wallet loading errors 2017-07-28 11:25:38 +01:00
João Barbosa a6da027d83 Reject invalid wallet files 2017-07-28 11:23:43 +01:00
João Barbosa 3ef77a0c12 Reject duplicate wallet filenames 2017-07-28 11:23:42 +01:00
Pieter Wuille efeb273305 Force on-the-fly compaction during pertxout upgrade 2017-07-27 21:07:19 -07:00
Gregory Maxwell 9a8b054185 Update defaultAssumeValid according to release-process.md.
Updated for block 477890.
2017-07-28 01:11:14 +00:00
Andrew Chow e222dc2aee Replace ismine with producesignature check in witnessifier
Instead of using ismine to check whether an address can be spent by us,
make the witness version of the script or address first and then use
ProduceSignature with the DummySignatureCreator to check if we can
solve for the script.

Also fixes test cases to reflect this change.
2017-07-27 15:04:00 -07:00
Matt Corallo c0025d0a92 Fix segfault when shutting down before fully loading
This was introduced by 3192975f1d.
It can be triggered easily when canceling DB upgrade from
pre-per-utxo.
2017-07-27 15:03:05 -04:00
Matt Corallo 138569722c Order chainstate init more logically.
* Order chainstate init more logically - first all of the
  blocktree-related loading, then coinsdb, then
  pcoinsTip/chainActive. Only create objects as needed.

* More clearly document exactly what is and isn't called in
  -reindex and -reindex-chainstate both with comments noting
  calls as no-ops and by adding if guards.

* Move LoadGenesisBlock further down in init. This is a more logical
  location for it, as it is after all of the blockindex-related
  loading and checking, but before any of the UTXO-related loading
  and checking.

* Move all of the VerifyDB()-related stuff into a -reindex +
  -reindex-chainstate if guard. It couldn't do anything useful
  as chainActive.Tip() would be null at this point anyway.
2017-07-27 15:03:05 -04:00
Matt Corallo ff3a21919d Call RewindBlockIndex even if we're about to run -reindex-chainstate
RewindBlockIndex works over both chainActive - disconnecting blocks
from the tip that need witness verification - and mapBlockIndex -
requiring redownload of blocks missing witness data.

It should never have been the case that the second half is skipped
if we're about to run -reindex-chainstate.
2017-07-27 15:03:05 -04:00
Matt Corallo b0f32497b8 More user-friendly error message if UTXO DB runs ahead of block DB
This gives LoadChainTip a return value - allowing it to indicate that
the UTXO DB ran ahead of the block DB. This just provides a nicer
error message instead of the previous mysterious
assert(!setBlockIndexCandidates.empty()) error.

This also calls ActivateBestChain in case we just loaded the genesis
block in LoadChainTip, avoiding relying on the ActivateBestChain
in ThreadImport before continuing init process.
2017-07-27 15:03:05 -04:00
Matt Corallo eda888e573 Fix some LoadChainTip-related init-order bugs.
* Move the writing of fTxIndex to LoadBlockIndex - this fixes a
  bug introduced in d6af06d68a where
  InitBlockIndex was writing to fTxIndex which had not yet been
  checked (because LoadChainTip hadn't yet initialized the
  chainActive, which would otherwise have resulted in
  InitBlockIndex being a NOP), allowing you to modify -txindex
  without reindex, potentially corrupting your chainstate!

* Rename InitBlockIndex to LoadGenesisBlock, which is now a more
  natural name for it. Also check mapBlockIndex instead of
  chainActive, fixing a bug where we'd write the genesis block out
  on every start.
2017-07-27 15:03:05 -04:00
Wladimir J. van der Laan 0b11a07848
Merge #10931: Fix misleading "Method not found" multiwallet errors
df389bc Change wallet method disabled error text (Russell Yanofsky)
e526b3d Fix misleading "Method not found" multiwallet errors (Russell Yanofsky)

Pull request description:

  Raise RPC_WALLET_NOT_SPECIFIED instead of RPC_METHOD_NOT_FOUND when a required
  wallet filename was not specified in an RPC call.

  Also raise more specific RPC_WALLET_NOT_FOUND error instead of
  RPC_INVALID_PARAMETER in case an invalid wallet was specified, for consistency.

Tree-SHA512: 6a8d885283f69bcfc28f2e08ac03eff02f9f8160a312ce2a90d868aa52533434fc0b4c4ab86547c2f09392338956df915637eaf7136a4fc105e6c8179f2d0ac8
2017-07-27 18:58:24 +02:00
Wladimir J. van der Laan ba1bbb049b
Merge #10892: Replace traditional for with ranged for in block and transaction primitives
72f0060 Replace traditional for with ranged for in primitives (Dag Robole)

Pull request description:

  Replace traditional for with ranged for in block and transaction primitives to improve readability

Tree-SHA512: c0fff603d2939149ca48b6aa72b59738a3658d49bd58b2d4ffbc85bdb774d8d5bb808fe526fe22bb9eb214de632834d373e2aab44f6019a83c0b09440cea6528
2017-07-27 14:00:24 +02:00
Wladimir J. van der Laan 8a99fe053a
Merge #10501: remove some unused functions
f228b8e remove some unused functions (Marko Bencun)

Pull request description:

  Identified with `cppcheck --enable=unusedFunction .`.

   - GetSendBufferSize()'s last use removed in
     991955e
   - SetPort()'s last use removed in
     7e195e8
   - GetfLargeWorkInvalidChainFound() was introduced in
     e3ba0ef and never used

Tree-SHA512: ea8e5498bec981e42e1342c171c37723c2f5e575c7d6c1a524d9c6cd9b332bdd0d84fddf9e14ca011bb49fb82bd037386382c9afc546b3c2231ae548358bd4f4
2017-07-27 13:19:32 +02:00
Russell Yanofsky df389bca20 Change wallet method disabled error text
Not strictly backwards compatible because the error is not new in this release.
2017-07-26 09:35:17 -04:00
Wladimir J. van der Laan 5c8eb7916d
Merge #10912: [tests] Fix incorrect memory_cleanse(…) call in crypto_tests.cpp
065039d [tests] Fix incorrect memory_cleanse(…) call in crypto_tests.cpp (practicalswift)

Pull request description:

  `chKey` and `chIV` are pointers, not arrays :-)

  Probably the result of copy-pasting of old code where the code was operating on arrays instead of pointers.

  If I'm reading the code correctly the absence/presence of these `memory_cleanse(…)` calls won't alter the outcome of the test in question (`TestPassphraseSingle`) even if fixed. Therefore removing.

Tree-SHA512: a053b2817bedf6ef889744e546ce9a0f165dee94aef6850d9d6a6bb05b0018789597371ecf154a4aec8588c0ef5626ef08c23c35e35927f6b0497b5f086146fe
2017-07-26 12:06:13 +02:00
Wladimir J. van der Laan 9dd6a2be41
Merge #10824: Avoid unnecessary work in SetNetworkActive
a2420ae Avoid unnecessary work in SetNetworkActive (João Barbosa)

Pull request description:

  This PR adds an early return to avoid unnecessary notifications when the status doesn't change.

Tree-SHA512: 85d05ca6fa36cb581f94bc154d08bd72cd53f6a857173c6fb2f184058f9c0208c4cf5e5d196825a78339902d8f256688eb6793f99abc7be9c7cfac85136180d9
2017-07-26 11:11:42 +02:00
Wladimir J. van der Laan 5c003cb1af
Merge #10917: developer-notes: add reference to snake_case and PascalCase
4a7a4ff developer-notes: add reference to snake_case and PascalCase (Marko Bencun)

Pull request description:

  CamelCase is ambiguous as it refers to both lowerCamelCase and
  UpperCamelCase, whereas PascalCase is only UpperCamelCase.

Tree-SHA512: 8eebc42931f10ed8fd314c6b8a2a936aa18fce358a50bb8ae580404fb06a97b8fece12c0398170a9a8ddce250d1e79ece3774cf8a36ac604d67b2797b54aa005
2017-07-26 11:05:11 +02:00
Russell Yanofsky e526b3d34c Fix misleading "Method not found" multiwallet errors
Raise RPC_WALLET_NOT_SPECIFIED instead of RPC_METHOD_NOT_FOUND when a required
wallet filename was not specified in an RPC call.

Also raise more specific RPC_WALLET_NOT_FOUND error instead of
RPC_INVALID_PARAMETER in case an invalid wallet was specified, for consistency.
2017-07-26 02:48:15 -04:00
Wladimir J. van der Laan 04d395e832
Merge #10854: Avoid using sizes on non-fixed-width types to derive protocol constants.
095b917 Avoid using sizes on non-fixed-width types to derive protocol constants. (Gregory Maxwell)

Pull request description:

  Thanks to awemany for pointing this out.

  This replaces #10172 which appears to be abandoned, but uses the constants as requested on that PR.

Tree-SHA512: 032c0d75b3aaf807a7d0c7fb8ff5515acc45ad58bd00fe81413f900fe02bad900534a970403b9bb568e132c9eddea6043e958daf625e8acc84375bd41ee2e2ef
2017-07-26 08:48:15 +02:00
Wladimir J. van der Laan 78f307b664
Merge #10655: Properly document target_confirmations in listsinceblock
9f8a46f Properly document target_confirmations in listsinceblock (Ryan Havar)

Pull request description:

  There seems to be some misunderstandings about this, but it's a heavily used function so I'd like to make sure the docs are clear about how it works.

  For a later issue:
  * Change the default of target_confirmations to 6  (1 is a pretty silly default)
  * Change the name of target_confirmations (it's really a horrible name)

Tree-SHA512: a2fba2fab30019cea9db56cd7e31de95ba31090617ab336bdf130f9591bfcf3fc5fbd9e7e1e40b6c7bd2f74b9b4658afb1fdc7fc44e1f79520d1319758982a1c
2017-07-26 08:45:01 +02:00
Wladimir J. van der Laan b995a374f7
Merge #10914: Add missing lock in CScheduler::AreThreadsServicingQueue()
a56f8b0 Add missing lock in CScheduler::AreThreadsServicingQueue() (Matt Corallo)

Pull request description:

  Not an actual bug as this is only used in asserts right now, but
  nice to not have a missing lock.

Tree-SHA512: 7e542b150a0be716783e196493d239f2ad15e5376abf54b67d735dc3ef1b10849c090337b849f530c9f7497ddcfb8389b47d64a5dcf6382b7d38838f88cc1100
2017-07-26 08:15:11 +02:00
Wladimir J. van der Laan f29d5dbd04
Merge #10899: [test] Qt: Use _putenv_s instead of setenv on Windows builds
0be03c7 Qt: Use _putenv_s instead of setenv on Windows builds (Brian McMichael)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/10836

  Error message I would get on `make`:
  ```
  ...
    CXXLD    bench/bench_bitcoin.exe
    OBJCXXLD qt/bitcoin-qt.exe
  qt/test/test_main.cpp: In function ‘int main(int, char**)’:
  qt/test/test_main.cpp:64:43: error: ‘setenv’ was not declared in this scope
       setenv("QT_QPA_PLATFORM", "minimal", 0);
                                             ^
  make[2]: *** [qt/test/qt_test_test_bitcoin_qt-test_main.o] Error 1
  make[2]: *** Waiting for unfinished jobs....
  make[2]: Leaving directory `/home/bmcmichael/Projects/bcoin/src'
  make[1]: *** [all-recursive] Error 1
  make[1]: Leaving directory `/home/bmcmichael/Projects/bcoin/src'
  make: *** [all-recursive] Error 1
  ```

  `setenv` function is not available from the Microsoft runtime library. Need to use `_putenv_s` instead.

  This solution tells the compiler to use `_putenv_s` on `WIN32` compilation (Note: this also works on 64-bit Windows instances.) and `setenv` everywhere else.

  I've tested builds on Windows 10 x64 and Ubuntu 16.04 with this code.

Tree-SHA512: d53c996c890e3c6f22b4f2dcca718bef9168f19a6d4a29b8ff13391bfc0c8ea9c1cd16782b47c25b156dcbdff18bb19e23bfd5f6fefb1f373c9d5454a13fc969
2017-07-26 08:12:01 +02:00
practicalswift 065039da1f [tests] Fix incorrect memory_cleanse(…) call in crypto_tests.cpp
chKey and chIV are pointers, not arrays :-)

Probably the result of copy-pasting of old code which was
operating on arrays instead of pointers.
2017-07-26 01:48:40 +02:00
Wladimir J. van der Laan 8537187d42
Merge #10799: Prevent user from specifying conflicting parameters to fundrawtx
99c7fc3 Prevent user from specifying conflicting parameters to fundrawtx (Matt Corallo)

Pull request description:

  estimate_mode/conf_target both are overridden by feeRate, so should
  not be specified together with feeRate.

  Based on #10706

Tree-SHA512: 8ccd08575fd1f2a0d45112538ffbbc73983ee172963230b0cc7ac41d13c6f3c740917f82b212c41ded3a64d873452e7f2c7af49f3b47cab897f8e85117f21333
2017-07-25 22:02:58 +02:00
Wladimir J. van der Laan 9d5e8f92a7
Merge #10927: test: Make sure wallet.backup is created in temp path
88af227 test: Make sure wallet.backup is created in temp path (Wladimir J. van der Laan)

Pull request description:

  This assures that we don't overwrite a random file called `wallet.backup` that happens to be in the current directory. It also assures that the temporary file will be cleaned up.

  Noticed by Evan Klitzke, came up in discussion here: https://github.com/bitcoin/bitcoin/pull/10880#discussion_r128460722

Tree-SHA512: 2d2c23c2deba26a1130a29279b3d8565b277eb90a98a6a6d7dd4948f5cbbd5ec5453b3082e3e4e21e0e2423e642bbd2f4433e4c21032d3c8cff27ee35e87e7e7
2017-07-25 21:56:39 +02:00
Wladimir J. van der Laan 60f9778abf
Revert "[tests] Allow tests to pass when stderr is non-empty"
This reverts commit d64ac3f4aa after further discussion.

Tree-SHA512: db1e4ff5b17bcd6fd000a3d21aa74f6b7e4c194e0663c1896a100612671910a7cdadd896b59642420ea016598895b54a8468914847ebefef105a3c47c311d4b2
2017-07-25 21:42:36 +02:00
Ryan Havar 9f8a46f077 Properly document target_confirmations in listsinceblock 2017-07-25 07:25:07 -12:00
MarcoFalke f1f1605c22
Merge #10703: [tests] Allow tests to pass when stderr is non-empty
d64ac3f [tests] Allow tests to pass when stderr is non-empty (Jonas Schnelli)

Pull request description:

  Resurrect #10241 with nits addressed

  Not sure how much people want this. Would be useful for functional tests which cause bitcoind to print to stderr.

Tree-SHA512: 28caccf7818fb3ed5a38caef7f77161b1678aa9b8fd12c2d1e76032f409f0d33c40f7ac91e0c8d908df4a44fd01cf97d657a08bae50c6ff17d07f5b2e20c3a6e
2017-07-25 21:21:09 +02:00
Wladimir J. van der Laan 88af227687 test: Make sure wallet.backup is created in temp path
This assures that we don't overwrite a random file called
`wallet.backup` that happens to be in the current directory. It also
assures that the temporary file will be cleaned up.

Noticed by Evan Klitzke, came up in discussion here:
https://github.com/bitcoin/bitcoin/pull/10880#discussion_r128460722
2017-07-25 14:44:19 +02:00
Wladimir J. van der Laan 1caafa6cde
Merge #10508: Run Qt wallet tests on travis
4f92b5f Run Qt wallet tests on travis (Russell Yanofsky)

Pull request description:

  Currently these test failures are not caught by travis leading to bugs like:
  https://github.com/bitcoin/bitcoin/pull/10506

Tree-SHA512: db1e4ff5b17bcd6fd000a3d21aa74f6b7e4c194e0663c1896a100612671910a7cdadd896b59642420ea016598895b54a8468914847ebefef105a3c47c311d4b2
2017-07-25 14:23:21 +02:00
Wladimir J. van der Laan 412b466d11
Merge #10870: [Qt] Use wallet 0 in rpc console if running with multiple wallets
9737572 [Qt] Use wallet 0 in rpc console if running with multiple wallets (Jonas Schnelli)

Pull request description:

  Current master with multiwallet results in accessing wallet 0 in QT (send / receive / tx history / etc.), **but** the RPC console cannot access that wallet (only non-wallet commands work).

  This is a quick solution to re-allow accessing the same wallet (Index 0) via RPC console in multiwallet.

  The solutions design is not "state of the art" (should go over WalletModel). Ideally we work on an overall multiwallet support for the GUI (which then would remove this change).

  I think we should consider this as a bugfix.

Tree-SHA512: 16cf844662248ffd3d82c7d0cbe5879f231fbc7d4f5a4aab4180a9087018519c98301e4ac311eaec2cc39dddf25d3edf9be99a6622ea682c138a820a9b21fd0c
2017-07-25 14:10:57 +02:00
Marko Bencun 4a7a4ff1f1 developer-notes: add reference to snake_case and PascalCase
CamelCase is ambiguous as it refers to both lowerCamelCase and
UpperCamelCase, whereas PascalCase is only UpperCamelCase.
2017-07-25 12:37:53 +02:00
Wladimir J. van der Laan 1124328ad1
Merge #10789: Punctuation/grammer fixes in rpcwallet.cpp
a5ecaf1 Fix misspellings and remove safety verbiage (Steven D. Lander)

Pull request description:

  Standardizing punctuation on CLI output and also including a few fixes for grammer.  This PR is for text only changes and includes no code edits.

Tree-SHA512: afde551bf1212838822188b6723f2bf1b7222decfa1cd7aa6b04967489108a29f80833af6059252af028c53437755f258275af0614e0d4d0311e09421cd8e131
2017-07-25 09:49:06 +02:00
Wladimir J. van der Laan 0c70e845aa
Merge #10865: Move CloseSocket out of SetSocketNonBlocking and pass socket as const reference
05e023f Move CloseSocket out of SetSocketNonBlocking and pass SOCKET by const reference in SetSocket* functions (Dag Robole)

Pull request description:

  Rationale:

  Readability, SetSocketNonBlocking does what it says on the tin.

  Consistency, More consistent with the rest of the API in this unit.

  Reusability, SetSocketNonBlocking can also be used by clients that may not want to close the socket on failure.

  This also moves the responsibility of closing the socket back to the caller that opened it, which in general should know better how and when to close it.

Tree-SHA512: 85027137f1b626e2b636549ee38cc757a587adcf464c84be6e65ca16e3b75d7ed1a1b21dd70dbe34c7c5d599af39e53b89932dfe3c74f91a22341ff3af5ea80a
2017-07-24 16:54:42 +02:00
Dag Robole 72f00608d0 Replace traditional for with ranged for in primitives 2017-07-24 16:32:21 +02:00
Wladimir J. van der Laan 6ef3c7ec62
Merge #9622: [rpc] listsinceblock should include lost transactions when parameter is a reorg'd block
876e92b Testing: listsinceblock should display all transactions that were affected since the given block, including transactions that were removed due to a reorg. (Karl-Johan Alm)
f999c46 listsinceblock: optionally find and list any transactions that were undone due to reorg when requesting a non-main chain block in a new 'removed' array. (Karl-Johan Alm)

Pull request description:

  The following scenario will not notify the caller of the fact `tx0` has been dropped:

  1. User 1 receives BTC in tx0 from utxo1 in block aa1.
  2. User 2 receives BTC in tx1 from utxo1 (same) in block bb1
  3. User 1 sees 2 confirmations at block aa3.
  4. Reorg into bb chain.
  5. User 1 asks `listsinceblock aa3` and does not see that tx0 is now invalidated.

  See `listsinceblock.py` commit for related test.

  The proposed fix is to iterate from the given block down to the fork point, and to check each transaction in the blocks against the wallet, in addition to including all transactions from the fork point to the active chain tip (the current behavior). Any transactions that were present will now also be listed in the `listsinceblock` output in a new `replaced` array. This operation may be a bit heavy but the circumstances (and perceived frequency of occurrence) warrant it, I believe.

  Example output:
  ```Python
  {
    'transactions': [],
    'replaced': [
      {
        'walletconflicts': [],
        'vout': 1,
        'account': '',
        'timereceived': 1485234857,
        'time': 1485234857,
        'amount': '1.00000000',
        'bip125-replaceable': 'unknown',
        'trusted': False,
        'category': 'receive',
        'txid': 'ce673859a30dee1d2ebdb3c05f2eea7b1da54baf68f93bb8bfe37c5f09ed22ff',
        'address': 'miqEt4kWp9zSizwGGuUWLAmxEcTW9bFUnQ',
        'label': '',
        'confirmations': -7
      }
    ],
    'lastblock': '7a388f27d09e3699102a4ebf81597d974fc4c72093eeaa02adffbbf7527f6715'
  }
  ```

  I believe this addresses the comment by @luke-jr in https://github.com/bitcoin/bitcoin/pull/9516#issuecomment-274190081 but I could be wrong..

Tree-SHA512: 607b5dcaeccb9dc0d963d3de138c40490f3e923050b29821e6bd513d26beb587bddc748fbb194503fe618cfe34a6ed65d95e8d9c5764a882b6c5f976520cff35
2017-07-24 12:59:48 +02:00
Matt Corallo a56f8b0be3 Add missing lock in CScheduler::AreThreadsServicingQueue()
Not an actual bug as this is only used in asserts right now, but
nice to not have a missing lock.
2017-07-23 14:51:22 -04:00
MarcoFalke 0c173a15ca
Merge #10893: [QA] Avoid running multiwallet.py twice
44eb9d4 [QA] Avoid running multiwallet.py twice (Jonas Schnelli)

Pull request description:

  It's already on L92.

  Second script execution was introduced in #10604 3707fcd94e (probably rebase issue)

  Reported by @MarcoFalke

Tree-SHA512: cd2873df08e31cbf5b7a43b5e6713b643b758496d4357dcc99d1c3ad2da07e55f6d69996654d17d3f5484219cb5fd4e32da3bfd94701d1137bc955241d285e57
2017-07-22 10:41:45 +02:00