Commit graph

19907 commits

Author SHA1 Message Date
Adam Jonas 2fa85ebd1c add rpc_misc.py, mv test getmemoryinfo, add test mallocinfo 2019-02-26 15:08:36 -05:00
Suhas Daftuar 4d834018e3 [addrman] Improve tried table collision logging 2019-02-26 14:59:30 -05:00
MarcoFalke d88f7f8764
Merge #15471: rpc/gui: Remove 'Unknown block versions being mined' warning
ef362f2773 rpc/gui: Remove 'Unknown block versions being mined' warning (Wladimir J. van der Laan)

Pull request description:

  Due to miners inserting garbage into the version numbers causing false positives, the current version signalling has become completely useless. This removes the "unknown block versions" warning which has the tendency to scare users unnecessarily (and might get them to "update" to something bad).

  It preserves the warning in the logs. Whether this is desirable can be a point of discussion.

Tree-SHA512: 51407ccd24a571462465d9c7180f0f28307c50b82a03284abe783e181d8ab7e0638dbb710698d883f28de8a609db70763e39be2470d956e67c833da0768e43e9
2019-02-26 09:20:39 -05:00
MarcoFalke 9999879f56
refactor: Use RPCHelpMan::IsValidNumArgs in getrawtransaction 2019-02-25 23:47:36 -05:00
MarcoFalke fa9ff8fe21
doc: Remove misleading hint in getrawtransaction 2019-02-25 23:45:48 -05:00
MarcoFalke 8f470ecc53
Merge #15419: qa: Always refresh cache to be out of ibd
fa2cdc9ac2 test: Simplify create_cache (MarcoFalke)
fa25210d62 qa: Fix wallet_txn_doublespend issue (MarcoFalke)
1111aecbb5 qa: Always refresh stale cache to be out of ibd (MarcoFalke)
fab0d85802 qa: Remove mocktime unless required (MarcoFalke)

Pull request description:

  When starting a test, we are always in IBD because the timestamps on cached blocks are in the past. Usually, we solve that by generating a block at the beginning of the test.

  That is clumsy and might even lead to other problems such as #15360 and https://github.com/bitcoin/bitcoin/issues/14446#issuecomment-461926598

  So fix that by getting rid of mocktime and always refreshing the last block of the cache when starting the test framework.

  Should fix #14446

Tree-SHA512: 6af09800f9c86131349a103af617a54551f5f3f3260d38e14e3f30fdd3d91a0feb0100c56cbb12eae4aeac5571ae4b530b16345cbb831d2670237b53351a22c1
2019-02-25 11:44:21 -05:00
MarcoFalke fa2cdc9ac2
test: Simplify create_cache 2019-02-25 11:18:24 -05:00
MarcoFalke fa38535130
bench: Benchmark MempoolToJSON 2019-02-25 10:13:23 -05:00
MarcoFalke fa5dc3534b
rpc: Pass mempool into MempoolToJSON 2019-02-25 10:12:29 -05:00
Wladimir J. van der Laan ef362f2773 rpc/gui: Remove 'Unknown block versions being mined' warning
Due to miners inserting garbage into the version numbers, the current
version signalling has become completely useless. This removes the
"unknown block versions" warning which has the tendency to scare
users unnecessarily (and might get them to "update" to something
bad).

It preserves the warning in the logs. Whether this is desirable can
be a point of discussion.
2019-02-25 15:59:02 +01:00
Wladimir J. van der Laan b4fc5257b7
Merge #15456: Enable PID file creation on WIN
3f5ad622e5 Enable PID file creation on Windows - Add available WIN PID function - Consider WIN32 in each relevant case - Add new preprocessor definitions to suppress warning - Update error message for generic OS (riordant)

Pull request description:

  # Introduction

  As discussed with @laanwj on IRC:

  - PID file creation was never enabled for Windows, as the `pid_t` filetype is not available for it. However, the WIN32 API contains the header [`Processthreadsapi.h`](https://github.com/CodeShark/x86_64-w64-mingw32/blob/master/include/processthreadsapi.h) which in turn contains the function [`GetCurrentProcessId()`](https://docs.microsoft.com/en-gb/windows/desktop/api/processthreadsapi/nf-processthreadsapi-getcurrentprocessid). ~~This function is called at a higher level by [`_getpid()`](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/getpid?view=vs-2017)~~ EDIT: `_getpid()` is not available to the MSVC compiler used in the AppVeyor build. As a result, I have changed the function call to`GetCurrentProcessId()`, which performs the same function and is available to both MinGW & MSVC.
  This allows one to capture the PID in Windows, without any additional includes - the above function is already available.

  - Within this PR, I have added a separate line that calls `GetCurrentProcessId()` in the case of a WIN compilation, and the usual `getpid()` otherwise. All code blocks processing PID file logic that avoid WIN32 have been changed to consider it. I have also updated the preprocessor definitions in `libbitcoin_server.vcxproj.in` to suppress a warning related to `std::strerror` for the MSVC build, that was causing the AppVeyor build to fail (see @fanquake comment below).

  # Rationale
  - Consistency between OS's running Bitcoin
      - Applications which build off of `bitcoind`, such as novel front-end clients, often need access to the PID in order to control the daemon. Instead of designing some alternate way of doing this for one system, it should be consistent between all of them.

  In collaboration with @joernroeder

Tree-SHA512: 22fcbf866e99115d12ed29716e68d200d4c118ae2f7b188b7705dc0cf5f0cd0ce5fb18f772744c6238eecd9e6d0922c615e2f0e12a7fe7c810062a79d97aa6a2
2019-02-25 13:20:01 +01:00
riordant 3f5ad622e5 Enable PID file creation on Windows
- Add available WIN PID function
- Consider WIN32 in each relevant case
- Add new preprocessor definitions to suppress warning
- Update error message for generic OS

Co-authored-by: Jörn Röder <kontakt@joernroeder.de>
2019-02-25 16:00:34 +07:00
Wladimir J. van der Laan 1a8a5ede9f
Merge #15401: rpc: Actually throw help when passed invalid number of params
fa4ce7038d rpc: Actually throw help when passed invalid number of params (MarcoFalke)
fa05626ca7 rpc: Add RPCHelpMan::IsValidNumArgs() (MarcoFalke)

Pull request description:

  Can be tested by

  * running the included test against an old binary (compiled without this patch)
  * calling `setban 1 "add" 3 4 5 6 7 8 9 0` in the gui

Tree-SHA512: aa6a25bbe6f40722913ea292252a62a4012c964eed9f4035335a2e2d13be98eb60f368e8a3251a104a26a62c08b2cb926b06e5ab1418ef1cf4abdd71d87c2919
2019-02-25 09:31:08 +01:00
Pieter Wuille 9b1ff5c742 Call InvalidateBlock without cs_main held 2019-02-24 18:55:21 -08:00
Pieter Wuille 241b2c74ac Make RewindBlockIndex interruptible 2019-02-24 18:55:21 -08:00
Pieter Wuille 880ce7d46b Call RewindBlockIndex without cs_main held 2019-02-24 18:55:21 -08:00
Pieter Wuille 436f7d735f Release cs_main during RewindBlockIndex operation 2019-02-24 18:55:17 -08:00
Pieter Wuille 1d342875c2 Merge the disconnection and erasing loops in RewindBlockIndex 2019-02-24 18:41:13 -08:00
Pieter Wuille 32b2696ab4 Move erasure of non-active blocks to a separate loop in RewindBlockIndex
This lets us simplify the iteration to just walking back in the chain,
rather than looping over all of mapBlockIndex.
2019-02-24 12:45:48 -08:00
Pieter Wuille 9d6dcc52c6 Abstract EraseBlockData out of RewindBlockIndex
Note that the former 'else' branch in RewindBlockIndex is now
dealt with more naturally inside the EraseBlockData call (by
checking whether the parent needs to be re-added as candidate
after deleting a child).
2019-02-24 12:38:23 -08:00
Chun Kuan Lee 6ad79cbd56 wallet: Use fsbridge::ifstream to fix Windows path issue 2019-02-23 23:44:28 +08:00
João Barbosa a720a98301 gui: Fix async open wallet call order 2019-02-23 09:29:59 +00:00
Jim Posen 04cca33094 Style cleanup. 2019-02-22 17:38:45 -08:00
Jim Posen 4c01e4e159 flatfile: Unit tests for FlatFileSeq methods. 2019-02-22 17:38:45 -08:00
Jim Posen 65a489e93d scripted-diff: Rename CBlockDiskPos to FlatFilePos.
-BEGIN VERIFY SCRIPT-
sed -i 's/CDiskBlockPos/FlatFilePos/g' $(git ls-files 'src/*.h' 'src/*.cpp')
-END VERIFY SCRIPT-
2019-02-22 17:38:45 -08:00
Jim Posen d6d8a78f26 Move CDiskBlockPos from chain to flatfile. 2019-02-22 17:38:45 -08:00
Jim Posen e0380933e3 validation: Refactor file flush logic into FlatFileSeq. 2019-02-22 17:38:45 -08:00
Jim Posen 992404b31e validation: Refactor block file pre-allocation into FlatFileSeq. 2019-02-22 17:38:45 -08:00
Jim Posen e2d2abb99f validation: Refactor OpenDiskFile into method on FlatFileSeq. 2019-02-22 17:38:45 -08:00
Jim Posen 9183d6ef65 validation: Extract basic block file logic into FlatFileSeq class. 2019-02-22 17:38:45 -08:00
Jim Posen 62e7addb63 util: Move CheckDiskSpace to util. 2019-02-22 17:38:45 -08:00
Russell Yanofsky f7efd87c8f Change brace formatting
Suggested https://github.com/bitcoin/bitcoin/pull/15288#pullrequestreview-197915100
2019-02-22 14:43:02 -05:00
MarcoFalke f3f9c1de19
Merge #15435: rpc: Add missing #include
39e20fc54f Add missing #include. (Daniel Kraft)

Pull request description:

  bd0dbe8763 introduced a dependency of `rpc/util.h` on `RPCErrorCode`, defined in `rpc/protocol.h`.  The latter file is only included from `rpc/util.cpp`, though.  This commit fixes the missing include, by moving the `#include` of `rpc/protocol.h` to `rpc/util.h`.

Tree-SHA512: 75c03cfadb28a309d6deb36feeb0ee6ce0b38e8a1176919bc611ea720feff8c42ec9ed0ac8ab74ba9c531a3b7ec9ccbed0c8692ebdf5f9fc17867b9750a1d9f6
2019-02-22 14:43:02 -05:00
Russell Yanofsky a1df1b48a8 Remove use of IsInitialBlockDownload in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 1106a6fde4 Remove use of uiInterface.LoadWallet in wallet code
This also changes the uiInterface.LoadWallet signal argument type from
shared_ptr<CWallet> to unique_ptr<interfaces::Wallet> because CWallet is an
internal wallet class that shouldn't be used in non-wallet code (and also can't
be passed across process boundaries).

This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 318f41fb2c circular-dependencies: Avoid treating some .h/.cpp files as a unit
This avoids a bogus circular dependency error in the next commit:

interfaces/chain -> interfaces/wallet -> wallet/wallet -> interfaces/chain

Which is incorrect, because interfaces/chain.cpp depends only on the
interfaces/wallet.h file, not the interfaces/wallet.cpp file, and it is
wrong to treat these as a unit. Inside the interfaces directory, .h files
contain abstract class definitions and .cpp files contain implementations of
those classes, so you don't need to link against .cpp files if you're only
using the abstract class definition in the .h file.

An alternative fix might be to rename all the cpp files in the interfaces
directory like: chain.cpp->chain_impl.cpp, node.cpp->node_impl.cpp. But just
getting the linter to treat these files as independent dependencies seemed
like it would allow keeping code organization straightforward and avoiding
the need to rename things.
2019-02-22 15:43:02 -04:00
Russell Yanofsky d02b34c8a8 Remove use of AcceptToMemoryPool in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky e2c8ba9f6e Remove uses of InitMessage/Warning/Error in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky c5e59a96a8 Remove uses of GetAdjustedTime in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 6d6bcc77c0 Remove use of g_connman / PushInventory in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 00dfb2a440 Remove uses of g_connman in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky cc3836e8f9 Remove uses of fPruneMode in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky cc02c796d3 Remove uses of fee globals in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 1fb0a4a04e Remove use of CalculateMemPoolAncestors in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky cd32160af0 Remove use of GetTransactionAncestry in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 291276f7f4 Remove use of GetCountWithDescendants in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky bdc6628683 Remove use of IsRBFOptIn in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 80f52a2267 Remove uses of CheckFinalTx in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
João Barbosa 28c86de3b1 gui: Drop unused return values in WalletFrame 2019-02-22 16:26:09 +00:00
MarcoFalke 169dced9a4
Merge #15408: Remove unused TransactionError constants
fa9b60c842 Remove unused TransactionError constants (MarcoFalke)

Pull request description:

  Fixup to #14978, which introduced a bunch of unused enum values, such as `UNKNOWN_ERROR`, `ERROR_COUNT` and `TRANSACTION_ERR_LAST`. None of those have a meaning in the context of an `enum class`, where the compiler can infer if all cases have been covered in a switch-case.

  Also, move the global `::maxTxFee` back to the rpc caller, so it can be set on a per call basis (in the future).

Tree-SHA512: 7f1e2d795f1c1278ecd54ddab2b92c2a862f3c637b482d1d008208925befa1c9dd4b3c4bb1bfcbc5ca4b66a41004aaf01ea96ea95236f944250b8a6cf99ff173
2019-02-22 11:13:43 -05:00