Commit Graph

9312 Commits

Author SHA1 Message Date
Wladimir J. van der Laan 625488ace5 util: Work around (virtual) memory exhaustion on 32-bit w/ glibc
glibc-specific: On 32-bit systems set the number of arenas to 1. By
default, since glibc 2.10, the C library will create up to two heap
arenas per core. This is known to cause excessive virtual address space
usage in our usage. Work around it by setting the maximum number of
arenas to 1.
2017-03-30 09:45:41 +02:00
Pieter Wuille 4fd2d2fc97 Add a FastRandomContext::randrange and use it 2017-03-29 11:26:08 -07:00
Pieter Wuille 16329224e7 Switch FastRandomContext to ChaCha20 2017-03-29 11:26:08 -07:00
Suhas Daftuar 011124a2b2 Update benchmarking with package statistics 2017-03-29 13:57:52 -04:00
Suhas Daftuar 42cd8c890f Add benchmarking for CreateNewBlock 2017-03-29 13:57:52 -04:00
Suhas Daftuar eed816af6c Mining: return early when block is almost full 2017-03-29 13:57:52 -04:00
Wladimir J. van der Laan f34cdcbd80
Merge #9294: Use internal HD chain for change outputs (hd split)
4115af7 Fix rebase issue where pwalletMain was used instead of pwallet Ser./Deser. nInternalChainCounter as last element (Jonas Schnelli)
9382f04 Do not break backward compatibility during wallet encryption (Jonas Schnelli)
1df08d1 Add assertion for CanSupportFeature(FEATURE_HD_SPLIT) (Jonas Schnelli)
cd468d0 Define CWallet::DeriveNewChildKey() as private (Jonas Schnelli)
ed79e4f Optimize GetOldestKeyPoolTime(), return as soon as we have both oldest keys (Jonas Schnelli)
771a304 Make sure we set the wallets min version to FEATURE_HD_SPLIT at the very first point (Jonas Schnelli)
1b3b5c6 Slightly modify fundrawtransaction.py test (change getnewaddress() into getrawchangeaddress()) (Jonas Schnelli)
003e197 Remove FEATURE_HD_SPLIT bump TODO (Jonas Schnelli)
d9638e5 Overhaul the internal/external key derive switch (Jonas Schnelli)
1090502 Fix superfluous cast and code style nits in RPC wallet-hd.py test (Jonas Schnelli)
58e1483 CKeyPool avoid "catch (...)" in SerializationOp (Jonas Schnelli)
e138876 Only show keypoolsize_hd_internal if HD split is enabled (Jonas Schnelli)
add38d9 GetOldestKeyPoolTime: if HD & HD Chain Split is enabled, response max(oldest-internal-key, oldest-external-key) (Jonas Schnelli)
dd526c2 Don't switch to HD-chain-split during wallet encryption of non HD-chain-split wallets (Jonas Schnelli)
79df9df Switch to 100% for the HD internal keypool size (Jonas Schnelli)
bcafca1 Make sure we always generate one keypool key at minimum (Jonas Schnelli)
d0a627a Fix issue where CDataStream->nVersion was taken a CKeyPool record version (Jonas Schnelli)
9af8f00 Make sure we hand out keypool keys if HD_SPLIT is not enabled (Jonas Schnelli)
469a47b Make sure ReserveKeyFromKeyPool only hands out internal keys if HD_SPLIT is supported (Jonas Schnelli)
05a9b49 Fix wrong keypool internal size in RPC getwalletinfo help (Jonas Schnelli)
01de822 Removed redundant IsLocked() check in NewKeyPool() (Jonas Schnelli)
d59531d Immediately return setKeyPool's size if HD or HD_SPLIT is disabled or not supported (Jonas Schnelli)
02592f4 [Wallet] split the keypool in an internal and external part (Jonas Schnelli)

Tree-SHA512: 80d355d5e844b48c3163b56c788ab8b5b5285db0ceeb19858a3ef517d5a702afeca21dbae526d7b8fb4101c2a745af1d92bf557c40cf516780f17992bf678c1a
2017-03-29 12:51:06 +02:00
Wladimir J. van der Laan 9692be4a9a
Merge #10084: rpc: Rename first named arg of createrawtransaction
fa55853 rpc: Rename first named arg of createrawtransaction (MarcoFalke)

Tree-SHA512: f2e07183f2503344e676e08fe0fd73e995d7c6fda3fc11c64116208dec8e445f0627583dfba85014129b6f2dc7e253b9d760e57e66811272db89e9ba25ce6dbc
2017-03-29 10:44:47 +02:00
Wladimir J. van der Laan f885b67029 refactor: Make rest.cpp dependency on `*toJSON` in `blockchain.cpp` explicit 2017-03-29 09:56:47 +02:00
Pieter Wuille e04326fe66 Add ChaCha20 2017-03-29 00:40:17 -07:00
Pieter Wuille 663fbae777 FastRandom benchmark 2017-03-29 00:40:17 -07:00
Pieter Wuille c21cbe61c6 Introduce FastRandomContext::randbool() 2017-03-29 00:40:17 -07:00
Pieter Wuille 4bd0e9b90a
Merge #10088: Trivial: move several relay options into the relay help group
0fb2887 Move several relay options into the Relay help group (Jameson Lopp)

Tree-SHA512: 31fdfd8c741adb6fe6806a28955f0fbbc9360b1d8c3d8a28684794822f1b3231fffab93357357d986b81a4532c9eeabb79e5ede9378ff3ad8930ceb6588d9eb6
2017-03-29 00:31:34 -07:00
Pieter Wuille 7438ceac71
Merge #10086: Trivial: move rpcserialversion into RPC option group
1403b1a move rpcserialversion into RPC option group (Jameson Lopp)

Tree-SHA512: c56cc318ea09ac27a8e12b8b9a1006992dcb969e6112df5046975b548aad30f729a4204f4893c8fe9bf5b50442eba6c75b5f8dd6d1261cf83c938474e93e9a7e
2017-03-29 00:28:51 -07:00
Thomas Snider 6d5dd60c88 No need to use OpenSSL malloc/free 2017-03-28 17:36:31 -07:00
Ryan Havar 53351321c4 ApproximateBestSubset should take inputs by reference, not value 2017-03-28 12:11:44 -06:00
Jonas Schnelli 4115af7ac7
Fix rebase issue where pwalletMain was used instead of pwallet
Ser./Deser. nInternalChainCounter as last element
2017-03-28 09:18:20 +02:00
Russell Yanofsky e9a64615c8 Make qt wallet test compatible with qt4
Unlike Qt5, the Qt4 signals implementation doesn't allow a signal to be
directly connected to a c++ lambda expression. Work around this by defining a
Callback QObject with a virtual method that can forward calls to a closure.

The Qt4 error was reported by Patrick Strateman <patrick.strateman@gmail.com>
in https://github.com/bitcoin/bitcoin/pull/10039#issuecomment-289248763
2017-03-27 14:34:38 -04:00
Wladimir J. van der Laan 8d8f28dd52 refactor: Move RPCNotifyBlockChange out of `rpc/server.h` 2017-03-27 16:23:22 +02:00
Wladimir J. van der Laan e6dcfeec05 refactor: Move GetDifficulty out of `rpc/server.h`
It has no business in `rpcserver.h`. Define it in the interface header
of the implementation unit `rpcblockchain` where it is defined.

Also modernize the signature to:

    double GetDifficulty(const CBlockIndex* blockindex = nullptr);

(remove `extern`, replace `NULL` with `nullptr`)
2017-03-27 12:21:35 +02:00
Wladimir J. van der Laan 5114f81136
Merge #10057: [init] Deduplicated sigaction() boilerplate
81a3857 Deduplicated sigaction() boilerplate (Thomas Snider)

Tree-SHA512: 705b73f285a3d76504ba01476e072fdce67731b65f309bb04e4bbd765556c37e127cb769b475de2d68b33f50d7737fb136aefa0fa7c725a11ad16a47b9d0365f
2017-03-27 10:36:57 +02:00
Wladimir J. van der Laan e6156a0aa3
Merge #10056: [zmq] Call va_end() on va_start()ed args.
5ba61f0 [zmq] Call va_end() on va_start()ed args. (Karl-Johan Alm)

Tree-SHA512: fbd3a0c29308ca9607f362f14fa7ea9c949a3f25dc09a349fe3b3ffd316b573c86778e29d3b9d55c684571eacae50aca90bb872e2e5489818d0af8310511fe79
2017-03-27 10:34:18 +02:00
Jonas Schnelli 7278537730
[Qt] Don't add arguments of sensitive command to console window 2017-03-27 10:25:52 +02:00
Jonas Schnelli 0ddea4430d
Merge #10060: [Qt] Ensure an item exists on the rpcconsole stack before adding
4df76e2 Ensure an item exists on the rpcconsole stack before adding (Andrew Chow)

Tree-SHA512: f3fd5e70da186949aff794f6e2ba122da2145331212dcc5e0595285bee9dc3aa6b400b15e8eeec4476099965b74f46c4ef80f8ed1e05d490580167b002b9a5e7
2017-03-27 09:55:17 +02:00
Jonas Schnelli 9382f0425e
Do not break backward compatibility during wallet encryption 2017-03-27 09:51:55 +02:00
Jameson Lopp 0fb288725b Move several relay options into the Relay help group 2017-03-26 15:02:26 -04:00
Jameson Lopp 1403b1a689 move rpcserialversion into RPC option group 2017-03-26 10:25:17 -04:00
Jameson Lopp d5690f1ab8 remove 'noconnect' option from documentation 2017-03-26 09:13:20 -04:00
MarcoFalke fa55853219 rpc: Rename first named arg of createrawtransaction 2017-03-26 12:08:44 +02:00
Wladimir J. van der Laan 90dd9e6c4c
Merge #9946: Fix build errors if spaces in path or parent directory
b1f584d fix build if spaces in src dir path (Matthew Zipkin)

Tree-SHA512: 5834690c1f63b85ed04bb8ed411a94da04738534364d58bd9ee333ccff7129b2bbb710f31598c40123199e023da02c1745514294af3efdbb2c2e4c1320aded35
2017-03-25 12:15:06 +01:00
Wladimir J. van der Laan 5d7eb39aec
Merge #10067: [trivial] Dead code removal
c59aedc [trivial] Dead code removal (Thomas Snider)

Tree-SHA512: 09962c1ae36fb2f19b7e4a03abf3de6632bab984ce30040ca3f843431df33a0f8fa6a2c1d55b076b800547bb656e344d74ea085ff081b613bcdfd7d2f9826374
2017-03-25 09:10:03 +01:00
Andrew Chow 4df76e270c Ensure an item exists on the rpcconsole stack before adding
Ensures that there is an item on the rpcconsole stack before adding something to the current stack so that a segmentation fault does not occur.
2017-03-24 21:41:34 -04:00
Matthew Zipkin b1f584dbc1 fix build if spaces in src dir path 2017-03-24 18:22:34 -07:00
Thomas Snider 81a3857c4e Deduplicated sigaction() boilerplate 2017-03-24 10:32:56 -07:00
Jonas Schnelli 1df08d1580
Add assertion for CanSupportFeature(FEATURE_HD_SPLIT) 2017-03-24 10:57:55 +01:00
Jonas Schnelli cd468d07d5
Define CWallet::DeriveNewChildKey() as private 2017-03-24 10:57:31 +01:00
Jonas Schnelli ed79e4f497
Optimize GetOldestKeyPoolTime(), return as soon as we have both oldest keys 2017-03-24 10:54:48 +01:00
Jonas Schnelli 771a304ffe
Make sure we set the wallets min version to FEATURE_HD_SPLIT at the very first point 2017-03-24 10:53:35 +01:00
Jonas Schnelli 003e197498
Remove FEATURE_HD_SPLIT bump TODO 2017-03-24 10:28:40 +01:00
Jonas Schnelli d9638e5aa4
Overhaul the internal/external key derive switch 2017-03-24 10:28:40 +01:00
Jonas Schnelli 1090502c3e
Fix superfluous cast and code style nits in RPC wallet-hd.py test 2017-03-24 10:28:40 +01:00
Jonas Schnelli 58e148333e
CKeyPool avoid "catch (...)" in SerializationOp 2017-03-24 10:28:40 +01:00
Jonas Schnelli e138876f0a
Only show keypoolsize_hd_internal if HD split is enabled 2017-03-24 10:28:40 +01:00
Jonas Schnelli add38d9b83
GetOldestKeyPoolTime: if HD & HD Chain Split is enabled, response max(oldest-internal-key, oldest-external-key) 2017-03-24 10:28:39 +01:00
Jonas Schnelli dd526c2a2d
Don't switch to HD-chain-split during wallet encryption of non HD-chain-split wallets 2017-03-24 10:28:39 +01:00
Jonas Schnelli 79df9df348
Switch to 100% for the HD internal keypool size 2017-03-24 10:28:39 +01:00
Jonas Schnelli bcafca1077
Make sure we always generate one keypool key at minimum 2017-03-24 10:28:39 +01:00
Jonas Schnelli d0a627a53a
Fix issue where CDataStream->nVersion was taken a CKeyPool record version 2017-03-24 10:28:39 +01:00
Jonas Schnelli 9af8f00a75
Make sure we hand out keypool keys if HD_SPLIT is not enabled 2017-03-24 10:28:38 +01:00
Jonas Schnelli 469a47b760
Make sure ReserveKeyFromKeyPool only hands out internal keys if HD_SPLIT is supported 2017-03-24 10:28:38 +01:00
Jonas Schnelli 05a9b493eb
Fix wrong keypool internal size in RPC getwalletinfo help 2017-03-24 10:28:38 +01:00
Jonas Schnelli 01de822c8d
Removed redundant IsLocked() check in NewKeyPool() 2017-03-24 10:28:38 +01:00
Jonas Schnelli d59531ddfc
Immediately return setKeyPool's size if HD or HD_SPLIT is disabled or not supported 2017-03-24 10:28:37 +01:00
Jonas Schnelli 02592f4c5e
[Wallet] split the keypool in an internal and external part 2017-03-24 10:28:37 +01:00
Thomas Snider c59aedc1b0 [trivial] Dead code removal 2017-03-23 15:08:54 -07:00
Eric Shaw Jr 9ab9e7d1b3 Add a button to open the config file in a text editor 2017-03-23 12:54:36 -04:00
Jonas Schnelli 3568b30ca3
Merge #9500: [Qt][RPC] Autocomplete commands for 'help' command in debug console
6d8fe35 'help' rpc commands autocomplete (Andrew Chow)

Tree-SHA512: 289bc4fa16a1c0291262998caa18556f1c5aa89662c85528606dc03b596b8833a0fb2c5c9c068b6dcf2adb3a136d4f154591d4a95b8c3313638b77355aaed955
2017-03-23 08:27:16 +01:00
Jonas Schnelli 7b585cf70e
Merge #9558: Clarify assumptions made about when BlockCheck is called
c4a6929 Clarify assumptions made about when BlockCheck is called (Matt Corallo)

Tree-SHA512: 2eceb0c4f06c7fd6b290b93843bda11a4b63131559c5e8226bfec84596ed4e54ee6d8f5bc9cf789a80675be8b8079cf9234c96032df306258cb2260b9d8c7825
2017-03-23 08:18:43 +01:00
Jonas Schnelli 86f7d5b69b
Merge #10029: Fix parameter naming inconsistencies between .h and .cpp files
97b8213 Fix parameter naming inconsistencies between .h and .cpp files (practicalswift)

Tree-SHA512: 4f46cc3973a898d2478bdb1b8c8d1829c3a7298b63bc47359c5dc2f135466773072d9672134ef3e7557dfc913720e49b675176b9e435b8bd1992af9ad53866e4
2017-03-23 08:16:27 +01:00
Karl-Johan Alm 5ba61f0034
[zmq] Call va_end() on va_start()ed args. 2017-03-22 12:56:44 -07:00
Jonas Schnelli 90586b6897
Merge #10045: [trivial] Fix typos in comments
dbf30ff [trivial] Fix typos in comments (practicalswift)

Tree-SHA512: a841c96ba1a80ab57206e8ef4fa9b40ecff2244075a5539fc09f57e763bf2e92b0ed089e32a0dbac3902518dcda43d224f75a3462a560148841746560640ba70
2017-03-22 08:38:24 +01:00
practicalswift dbf30ff10f [trivial] Fix typos in comments 2017-03-21 19:49:08 +01:00
Wladimir J. van der Laan 919aaf6508
Merge #10039: Fix compile errors with Qt 5.3.2 and Boost 1.55.0
b5bec4e Avoid QTimer::singleShot compile error with Qt 5.3.2 (Russell Yanofsky)
d5046e7 Avoid scoped_connection compile error with boost 1.55.0 (Russell Yanofsky)

Tree-SHA512: 96362b872817681b062e05c8fcb76cfc23b6e87e0371584a6aae0e17535fd34ccdba922380aa4b669a8e75ef3f9fadd25061541f77cb3198173f04249a7bcd62
2017-03-21 11:46:55 +01:00
Russell Yanofsky b5bec4e330 Avoid QTimer::singleShot compile error with Qt 5.3.2
Construct QTimer object directly, instead of relying on QTimer::singleShot
overloads accepting lambdas, which weren't introduced until Qt 5.4.

Avoids the following compile error in debian jessie:

```
qt/test/wallettests.cpp: In function ‘void {anonymous}::ConfirmSend()’:
qt/test/wallettests.cpp:34:6: error: no matching function for call to ‘QTimer::singleShot(int, Qt::TimerType, {anonymous}::ConfirmSend()::<lambda()>)’
     });
      ^
qt/test/wallettests.cpp:34:6: note: candidates are:
In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/QTimer:1:0,
                 from ./qt/sendcoinsdialog.h:13,
                 from qt/test/wallettests.cpp:7:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:81:17: note: static void QTimer::singleShot(int, const QObject*, const char*)
     static void singleShot(int msec, const QObject *receiver, const char *member);
                 ^
/usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:81:17: note:   no known conversion for argument 2 from ‘Qt::TimerType’ to ‘const QObject*’
/usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:82:17: note: static void QTimer::singleShot(int, Qt::TimerType, const QObject*, const char*)
     static void singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member);
                 ^
/usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:82:17: note:   candidate expects 4 arguments, 3 provided
```

Error reported by Pavel Janík <Pavel@Janik.cz> in
https://github.com/bitcoin/bitcoin/pull/9974#issuecomment-287574436
2017-03-20 12:35:37 -04:00
Russell Yanofsky d5046e72f4 Avoid scoped_connection compile error with boost 1.55.0
Construct scoped_connection directly instead of relying on copy initialization
and move constructor. Avoids the following compile error in debian jessie:

```
In file included from /usr/include/boost/signals2/signal.hpp:21:0,
                 from ./util.h:29,
                 from ./dbwrapper.h:11,
                 from ./txdb.h:10,
                 from ./test/test_bitcoin.h:11,
                 from qt/test/wallettests.cpp:11:
/usr/include/boost/signals2/connection.hpp: In function ‘uint256 {anonymous}::SendCoins(CWallet&, SendCoinsDialog&, const CBitcoinAddress&, CAmount)’:
/usr/include/boost/signals2/connection.hpp:234:7: error: ‘boost::signals2::scoped_connection::scoped_connection(const boost::signals2::scoped_connection&)’ is private
       scoped_connection(const scoped_connection &other);
       ^
qt/test/wallettests.cpp:47:6: error: within this context
     });
      ^
```

Error reported by Pavel Janík <Pavel@Janik.cz> in
https://github.com/bitcoin/bitcoin/pull/9974#issuecomment-287550034
2017-03-20 12:27:07 -04:00
John Newbery 63d66ba20a Move src/test/bitcoin-util-test.py to test/util/bitcoin-util-test.py 2017-03-20 10:40:31 -04:00
Wladimir J. van der Laan d34995a7ba
Merge #10038: Add mallocinfo mode to `getmemoryinfo` RPC
e141aa4 Add mallocinfo mode to `getmemoryinfo` RPC (Wladimir J. van der Laan)

Tree-SHA512: e778631765c29b3b5fb94eb66e5f50a8f108a234891bdcc4883f1e6e2fdd223f7660fad987eb2d7cbda5b800482d78adc1a309a3f6f83a84c556af43ebee2ed7
2017-03-20 15:05:56 +01:00
Wladimir J. van der Laan e141aa4ba6 Add mallocinfo mode to `getmemoryinfo` RPC
This adds a mode argument to `getmemoryinfo`. By default the output
will remain the same. However if a mode argument of `mallocinfo` is
provided the result of glibc `malloc_info` (if available) will
be returned as a string, as-is.

This is useful for tracking heap usage over time or troubleshooting
memory fragmentation issues.
2017-03-20 10:30:18 +01:00
James Evans 05a9f22358 Trivial: Fix typo in help getrawtransaction RPC 2017-03-20 05:19:41 -03:00
Wladimir J. van der Laan 5c1a958124
Merge #10027: Set to nullptr after delete
d93b97f Set to nullptr after delete (practicalswift)

Tree-SHA512: 7201cef4541557ffe31f52ce7527c4b08a2ff5aa1eae5268bdfee5b4843881f8fd115257bef6d1b4dfb71166951950a912ce87aef160ca89c2ca2ae264cfab1b
2017-03-20 08:39:18 +01:00
practicalswift 97b8213674 Fix parameter naming inconsistencies between .h and .cpp files
Inconsistencies prior to this commit:

* serializeFlags vs serialFlags
src/core_io.h:std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags = 0);
src/core_write.cpp:std::string EncodeHexTx(const CTransaction& tx, const int serialFlags)

* statusOut vs outStatus
src/rpc/server.h:bool RPCIsInWarmup(std::string *statusOut);
src/rpc/server.cpp:bool RPCIsInWarmup(std::string *outStatus)

* hashesToUpdate vs vHashesToUpdate
src/txmempool.h:    void UpdateTransactionsFromBlock(const std::vector<uint256> &hashesToUpdate);
src/txmempool.cpp:void CTxMemPool::UpdateTransactionsFromBlock(const std::vector<uint256> &vHashesToUpdate)

* nPruneUpToHeight vs nManualPruneHeight
src/validation.h:void PruneBlockFilesManual(int nPruneUpToHeight);
src/validation.cpp:void PruneBlockFilesManual(int nManualPruneHeight);
2017-03-19 16:14:29 +01:00
Michael Goldstein f490dae56b Trivial: Fix typo in key.h comment 2017-03-18 18:13:55 -07:00
practicalswift d93b97fbcf Set to nullptr after delete 2017-03-18 12:40:58 +01:00
Wladimir J. van der Laan baae3149d6
Merge #9911: Wshadow: various gcc fixes
d7f80b6 Rename first iterator to prevent shadowing. (Pavel Janík)
b42ff60 Fix shadowing of local variables. (Pavel Janík)
c4b60b3 Make some global variables less-global (static) (Pavel Janík)
bb2aaee Prevent -Wshadow warnings with gcc versions 4.8.5, 5.3.1 and 6.2.1. (Pavel Janík)

Tree-SHA512: 3aea4e28146c8f2a31351c6e2b0cce88b6f1e567a0ea0e6131624453e7193d0904e30d81b1439d8c69e281cf0e369b895851fb882ae48d5967b5c2e2c227404e
2017-03-18 11:00:16 +01:00
Wladimir J. van der Laan a328904480
Merge #9999: [LevelDB] Plug leveldb logs to bitcoin logs
cfce581 [LevelDB] Plug leveldb logs to bitcoin logs (NicolasDorier)

Tree-SHA512: e40a2c2644c269bb2da7be04aec39ff64ad350d508391750a757955ed3f9d96998775d01e04b282a75b36d776c3960a345cc7b6f1466e6ae167d27518bf4baee
2017-03-18 10:58:22 +01:00
Wladimir J. van der Laan aab1e55860
Merge #9987: Remove unused code
8dc957a Remove unused code (practicalswift)

Tree-SHA512: c7bb286e3b92e42fec8aa1ac2491fd38be36602efca16b4bdc4e9d5ada75c11d99e7713092ec13794abd69d5ef2c732b86209a6d01710e5ebf6fc51b8a65c92a
2017-03-18 10:10:33 +01:00
Pavel Janík d7f80b6dcb Rename first iterator to prevent shadowing. 2017-03-18 07:59:51 +01:00
Pavel Janík b42ff60c7e Fix shadowing of local variables. 2017-03-18 07:59:50 +01:00
Pavel Janík c4b60b3d9c Make some global variables less-global (static) 2017-03-18 07:59:50 +01:00
Pavel Janík bb2aaeeeea Prevent -Wshadow warnings with gcc versions 4.8.5, 5.3.1 and 6.2.1. 2017-03-18 07:59:50 +01:00
Wladimir J. van der Laan 3d857f307b
Merge #9818: Save watch only key timestamps when reimporting keys
7759aa2 Save watch only key timestamps when reimporting keys (Russell Yanofsky)

Tree-SHA512: 433b5a78e5626fb2f3166e6c84c22eabd5239d451dc82694da95af237e034612a24f1a8bc959b7d2f2e576ce0b679be1fa4af929ebfae758c7e832056ab67061
2017-03-17 21:52:14 +01:00
Jonas Schnelli 9c7b7cf0bb
Merge #9592: [Qt] Add checkbox in the GUI to opt-in to RBF when creating a transaction
c4e4792 [Qt] Change RBF checkbox to reflect -walletrbf setting (Russell Yanofsky)
838a58e [Qt] Add simple optin-RBF checkbox and confirmation info (Jonas Schnelli)
568c05a Allow to opt-into RBF when creating a transaction (Jonas Schnelli)

Tree-SHA512: 3d52dcd4e44da8aed4d631748074afef78d38c860f2a8b95323f4801a989d6599a3498a753fc10daba4098c527ef5a0eb942e5b3f1bfd656e1a6bd272b8e6c57
2017-03-17 15:31:52 +01:00
Jonas Schnelli a387d3a807
Merge #9690: Change 'Clear' button string to 'Reset'
9155241 Change 'Clear' button string to 'Reset' (Daniel Aleksandersen)

Tree-SHA512: 9d68aaaeef88f174b29bffced81f3b2cb6a76f7a2dd8c43df4d9bd5d29cdbcf073c1f250c6bdfad12540976b1bb27a764e5033d219a1491f27f4d89ddd06e49b
2017-03-17 14:45:03 +01:00
Jonas Schnelli b9f930b383
Merge #9974: Add basic Qt wallet test
9576b01 Enable xvfb in travis to allow running test_bitcoin-qt (Russell Yanofsky)
9e6817e Add new test_bitcoin-qt static library dependencies (Russell Yanofsky)
2754ef1 Add simple qt wallet test sending a transaction (Russell Yanofsky)
b61b34c Add braces to if statements in Qt test_main (Russell Yanofsky)
cc9503c Make qt test compatible with TestChain100Setup framework (Russell Yanofsky)
91e3035 Make test_bitcoin.cpp compatible with Qt Test framework (Russell Yanofsky)

Tree-SHA512: da491181848b8c39138e997ae5ff2df0b16eef2d9cdd0a965229b1a28d4fa862d5f1ef314a1736e5050e88858f329124d15c689659fc6e50fefde769ba24e523
2017-03-17 14:31:22 +01:00
practicalswift 8dc957ae06 Remove unused code 2017-03-17 04:37:43 +01:00
Pavol Rusnak 9350e13396
util: rename variable to avoid shadowing 2017-03-16 17:33:58 +01:00
Wladimir J. van der Laan 8b789d8141
Merge #9921: build: Probe MSG_DONTWAIT in the same way as MSG_NOSIGNAL
a4d1c9f compat: use `unsigned int` instead of `u_int` (Wladimir J. van der Laan)
25da1ee build: cleanup: define MSG_DONTWAIT/MSG_NO_SIGNAL locally (Wladimir J. van der Laan)
c459d50 build: Probe MSG_DONTWAIT in the same way as MSG_NOSIGNAL (Wladimir J. van der Laan)

Tree-SHA512: 60d79d69439bb181465e4244aa5ddc28bbd84f69c0ca0c753956b3798c9022394e29d791bc085fe7ffb1268c64c789a57e24797daad63525bb776088188ff9ae
2017-03-16 12:03:00 +01:00
MarcoFalke c49355c717
Merge #9993: Initialize nRelockTime
fb6f90a Initialize nRelockTime (Patrick Strateman)

Tree-SHA512: 82675ab4b05d5f3ea08a99e85d3f49d18068887d23cbacb5e899ad66799049c5f1d5bd33768dbe153116424c9f0caddaa3622000924e373aa01ac2a54b5f3577
2017-03-16 11:44:32 +01:00
practicalswift a3ca43bb32 [trivial] Fix a typo (introduced two days ago) in the default fee warning 2017-03-16 09:05:30 +01:00
NicolasDorier cfce581d11 [LevelDB] Plug leveldb logs to bitcoin logs 2017-03-16 02:14:27 +00:00
Russell Yanofsky 9e6817ed11 Add new test_bitcoin-qt static library dependencies
Avoids following error when qt is statically linked into the test binary, as on
travis:

This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".
2017-03-15 13:02:02 -04:00
Russell Yanofsky 2754ef1c4a Add simple qt wallet test sending a transaction 2017-03-15 12:02:02 -05:00
Russell Yanofsky b61b34c89d Add braces to if statements in Qt test_main 2017-03-15 13:02:02 -04:00
Patrick Strateman fb6f90a4ce Initialize nRelockTime 2017-03-14 15:48:08 -07:00
Wladimir J. van der Laan ce01e6226c
Merge #9481: [Qt] Show more significant warning if we fall back to the default fee
7abe7bb Qt/Send: Give fallback fee a reasonable indent (Luke Dashjr)
3e4d7bf Qt/Send: Figure a decent warning colour from theme (Luke Dashjr)
c5adf8f [Qt] Show more significant warning if we fall back to the default fee (Jonas Schnelli)

Tree-SHA512: 9e85b5b398d7a49aaf6c42578d63750b1b7aa9cc9e84d008fe21d6c53f1ffe2fb69286a1a764e634ebca3286564615578eea0a1bc883e4b332be8306d9883d14
2017-03-14 13:06:44 +01:00
Wladimir J. van der Laan 416809c11b
Merge #9955: Don't require segwit in getblocktemplate for segwit signalling or mining
c85ffe6 Test transaction selection when gbt called without segwit support (Suhas Daftuar)
abe7b3d Don't require segwit in getblocktemplate for segwit signalling or mining (Suhas Daftuar)

Tree-SHA512: 172496b6d7cdf1879de1266748f2b4ed9fd2ba9ff4a1fd964d74d73c674c16d74bf01a3ba42bf25f2d69f348217c0bbf3412ac64821f222efc9de25a287a5240
2017-03-14 12:55:52 +01:00
Wladimir J. van der Laan 2c781fb920
Merge #9497: CCheckQueue Unit Tests
96c7f2c Add CheckQueue Tests (Jeremy Rubin)
e207342 Fix CCheckQueue IsIdle (potential) race condition and remove dangerous constructors. (Jeremy Rubin)

Tree-SHA512: 5989743ad0f8b08998335e7ca9256e168fa319053f91b9dece9dbb134885bef7753b567b591acc7135785f23d19799ed7e6375917f59fe0178d389e961633d62
2017-03-14 12:23:41 +01:00
Suhas Daftuar abe7b3d3ab Don't require segwit in getblocktemplate for segwit signalling or mining
Segwit's version bit will be signalled for all invocations of CreateNewBlock,
and not specifying segwit only will cause CreateNewBlock to skip transactions
with witness from being selected.
2017-03-14 06:43:37 -04:00
Wladimir J. van der Laan 67ed40ed82
Merge #9505: Prevector Quick Destruct
45a5aaf Only call clear on prevector if it isn't trivially destructible and don't loop in clear (Jeremy Rubin)
aaa02e7 Add prevector destructor benchmark (Jeremy Rubin)

Tree-SHA512: 52bc8163b65b71310252f2d578349d0ddc364a6c23795c5e06e101f5449f04c96cbdca41c0cffb1974b984b8e33006471137d92b8dd4a81a98e922610a94132a
2017-03-14 10:43:10 +01:00
Wladimir J. van der Laan 1b046603b3
Merge #8665: Assert all the things!
4d51e9b Assert ConnectBlock block and pIndex are the same block (NicolasDorier)
972714c pow: GetNextWorkRequired never called with NULL pindexLast (Daniel Cousens)
cc44c8f ContextualCheckBlockHeader should never have pindexPrev to NULL (NicolasDorier)

Tree-SHA512: 7cc568bf9417267c335f21ec3d1505b26e56e5b3d5f4d3dbb555279489800aaa65a3bcd7bc376e274dd102912aec16ddbb18de2e2060b2667b41eb979cd9321e
2017-03-14 10:38:27 +01:00
Wladimir J. van der Laan 8040ae6fc5
Merge #9963: util: Properly handle errors during log message formatting
b651270 util: Throw tinyformat::format_error on formatting error (Wladimir J. van der Laan)
3b092bd util: Properly handle errors during log message formatting (Wladimir J. van der Laan)

Tree-SHA512: 85e3b7afec2255fc88034187f1abd6060e9421de17ed4e3d918416f393429a99cc2c974b362099aaaff6970549df47664bea4c857c4e46acc0789663201dc541
2017-03-13 14:43:19 +01:00
Wladimir J. van der Laan afcd7c0e52
Merge #9830: Add safe flag to listunspent result
dcf2112 Add safe flag to listunspent result (NicolasDorier)
af61d9f Add COutput::fSafe member for safe handling of unconfirmed outputs (Russell Yanofsky)

Tree-SHA512: 311edb6fa8075b3ede5b24cb8c6e5d133ccd8ac9ecafea07b604ffa812ee4f071337e31695e662d8573590a0460af20aaaeb39d49c9ea87924449ea50bdfb0b3
2017-03-13 07:01:29 +01:00
Wladimir J. van der Laan f8a709161f
Merge #9953: Fix shutdown hang with >= 8 -addnodes set
819b513 Add missing braces in semaphore posts in net (Matt Corallo)
e007b24 Fix shutdown hang with >= 8 -addnodes set (Matt Corallo)

Tree-SHA512: f2d7562bd5d333cd0e80562eb3b1fe329fc10ee713996e053d2ed669db6d9eb39550e0a6c6ab768cd070bfe92a5ea85e0f752470206706de196bd4a689b9bc07
2017-03-13 06:57:24 +01:00
Wladimir J. van der Laan b651270cd6 util: Throw tinyformat::format_error on formatting error
Throw tinyformat::format_error on formatting error instead of the
`std::runtime_error`.
2017-03-13 06:51:15 +01:00
Wladimir J. van der Laan 3b092bd9b6 util: Properly handle errors during log message formatting
Instead of having an exception propagate into the program when an
error happens while formatting a log message, just print a message to
the log.

Addresses #9423.
2017-03-12 07:58:06 +01:00
Russell Yanofsky cc9503cec9 Make qt test compatible with TestChain100Setup framework
Reset global state after rpc tests, and remove unnecessary ECC initialization
to prevent assert error if it is initialized twice.
2017-03-10 15:52:29 -05:00
Russell Yanofsky 91e303595b Make test_bitcoin.cpp compatible with Qt Test framework
Move Boost.Test main function and global overrides to a new test_bitcoin_main.cpp file.
2017-03-10 15:47:41 -05:00
NicolasDorier dcf2112de6 Add safe flag to listunspent result 2017-03-10 05:11:10 +00:00
Russell Yanofsky af61d9f78b Add COutput::fSafe member for safe handling of unconfirmed outputs
This exposes a value computed in CWallet::AvailableCoins so it can used for
other things, like inclusion in listunspent output.
2017-03-10 05:11:10 +00:00
MarcoFalke 5703dff093
Merge #9962: [trivial] Fix typo in rpc/protocol.h
9ea2490 [trival] Fix typo introduced into rpc/protocol.h in commit 338bf06 (practicalswift)

Tree-SHA512: bfa60dc9f40db867b09e60dbe803db79c86ff939048c91e551c0794a91428bde3aa42c4aabf915c640cd15565005608da10dae051942e806fdf5d28e9704d765
2017-03-09 12:32:46 +01:00
Wladimir J. van der Laan e3e7db829e
Merge #9538: [util] Remove redundant call to get() on smart pointer (thread_specific_ptr)
53a2ba3 [util] Remove redundant call to get() on smart pointer (thread_specific_ptr) (practicalswift)

Tree-SHA512: ec8ace4218ae0657d1aaf8ba7682b0cdd140fe0844173058d3cbf4575dee8d9ad5f241e5bacf1e9e4ad3f7dd282f56a8cb0f306de2093f2c0f6333daedd58261
2017-03-09 10:33:28 +01:00
Wladimir J. van der Laan c71f0ca5f8
Merge #9960: Trivial: Add const modifier to GetHDChain and IsHDEnabled
3cef950 Trivial: Add const modifier to GetHDChain and IsHDEnabled (NicolasDorier)

Tree-SHA512: 73126689e179d70e6823950b51aae4da0a1e348436bc72338814f3afeec27868bb479d9e8261f86e4fe851e84492778a30c5f1fe76c9d7dd91796d0e38baeaf0
2017-03-09 10:27:31 +01:00
practicalswift 53a2ba351a [util] Remove redundant call to get() on smart pointer (thread_specific_ptr) 2017-03-09 10:22:35 +01:00
practicalswift 9ea249014a [trival] Fix typo introduced into rpc/protocol.h in commit 338bf06
The typo was introduced in commit 338bf065a4, which was merged yesterday.

Changes summarized to facilitate reviewing:
* exampled → example
2017-03-09 10:16:16 +01:00
Wladimir J. van der Laan b403ec5c0f
Merge #9916: Fix msvc compiler error C4146 (minus operator applied to unsigned type)
8e0720b Fix msvc compiler error C4146 (unary minus operator applied to unsigned type) (kobake)
292112f Fix msvc compiler error C4146 (minus operator applied to unsigned type) (kobake)

Tree-SHA512: 25f408daf7bf9ffe4b8b4bd62f6f6d326219189a9faf8f8c0a135c5a0cb0511af765aa2b6087a091c8863c701289bda49a2379b00cd9b10854d316a5c3fc3f8e
2017-03-09 10:02:55 +01:00
Wladimir J. van der Laan 02bd6e9bc6
Merge #9853: Fix error codes from various RPCs
adaa281 Update release notes to include RPC error code changes. (John Newbery)
338bf06 Add commenting around JSON error codes (John Newbery)
dab804c Return correct error codes in fundrawtransaction(). (John Newbery)
a012087 Return correct error codes in setban(). (John Newbery)
960bc7f Return correct error codes in removeprunedfunds(). (John Newbery)
c119096 Return correct error codes in blockchain.cpp. (John Newbery)
6d07c62 Return correct error codes in bumpfee(). (John Newbery)

Tree-SHA512: 4bb39ad221cd8c83d98ac5d7ad642f3a8c265522720dc86b2eebc70e74439a85b06d6ddcd6a874e879d986511de3ab0878bb7fe58b50cb0546b78913632ea809
2017-03-09 10:02:17 +01:00
Wladimir J. van der Laan 6805c4112c
Merge #9575: Remove unused, non-working RPC PostCommand signal
54fae05 Remove unreachable code (g_rpcSignals.PostCommand) (practicalswift)

Tree-SHA512: b416d63ffa1c35fa0434b6bc0a930ae1b04919a12114ef65154ce4621aa43d744eb4fc515f48eac2e96c0f528cedb4cdbe2349952d215c2c74e900a63e155e0a
2017-03-09 10:01:03 +01:00
practicalswift 54fae05dad Remove unreachable code (g_rpcSignals.PostCommand) 2017-03-09 09:47:04 +01:00
Wladimir J. van der Laan 8152d3fe57
Merge #9476: [refactor] Remove using namespace <xxx> from rpc/ & script/ sources
8cbfc4e Refactor: Remove using namespace <xxx> from script/ (Karl-Johan Alm)
f3c264e Refactor: Remove using namespace <xxx> from rpc/ (Karl-Johan Alm)

Tree-SHA512: 407e80eeda0b8e1df22c5fcba33572e117542fde83c67357f6c2d98fa60bcc7b21bb88ad9a1ee59062fbec17fadaa4836b69e8e6d18188b4027b794357634467
2017-03-09 08:15:44 +01:00
NicolasDorier 3cef95058c Trivial: Add const modifier to GetHDChain and IsHDEnabled 2017-03-09 11:32:02 +09:00
Matt Corallo 819b513a54 Add missing braces in semaphore posts in net 2017-03-08 14:55:28 -05:00
Matt Corallo e007b243c4 Fix shutdown hang with >= 8 -addnodes set
We previously would block waiting for a CSemaphoreGrant in
ThreadOpenAddedConnections, when we did not need to. This would
block as the posts in CConnman shutdown were both to the wrong
semaphore and in the wrong location.
2017-03-08 14:41:57 -05:00
John Newbery 338bf065a4 Add commenting around JSON error codes
RPC_INVALID_REQUEST and RPC_METHOD_NOT_FOUND are mapped internally to
HTTP error codes and should not be used for application-layer errors.
This commit adds commenting around those definitions to warn not to use
them for application errors.
2017-03-08 14:22:55 -05:00
Karl-Johan Alm a57845c20e
Refactor: Remove using namespace <xxx> from util* 2017-03-08 08:47:02 -08:00
Karl-Johan Alm 8a5228197c
Refactor: Remove using namespace <xxx> from wallet/ 2017-03-08 08:46:59 -08:00
Karl-Johan Alm 8cbfc4e472
Refactor: Remove using namespace <xxx> from script/ 2017-03-08 08:08:17 -08:00
Karl-Johan Alm f3c264e9a6
Refactor: Remove using namespace <xxx> from rpc/ 2017-03-08 08:07:55 -08:00
practicalswift 218d915445 [bench] Avoid function call arguments which are pointers to uninitialized values 2017-03-08 16:40:12 +01:00
MarcoFalke 8bfa13b15b
Merge #9936: [trivial] Fix three typos introduced into walletdb.h in commit 7184e25
fdab309 [trivial] Fix typos introduced in 7184e25c80 (practicalswift)

Tree-SHA512: 091666f996267fc5d9f911e6ff25051df5c198851a9c2a6cae73692ffacc64f4275932260487aa48a224ca7f80c58f79933065c72d42aeccae540293c67bcee9
2017-03-08 14:15:47 +01:00
kobake 8e0720bdb9 Fix msvc compiler error C4146 (unary minus operator applied to unsigned type)
On msvc14, int literal '-2147483648' is invalid, because '2147483648' is unsigned type and cant't apply minus operator to unsigned type.
To define the int literal correctly, use '-2147483647 - 1' formula that is also used to define INT_MIN in limits.h.
2017-03-08 15:43:40 +09:00
John Newbery 6c1fb73dd1 Improve logging in bctest.py if there is a formatting mismatch 2017-03-07 18:07:08 -05:00
John Newbery dab804c18a Return correct error codes in fundrawtransaction().
The fundrawtransaction() RPC was returning misleading or incorrect error
codes (for example RPC_INTERNAL_ERROR when funding the transaction
failed). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
errors, only for genuine internal errors such as corrupted data.

That error code has been replaced with RPC_WALLET_ERROR.

This commit also updates the test cases to explicitly test the error code.
2017-03-07 16:45:09 -05:00
John Newbery a012087667 Return correct error codes in setban().
The setban() RPC was returning misleading or incorrect error
codes (for example RPC_CLIENT_NODE_ALREADY_ADDED when an invalid IP
address was entered). This commit fixes those error codes:

- RPC_CLIENT_INVALID_IP_OR_SUBNET should be returned if the client
  enters an invalid IP address or subnet.

This commit also updates the test cases to explicitly test the error code.

This commit also adds a testcase for trying to setban on an invalid subnet.
2017-03-07 16:45:09 -05:00
John Newbery 960bc7f778 Return correct error codes in removeprunedfunds().
The removeprunedfunds() RPC was returning misleading or incorrect error
codes (for example RPC_INTERNAL_ERROR when the transaction was
not found in the wallet). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
errors, only for genuine internal errors such as corrupted data.

This error code has been replaced with RPC_WALLET_ERROR.

This commit also updates the test cases to explicitly test the error code.
2017-03-07 16:45:09 -05:00
John Newbery c1190963b3 Return correct error codes in blockchain.cpp.
RPCs in blockchain.cpp were returning misleading or incorrect error
codes (for example getblock() returning RPC_INTERNAL_ERROR when the
block had been pruned). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
  errors, only for genuine internal errors such as corrupted data.
- RPC_METHOD_NOT_FOUND should not be returned in response to a
  JSON request for an existing method.

Those error codes have been replaced with RPC_MISC_ERROR or
RPC_INVALID_PARAMETER as appropriate.
2017-03-07 16:45:09 -05:00
John Newbery 6d07c62322 Return correct error codes in bumpfee().
The bumpfee() RPC was returning misleading or incorrect error codes
(for example RPC_INVALID_ADDRESS_OR_KEY when the transaction was not
BIP125 replacable). This commit fixes those error codes:

- RPC_INVALID_ADDRESS_OR_KEY if an invalid address was provided:
    - Invalid change address given
- RPC_INVALID_PARAMETER if a single (non-address/key) parameter is incorrect
    - confTarget and totalFee options should not both be set.
    - Invalid confTarget
    - Insufficient totalFee (cannot be less than required fee)
- RPC_WALLET_ERROR for any other error
    - Transaction has descendants in the wallet
    - Transaction has descendants in the mempool
    - Transaction has been mined, or is conflicted with a mined transaction
    - Transaction is not BIP 125 replaceable
    - Transaction has already been bumped
    - Transaction contains inputs that don't belong to the wallet
    - Transaction has multiple change outputs
    - Transaction does not have a change output
    - Fee is higher than maxTxFee
    - New fee rate is less than the minimum fee rate
    - Change output is too small.

This commit also updates the test cases to explicitly test the error code.
2017-03-07 16:45:09 -05:00
Wladimir J. van der Laan 47510ad3dd
Merge #9548: Remove min reasonable fee
ad82cb0 Remove unnecessary min fee argument in CTxMemPool constructor (Alex Morcos)
2a7b56c CBlockPolicyEstimator now uses hard coded minimum bucket feerate (Alex Morcos)
ac9d3d2 Change fee estimation bucket limit variable names (Alex Morcos)

Tree-SHA512: 6e3bc7df3497ed60c7620845d222063e33a0238020f5c3316e61e0eff758078588ea8dd51196ceb59aa561ba106f8cdae62cebe521adb3247108bb49f15252d6
2017-03-07 19:49:00 +01:00
Wladimir J. van der Laan 30ff3a2fc9
Merge #9602: Remove coin age priority and free transactions - implementation
b421e6d Update example bitcoin.conf (Alex Morcos)
7d4e950 Allow setting minrelaytxfee to 0 (Alex Morcos)
359e8a0 [cleanup] Remove coin age priority completely. (Alex Morcos)
f9b9371 [rpc] Remove priorityDelta from prioritisetransaction (Alex Morcos)
49be7e1 [rpc] Remove priority information from mempool RPC calls (Alex Morcos)
0315888 [test] Remove priority from tests (Alex Morcos)
f838005 No longer allow "free" transactions (Alex Morcos)
ad727f4 [rpc] sendrawtransaction no longer bypasses minRelayTxFee (Alex Morcos)
fe282ac [cleanup] Remove estimatePriority and estimateSmartPriority (Alex Morcos)
400b151 [debug] Change -printpriority option (Alex Morcos)
272b25a [mining] Remove -blockprioritysize. (Alex Morcos)
12839cd [rpc] Remove estimatepriority and estimatesmartpriority. (Alex Morcos)
ddf58c7 wallet: Remove sendfree (MarcoFalke)

Tree-SHA512: a9a4499405923ce794ef18f9e334dbbd59dfc73a3dc2df6f85cc9c62af6f353ec2eed9c2d5e58e904f918d0d7ab738f403dd4939d9bc2276136864fe63710782
2017-03-07 19:30:23 +01:00
Wladimir J. van der Laan 3178b2c740
Merge #9369: Factor out CWallet::nTimeSmart computation into a method.
630fc54 Clean up braces in CWallet::ComputeTimeSmart (Russell Yanofsky)
6c996c2 Add documentation describing CWallet::nTimeSmart. (Russell Yanofsky)
1f98abe Factor out CWallet::nTimeSmart computation into a method. (Russell Yanofsky)
c6b82d1 Add tests for CWalletTx::nTimeSmart (Russell Yanofsky)

Tree-SHA512: 457a30251e572cf20dac0198af1a94128d269b1e0ce6605a213d56fc14d85c84a0a494e3dcbb18c201c4f39e6f7b000bd9cb6f283930d8452e4bb93ba406f8d4
2017-03-07 17:11:59 +01:00
Wladimir J. van der Laan 6015df5b85
Merge #9912: Optimize GetWitnessHash() for non-segwit transactions
02c57b5 Optimize GetWitnessHash() for non-segwit transactions (Suhas Daftuar)

Tree-SHA512: 405d07c11930f3432ae25b11232466a30ba2339be98e0fb5149934d792e014f504fedbe62b9c8e5febbbdad459bd1573ea896e527b9aa591926bbc774b895e6a
2017-03-07 11:03:32 +01:00
Wladimir J. van der Laan 779f2f9747
Merge #9605: Use CScheduler for wallet flushing, remove ThreadFlushWalletDB
0235be1 Rename FlushWalletDB -> CompactWalletDB, add function description (Matt Corallo)
735d9b5 Use CScheduler for wallet flushing, remove ThreadFlushWalletDB (Matt Corallo)
73296f5 CScheduler boost->std::function, use millisecs for times, not secs (Matt Corallo)

Tree-SHA512: c04f97beab65706c444c126be229d02887df9b0972d8fb15ca1f779ef0e628cf7ecef2bf533c650d9b44645b63e01de22f17266a05907e778938d64cc6e19de6
2017-03-07 11:00:55 +01:00
practicalswift fdab309670 [trivial] Fix typos introduced in 7184e25c80 2017-03-07 09:16:46 +01:00
MarcoFalke 19be26afe3
Merge #9555: [test] Avoid reading a potentially uninitialized variable in tx_invalid-test (transaction_tests.cpp)
8455e36 [test] Avoid reading a potentially uninitialized variable in tx_invalid-test (practicalswift)

Tree-SHA512: 1064cdd5c9e4612a05397a5880535d93dbb18dec4897b4bbda9e6ad78d30f4c72303e4d23159398f1b33545ff5819e739e374d7cde757e402b26c355268a2319
2017-03-07 01:22:12 +01:00
Matt Corallo 0235be1e7a Rename FlushWalletDB -> CompactWalletDB, add function description 2017-03-06 18:35:20 -05:00
Matt Corallo 735d9b5362 Use CScheduler for wallet flushing, remove ThreadFlushWalletDB 2017-03-06 18:35:19 -05:00
Matt Corallo 73296f54d6 CScheduler boost->std::function, use millisecs for times, not secs 2017-03-06 18:33:50 -05:00
kobake 292112f87e Fix msvc compiler error C4146 (minus operator applied to unsigned type)
On msvc14, the compiler error C4146 (unary minus operator applied to unsigned type, result still unsigned) had been occured.
Use '0 - x' styled formula instead of '-x' so as to fix the error.
2017-03-07 02:42:44 +09:00
Wladimir J. van der Laan 72fb5158b1
Merge #9906: Disallow copy constructor CReserveKeys
188f89c Disallow copy of CReserveKeys (Gregory Sanders)

Tree-SHA512: e55ce10bf7f2dc91de9797e60ab7767fb51f25255995d62ddf358c52b7aaa23c26fbfb522e1610ff950b86804ddbc38dc0d7708bfab2c4d33ad99a275d8c77db
2017-03-06 18:33:24 +01:00
Gregory Sanders 188f89c3bb Disallow copy of CReserveKeys 2017-03-06 09:26:10 -05:00
Jonas Schnelli 7184e25c80
[Wallet] refactor CWallet/CWalletDB/CDB
Try to hide CDB/bitdb behinde CWalletDB.
Prepare for full wallet database abstraction.
2017-03-06 11:30:24 +01:00
Wladimir J. van der Laan fa625b078b
Merge #9333: Document CWalletTx::mapValue entries and remove erase of nonexistent "version" entry.
87ed396 [trivial] Add comment documenting bumpfee mapValues (Russell Yanofsky)
a1fe944 Remove reference to nonexistent "version" wallet transaction mapvalue field (Russell Yanofsky)
654e044 [trivial] Add comment documenting CWalletTx::mapValue (Russell Yanofsky)

Tree-SHA512: 1fd1860e345c59b13634db2007fff4ba30aaf1f177fdd765f47bf9257fac117cdcd5d491424416da304c08e85effbb27f3424f072f7c9587ef39cb98531b932a
2017-03-06 10:18:19 +01:00
Wladimir J. van der Laan d32581cc29
Merge #9547: bench: Assert that division by zero is unreachable
db07f91 Assert that what might look like a possible division by zero is actually unreachable (practicalswift)

Tree-SHA512: f1652eb37196a5b72f356503a1fbb44fb98aa8a94954ad1765f86d81ebf41a2337d4eb58c4f19937fda3752f5d2d642756e44afdbd438015b87ac20801246bff
2017-03-06 10:08:14 +01:00
Wladimir J. van der Laan 5a6af31722
Merge #9908: Define 7200 second timestamp window constant
e57a1fd Define 7200 second timestamp window constant (Russell Yanofsky)

Tree-SHA512: 449d20e4fd23905cd96be36f717c55a0a2360aba1002aaf55a3699cce4a41f6e94acc2fbe511a93c5cbe8f8e68386995a76cad67620ebb66ba9283e6080ab567
2017-03-06 10:02:05 +01:00
Wladimir J. van der Laan 56ab672b59
Merge #9576: [wallet] Remove redundant initialization
343ba8f [wallet] Remove redundant initialization (practicalswift)

Tree-SHA512: 54b94d7703b1735cb1ae0bd7eba61ca9d2f18e20b70e46c94aa3b0653495dce4fdea00cf953ec08215b96b5792eabb8b38c3f9b3cd36e52b82fcb2f1fd8a3540
2017-03-06 09:40:06 +01:00
Wladimir J. van der Laan a4d1c9f041 compat: use `unsigned int` instead of `u_int`
`u_int` is not available on some platforms (not sure what standard it's
supposed to be part of), we don't use it anywhere else, and it doesn't
hurt to simply write `unsigned int` out here.
2017-03-05 09:51:21 +00:00
Wladimir J. van der Laan 25da1ee36c build: cleanup: define MSG_DONTWAIT/MSG_NO_SIGNAL locally
Define MSG_DONTWAIT and MSG_NO_SIGNAL in the implementation files that
use them (`net.cpp` and `netbase.cpp`), instead of compat.h which is
included all over the place.

This avoids putting them in the global namespace, as defining them as 0
is a hack that works for our specific usage, but it is not a general
solution.

Also makes sure they are defined only once so the `!defined(MSG_x)` guard can go.
2017-03-05 09:47:29 +00:00
Wladimir J. van der Laan c459d509b7 build: Probe MSG_DONTWAIT in the same way as MSG_NOSIGNAL
Instead of the WIN32-specific workaround, detect lack of `MSG_DONTWAIT`
in the build system. This allows other platforms without `MSG_DONTWAIT`
to work too.
2017-03-05 09:29:37 +00:00
Alex Morcos 7d4e9509ad Allow setting minrelaytxfee to 0
Setting minrelaytxfee to 0 will allow all transactions regardless of fee to enter your mempool until it reaches its size limit.  However now that mempool limiting is governed by a separate incrementalrelay fee, it is an unnecessary restriction to prevent a minrelaytxfee of 0.
2017-03-03 16:50:20 -05:00
Alex Morcos 359e8a03d1 [cleanup] Remove coin age priority completely.
Remove GetPriority and ComputePriority.  Remove internal machinery for tracking priority in CTxMemPoolEntry.
2017-03-03 16:50:20 -05:00
Alex Morcos f9b9371c60 [rpc] Remove priorityDelta from prioritisetransaction
This a breaking API change to the prioritisetransaction RPC call which previously required exactly three arguments and now requires exactly two (hash and feeDelta).  The function prioritiseTransaction is also updated.
2017-03-03 16:50:19 -05:00
Alex Morcos 49be7e1bef [rpc] Remove priority information from mempool RPC calls
"startingpriority" and "currentpriority" are no longer returned in the JSON information about a mempool entry.  This affects getmempoolancestors, getmempooldescendants, getmempooolentry, and getrawmempool.
2017-03-03 16:50:19 -05:00
Alex Morcos 0315888d0d [test] Remove priority from tests
Remove all coin age priority functionality from unit tests and RPC tests.
2017-03-03 16:50:19 -05:00
Alex Morcos f838005444 No longer allow "free" transactions
Remove -limitfreerelay and always enforce minRelayTxFee in the mempool (except from disconnected blocks)

Remove -relaypriority, the option was only used for the ability to allow free transactions to be relayed regardless of their priority.  Both notions no longer apply.
2017-03-03 16:50:19 -05:00
Russell Yanofsky e57a1fd899 Define 7200 second timestamp window constant 2017-03-03 13:51:41 -05:00
Suhas Daftuar 02c57b521a Optimize GetWitnessHash() for non-segwit transactions 2017-03-03 13:33:42 -05:00
Russell Yanofsky 7759aa23d1 Save watch only key timestamps when reimporting keys
Previously if an existing watch only key was reimported with a new timestamp,
the new timestamp would not be saved in the key metadata, and would not be used
to update the wallet nTimeFirstKey value (which could cause rescanning to start
at the wrong point and miss transactions).

Issue was pointed out by Jonas Schnelli <dev@jonasschnelli.ch> in
https://github.com/bitcoin/bitcoin/pull/9108#issuecomment-279715550
2017-03-03 11:22:44 -05:00
Russell Yanofsky 630fc549e2 Clean up braces in CWallet::ComputeTimeSmart 2017-03-03 11:22:44 -05:00
Wladimir J. van der Laan 53c300fb52
Merge #9910: Docs: correct and elaborate -rpcbind doc
e5b449c Docs: correct and elaborate -rpcbind doc (Ian Kelling)

Tree-SHA512: e1cdaa32f7248f304d463e3f37d7d5da23ee0e506bd453420b87f4cc9c704cc30214e41c9266294890d65f2ee270f9355f38b542e8c01452637bdbba8273c755
2017-03-03 17:22:44 +01:00
Russell Yanofsky 6c996c2df7 Add documentation describing CWallet::nTimeSmart.
Most of the text comes from the 2012 Luke Dashjr <luke-jr+git@utopios.org>
c3f95ef commit message.
2017-03-03 11:22:44 -05:00
Russell Yanofsky 1f98abe47b Factor out CWallet::nTimeSmart computation into a method.
No change in behavior, this change just pulls some code out of
CWallet::AddToWallet that was making it very long into a separate method.
2017-03-03 11:22:44 -05:00
Russell Yanofsky c6b82d1db5 Add tests for CWalletTx::nTimeSmart 2017-03-03 11:22:44 -05:00
Wladimir J. van der Laan 90cb2a218e
Merge #9774: Enable host lookups for -proxy and -onion parameters
f36bdf0 Enable host lookups for -proxy and -onion parameters (Johnathan Corgan)

Tree-SHA512: 40f5ef3954721333e58d34653874d9f6ac5426c817762d132838f3b6f968ca5ca05aa56d02fd742cb5a8dc040f1a28dad6d54f667342eceba62fb2af18b58fc0
2017-03-03 16:22:22 +01:00
Wladimir J. van der Laan 67c5cc1917
Merge #9828: Avoid -Wshadow warnings in wallet_tests
09fe346 Avoid -Wshadow warnings in wallet_tests (Russell Yanofsky)

Tree-SHA512: 03a026787438efc9eba94299c2dd7de07a71ec7363b058b4f086d5ff0be844660fff2ef4f40e43d91313ea53de25f3de3c677b080b564d37f0693057498d3233
2017-03-03 16:08:50 +01:00
Wladimir J. van der Laan 75d012e8c7
Merge #8808: Do not shadow variables (gcc set)
ad1ae7a Check and enable -Wshadow by default. (Pavel Janík)
9de90bb Do not shadow variables (gcc set) (Pavel Janík)

Tree-SHA512: 9517feb423dc8ddd63896016b25324673bfbe0bffa97f22996f59d7a3fcbdc2ebf2e43ac02bc067546f54e293e9b2f2514be145f867321e9031f895c063d9fb8
2017-03-03 15:48:53 +01:00
Wladimir J. van der Laan ba80a684cf
Merge #9903: Docs: add details to -rpcclienttimeout doc
90a1d9a Docs: add details to -rpcclienttimeout doc (Ian Kelling)

Tree-SHA512: 7f9524f279a54b4d902674740d92624785abd54865aba82f7261151ceda50b5d51bf4d91c4fc0360168e190f8df890cc141bea5e1a9f4f2e62b8f9effda212cc
2017-03-03 14:57:02 +01:00
Wladimir J. van der Laan eb281842b7
Merge #8775: RPC refactoring: Access wallet using new GetWalletForJSONRPCRequest
d678771 Wallet: Sanitise -wallet parameter (Luke Dashjr)
9756be3 Wallet/RPC: Use filename rather than CWallet pointer, for lockwallet RPCRunLater job name (Luke Dashjr)
86be48a More tightly couple EnsureWalletIsAvailable with GetWalletForJSONRPCRequest where appropriate (Luke Dashjr)
a435632 Move wallet RPC declarations to rpcwallet.h (Luke Dashjr)
ad15734 RPC: Pass on JSONRPCRequest metadata (URI/user/etc) for "help" method (Luke Dashjr)
bf8a04a Reformat touched lines with C++11 (Luke Dashjr)
2e518e3 Move nWalletUnlockTime to CWallet::nRelockTime, and name timed task unique per CWallet (Luke Dashjr)
d77ad6d RPC: Do all wallet access through new GetWalletForJSONRPCRequest (Luke Dashjr)
eca550f RPC/Wallet: Pass CWallet as pointer to helper functions (Luke Dashjr)

Tree-SHA512: bfd592da841693390e16f83b451503eb5cedb71208089aa32b3fc45e973555584a3ed7696dd239f6409324464d565dacf0f3d0e36e8e13ae6a7843848465f960
2017-03-03 13:38:42 +01:00
Ian Kelling e5b449c3e8 Docs: correct and elaborate -rpcbind doc
The default was incorrect unless -rpcallowip was also specified.
2017-03-03 04:14:10 -08:00
Wladimir J. van der Laan 58861ad91b
Merge #9904: test: Fail if InitBlockIndex fails
6485466 test: Report InitBlockIndex result (Wladimir J. van der Laan)

Tree-SHA512: 8e1408aa8d56ec1873190f886af24aa68b0555ec4996b2b8a5a39a51ded58c8fba5843c07881ed33ab6dcb00e62c2322bcf2a6fb8f1083f77e0d93e7295ab938
2017-03-03 07:16:32 +01:00
MarcoFalke f7ec7cfd38
Merge #9359: Add test for CWalletTx::GetImmatureCredit() returning stale values.
7ed143c Add test for CWalletTx::GetImmatureCredit() returning stale values. (Russell Yanofsky)

Tree-SHA512: c95088ed6dfc5a0774ddaa2fe14ac0a9ebd830922a4d77100ec3d51fdeb6df40ad97de4f2ea970ed0f4122dcc0022ee1d43ab3c7188becd7f90c1c6af0ed39b7
2017-03-02 22:30:15 +01:00
Wladimir J. van der Laan 64854666f5 test: Report InitBlockIndex result
If InitBlockIndex fails, then it will segfault later. Same for the later
ActivateBestChain. BOOST_REQUIRE the result, so that an error will be
reported and the test case aborted.
2017-03-02 14:54:47 +01:00
Ian Kelling 90a1d9a55d Docs: add details to -rpcclienttimeout doc 2017-03-02 04:42:37 -08:00
Wladimir J. van der Laan 65d90f585a
Merge #9143: Refactor ZapWalletTxes to avoid layer violations
0165a56 Refactor ZapWalletTxes to avoid layer vialotions (Jonas Schnelli)

Tree-SHA512: 51e3abbb866185817d14d685a65cb1070a7a60aa3db692670f3a5fdd328aad59afa765c5a6b13d9e8f6d219e735487f8c87998f2fb38fdd911c1fe19bea373b9
2017-03-02 11:32:34 +01:00
Wladimir J. van der Laan 0496e15aef
Merge #9894: remove 'label' filter for rpc command help
6665977 remove 'label' filter for rpc command help (Gregory Sanders)

Tree-SHA512: 0676c55b2893a469cd6785963affbb04126b9a32c130f1bb22dfd233ede6998f695187264e897ced4e0dac48451d9ae0311ebb4f7442096cad632fd22f75080e
2017-03-02 10:07:31 +01:00
Jonas Schnelli b00ba6251f
Merge #9834: qt: clean up initialize/shutdown signals
5b528d7 qt: clean up initialize/shutdown signals (Marko Bencun)

Tree-SHA512: 4a8326ba05a1cc037203a7abe01d4e77b6ff83e62ec14f09834ada4b35a23ffb1f28b5587aa2e02601f0f6c7d62c5647a7f10320239b4bac132791be29930ddb
2017-03-02 09:37:40 +01:00
Gregory Sanders 666597798c remove 'label' filter for rpc command help 2017-03-01 09:15:39 -08:00
Wladimir J. van der Laan d19d45a1e6
Merge #9821: util: Specific GetOSRandom for Linux/FreeBSD/OpenBSD
7e6dcd9 random: Add fallback if getrandom syscall not available (Wladimir J. van der Laan)
7cad849 sanity: Move OS random to sanity check function (Wladimir J. van der Laan)
aa09ccb squashme: comment that NUM_OS_RANDOM_BYTES should not be changed lightly (Wladimir J. van der Laan)
224e6eb util: Specific GetOSRandom for Linux/FreeBSD/OpenBSD (Wladimir J. van der Laan)

Tree-SHA512: 9fd408b1316c69de86674f342339b2f89192fd317c8c036b5df4320f828fa263c7966146bfc1904c51137ee4a26e4cb0f560b2cd05e18cde4d808b9b92ad15c4
2017-03-01 12:41:53 +01:00
Wladimir J. van der Laan cbdb4732f1
Merge #9868: Abstract out the command line options for block assembly
277b472 Run miner_tests with fixed options (Pieter Wuille)
48faf0b Abstract out BlockAssembler options (Pieter Wuille)

Tree-SHA512: 8e910904864c8653fb0358d820a4181d0496bdcbc3454c17a742af7505bfb59f7078c6d0faa9c753bdaf23b6d93d228a09913cc867fbddccd515483ebe7bfad0
2017-03-01 12:38:04 +01:00
Wladimir J. van der Laan 22f609f25a
Merge #9861: Trivial: Debug log ambiguity fix for peer addrs
6d37ee8 Trivial: Debug log ambiguity fix for peer addrs (keystrike)

Tree-SHA512: 9605f12bffd067427a206655c29b0b42689e9b28c313d1f6d6b0ef71351277b98b40f2e2a2ec0ac83c095a9f6f54e7a87762da400a56d2a833f8c2d14e5ac8d5
2017-03-01 11:16:59 +01:00
Russell Yanofsky 30abce7a99 Improve ScanForWalletTransactions return value
Change ScanForWalletTransactions return value so it is possible to distinguish
scans that skip reading every block (due to the nTimeFirstKey optimization)
from scans that fail while reading the chainActive.Tip() block. Return value is
now non-null in the non-failing case.

This change doesn't affect any user-visible behavior, it is only an internal
API improvement. The only code currently using the ScanForWalletTransactions
return value is in importmulti, and importmulti always calls
ScanForWalletTransactions with a pindex pointing to the first block in
chainActive whose block time is >= (nLowestTimestamp - 7200), while
ScanForWalletTransactions would only return null without reading blocks when
pindex and every block after it had a block time < (nTimeFirstKey - 7200).
These conditions could never happen at the same time because nTimeFirstKey <=
nLowestTimestamp.

I'm planning to make a more substantial API improvement in the future (making
ScanForWalletTransactions private and exposing a higher level rescan method to
RPC code), but Matt Corallo <git@bluematt.me> pointed out this odd behavior
introduced by e2e2f4c "Return errors from importmulti if complete rescans are
not successful" yesterday, so I'm following up now to get rid of badness
introduced by that merge.
2017-03-01 05:16:24 -05:00
Russell Yanofsky 7ed143c10e Add test for CWalletTx::GetImmatureCredit() returning stale values.
Add test for cached immature credit flag not being cleared in
CWalletTx::MarkDirty() bug, which was fixed in
https://github.com/bitcoin/bitcoin/pull/8717, commit a560378.
2017-03-01 05:11:46 -05:00
keystrike 6d37ee8314 Trivial: Debug log ambiguity fix for peer addrs
This line can be misinterpreted as loading wallet addresses which is confusing, especially when the wallet is disabled.
2017-02-28 22:14:24 -03:00
practicalswift 343ba8fef5 [wallet] Remove redundant initialization
Prior to this commit pindexRescan was initialized to a chainActive.Tip().
However, the value of pindexRescan set at time of initialization was never
read before pindexRescan was being set to either chainActive.Genesis()
(case 1), FindForkInGlobalIndex(chainActive, locator) (case 2) or
chainActive.Genesis() (case 3). Thus, the initialization was redundant.

This commit a.) removes the redundant initialization and b.) simplifies
this logic so that pindexRescan is initialized to chainActive.Genesis()
(case 1 and 3), and set to FindForkInGlobalIndex(chainActive, locator)
(case 2) as needed.
2017-02-28 16:54:43 +01:00
Wladimir J. van der Laan 7e2a2212ec
Merge #9829: Fix importmulti returning rescan errors for wrong keys
306bd72 Fix importmulti returning rescan errors for wrong keys (Russell Yanofsky)

Tree-SHA512: ae9998236cbd3ff749d6b5c716bd76c9cec386b0708583e4912e4e05bf4584545258e1d0543aa5445024d2b5decf859a64f40c6503029773366a0f9a9ddf9b88
2017-02-28 13:52:50 +01:00
Wladimir J. van der Laan b7547fa93e
Merge #9822: Remove block file location upgrade code
4b183d3 Remove block file location upgrade code (Marko Bencun)

Tree-SHA512: fac1fce95341e0df645c08c7e794195b22b54df08826aa8728f2f97aede1e42f724f8133781b97f836d4a392d044d08c846bce471a6b478582014f8be501a712
2017-02-28 12:31:33 +01:00
Wladimir J. van der Laan c322fa472e
Merge #9732: [Trivial] Remove nonsense #undef foreach
467df39 Remove nonsense #undef foreach (John Newbery)

Tree-SHA512: b8c3c6654eb8a9e5008a1923bee46f7ef9f8216c8f4f1b4662d82c26410ca8d8afe41e24e48a3e2e8b2a25c81c33795a4073dabfe357caf0aa820519d4fffc71
2017-02-28 12:29:43 +01:00
Wladimir J. van der Laan f5ef8e9dd2
Merge #9867: Replace remaining sprintf with snprintf
19cafc6 test: Replace remaining sprintf with snprintf (Wladimir J. van der Laan)
0a17714 uint256: replace sprintf with HexStr and reverse-iterator (Wladimir J. van der Laan)

Tree-SHA512: 2ba1dd4d25e1cbfff4d67b2f483448aa7c34ab5c799cddd48ba5826e5fa6df425abe35e244aaf4c52db9fccfb4d2a25a14bb4597bf9d1fce95991f270da6bb26
2017-02-28 12:02:44 +01:00
Wladimir J. van der Laan 30bdcfca2b
Merge #9865: Change bitcoin address in RPC help message
83ac719 Change bitcoin address in RPC helpaddress to an invalid address, so people don't accidentally send coins there (like I did). (Marijn Stollenga)

Tree-SHA512: ca1163466a149d567b97efbfcfa8fdfe2d474245b4dd5a1a92555b4e87f8e99df5fee4cd79ef1ce6a98db2337846af78f37c2e6b31d02008b11fa0e151ce6590
2017-02-28 11:59:34 +01:00
Wladimir J. van der Laan 65fdc37ac3
Merge #9856: Terminate immediately when allocation fails
d4ee7ba prevector: assert successful allocation (Cory Fields)
c5f008a don't throw std::bad_alloc when out of memory. Instead, terminate immediately (Cory Fields)

Tree-SHA512: 699ce8df5b1775a99c71d3cfc952b45da1c0091e1a4b6adfac52d5be6144c3d98f88ac3af90e5c73fff2f74666a499feb4a34434683ce5979814e869c0aeddc3
2017-02-28 11:37:36 +01:00
MarcoFalke 88c2ae3ed2
Merge #9350: [Trivial] Adding label for amount inside of tx_valid/tx_invalid.json
988ce2d Adding 'amount' label to tx_valid/tx_invalid.json files (Chris Stewart)

Tree-SHA512: 11c216c6565ecaa5ff4eb6122f87d3b28f89db52d1e473c0678f61c240e133698adb05e717bfb9d3db36409dfb230b902dca4029a58633be36c9f85e0db3d973
2017-02-27 22:33:55 +01:00
Luke Dashjr d678771c66 Wallet: Sanitise -wallet parameter 2017-02-27 20:45:18 +00:00
Luke Dashjr 9756be382e Wallet/RPC: Use filename rather than CWallet pointer, for lockwallet RPCRunLater job name
The job name is logged, and could pose as an information leak to someone attacking the process, helping them counteract ASLR protections
2017-02-27 20:45:18 +00:00
Luke Dashjr 86be48a77c More tightly couple EnsureWalletIsAvailable with GetWalletForJSONRPCRequest where appropriate 2017-02-27 20:45:18 +00:00
Luke Dashjr a4356328e0 Move wallet RPC declarations to rpcwallet.h 2017-02-27 20:45:18 +00:00
Luke Dashjr ad1573472e RPC: Pass on JSONRPCRequest metadata (URI/user/etc) for "help" method 2017-02-27 20:45:18 +00:00
Luke Dashjr bf8a04a165 Reformat touched lines with C++11 2017-02-27 20:45:18 +00:00
Luke Dashjr 2e518e313b Move nWalletUnlockTime to CWallet::nRelockTime, and name timed task unique per CWallet 2017-02-27 20:45:17 +00:00
Luke Dashjr d77ad6d416 RPC: Do all wallet access through new GetWalletForJSONRPCRequest 2017-02-27 20:45:17 +00:00
Luke Dashjr eca550f250 RPC/Wallet: Pass CWallet as pointer to helper functions 2017-02-27 20:45:17 +00:00
Cory Fields d4ee7baef7 prevector: assert successful allocation 2017-02-27 14:52:15 -05:00
Alex Morcos ad727f4eaf [rpc] sendrawtransaction no longer bypasses minRelayTxFee
The prioritisetransaction API can always be used if a transaction needs to be submitted that bypasses minRelayTxFee.
2017-02-27 11:23:51 -05:00
Alex Morcos fe282acd76 [cleanup] Remove estimatePriority and estimateSmartPriority
Unused everywhere now except one test.
2017-02-27 11:23:51 -05:00
Alex Morcos 400b15147c [debug] Change -printpriority option
-printpriority output is now changed to only show the fee rate and hash of transactions included in a block by the mining code.
2017-02-27 11:23:50 -05:00
Alex Morcos 272b25a6a9 [mining] Remove -blockprioritysize.
Remove ability of mining code to fill part of a block with transactions sorted by coin age.
2017-02-27 11:23:50 -05:00
Alex Morcos 12839cdd56 [rpc] Remove estimatepriority and estimatesmartpriority.
The RPC calls were already deprecated.
2017-02-27 11:23:50 -05:00
MarcoFalke ddf58c7573 wallet: Remove sendfree
This removes the option from the wallet to not pay a fee on "small"
transactions which spend "old" inputs.

This code is no longer worth keeping around, as almost all miners
prefer not to include transactions which pay no fee at all.
2017-02-27 11:23:50 -05:00
Russell Yanofsky 306bd72157 Fix importmulti returning rescan errors for wrong keys
Bug was a missing ++i line in a new range for loop added in commit e2e2f4c
"Return errors from importmulti if complete rescans are not successful"
2017-02-27 07:38:51 -05:00
Wladimir J. van der Laan 75a109338f tests: Fix dangling pwalletMain pointer in wallet tests 2017-02-27 13:15:39 +01:00
Wladimir J. van der Laan 19cafc6239 test: Replace remaining sprintf with snprintf
Use of `sprintf` is seen as a red flag as many of its uses are insecure.
OpenBSD warns about it while compiling, and some modern platforms, e.g.
[cloudlibc from cloudabi](https://github.com/NuxiNL/cloudlibc) don't
even provide it anymore.

Although our uses of these functions are secure, it can't hurt to
replace them anyway. There are only 3 occurences left, all in the
tests.
2017-02-27 10:03:20 +01:00
Wladimir J. van der Laan 0a177148e7 uint256: replace sprintf with HexStr and reverse-iterator
Instead of calling sprintf for every byte, format the hex bytes
ourselves by help of HexStr and a reverse_iterator.
2017-02-27 10:02:45 +01:00
Pieter Wuille 277b472fb2 Run miner_tests with fixed options 2017-02-26 16:13:51 -08:00
Pieter Wuille 48faf0bf63 Abstract out BlockAssembler options 2017-02-26 16:13:17 -08:00
Marijn Stollenga 83ac719d34 Change bitcoin address in RPC helpaddress to an invalid address, so people don't accidentally send coins there (like I did). 2017-02-26 14:01:05 +01:00
Wladimir J. van der Laan 6206252e50
Merge #9847: Extra test vector for BIP32
30aedcb BIP32 extra test vector (Pieter Wuille)
2017-02-25 10:43:29 +01:00
Cory Fields c5f008a416 don't throw std::bad_alloc when out of memory. Instead, terminate immediately 2017-02-25 01:09:11 -05:00
Wladimir J. van der Laan f19afdbfb4
Merge #9612: [trivial] Rephrase the definition of difficulty.
dc222f8 Trivial: Rephrase the definition of difficulty in the code. (Karl-Johan Alm)
2017-02-24 12:48:56 +01:00
Wladimir J. van der Laan dd6e0d6301
Merge #9833: Trivial: fix comments referencing AppInit2
ef9f495 Trivial: fix comments referencing AppInit2 (Marko Bencun)
2017-02-24 10:53:32 +01:00
Wladimir J. van der Laan 00285cece8
Merge #9840: Update sendfrom RPC help to correct coin selection misconception
f81f0d0 Update sendfrom RPC help to correct coin selection misconception (Russell Yanofsky)
2017-02-24 10:22:04 +01:00
Karl-Johan Alm dc222f8f63
Trivial: Rephrase the definition of difficulty in the code. 2017-02-23 22:06:37 -08:00
Pieter Wuille 30aedcbdb4 BIP32 extra test vector 2017-02-23 17:59:52 -08:00
Marko Bencun ef9f495e93 Trivial: fix comments referencing AppInit2
It was refactored into multiple functions in
0cc8b6bc44.
2017-02-24 09:19:29 +09:00
Matt Corallo b49ad44efe Add comment about cs_most_recent_block coverage 2017-02-23 15:41:53 -05:00
Matt Corallo c47f5b7982 Cache witness-enabled state with recent-compact-block-cache 2017-02-23 15:41:52 -05:00
Matt Corallo efc135ff6d Use cached [compact] blocks to respond to getdata messages 2017-02-23 15:41:52 -05:00
Russell Yanofsky f81f0d0030 Update sendfrom RPC help to correct coin selection misconception 2017-02-23 13:44:12 -05:00
Wladimir J. van der Laan e68c266f3d
Merge #9789: build: add --enable-werror and warn on vla's
205830a build: add --enable-werror option (Cory Fields)
b602fe0 build: warn about variable length arrays (Cory Fields)
2017-02-23 10:48:46 +01:00
Marko Bencun 5b528d746c qt: clean up initialize/shutdown signals
- Change initializeResult(int) to initializeResult(bool) to avoid
   implicit type conversion.
 - Use EXIT_FAILURE and EXIT_SUCCESS instead of magic numbers.
 - Remove the argument from shutdownResult(int); it was called with a
   constant argument.
2017-02-23 17:21:39 +09:00
Cory Fields 205830a37b build: add --enable-werror option
This turns some compiler warnings into errors. Useful for c-i.
2017-02-23 01:06:04 -05:00
Russell Yanofsky 09fe346a4f Avoid -Wshadow warnings in wallet_tests
Warnings introduced by commit e2e2f4c "Return errors from importmulti if
complete rescans are not successful" and reported by Pavel Janík
<Pavel@Janik.cz> in https://github.com/bitcoin/bitcoin/pull/9773 and
https://github.com/bitcoin/bitcoin/pull/9827

wallet/test/wallet_tests.cpp: In member function ‘void wallet_tests::rescan::test_method()’:
wallet/test/wallet_tests.cpp:377:17: warning: declaration of ‘wallet’ shadows a global declaration [-Wshadow]
         CWallet wallet;
2017-02-22 14:11:44 -05:00
Wladimir J. van der Laan bed5b30a56
Merge #9711: [Trivial] Remove incorrect help message from gettxoutproof()
9949ebf [Trivial] Remove incorrect help message from gettxoutproof() (John Newbery)
2017-02-22 13:03:42 +01:00
Wladimir J. van der Laan 1efc99c4dc
Merge #9819: Remove harmless read of unusued priority estimates
bc8fd12 Remove harmless read of unusued priority estimates (Alex Morcos)
2017-02-22 13:02:10 +01:00
Wladimir J. van der Laan ba7220b5e8
Merge #9773: Return errors from importmulti if complete rescans are not successful
e2e2f4c Return errors from importmulti if complete rescans are not successful (Russell Yanofsky)
2017-02-22 12:43:11 +01:00
Marko Bencun 4b183d33f3 Remove block file location upgrade code
An effort to reduce the size of AppInitMain().

The removed code upgrades the location of the block files when
upgrading to 0.8. 0.8 seems to be the oldest version still in use.
2017-02-22 20:32:47 +09:00
Wladimir J. van der Laan a8c5751038
Merge #9801: Removed redundant parameter from mempool.PrioritiseTransaction
eaea2bb Removed redundant parameter from mempool.PrioritiseTransaction (gubatron)
2017-02-22 12:18:38 +01:00
Wladimir J. van der Laan 5b583efaa7
Merge #9805: Add seed.btc.petertodd.org to mainnet DNS seeds
3b4dd2a Add seed.btc.petertodd.org to mainnet DNS seeds (Peter Todd)
2017-02-22 12:14:37 +01:00
Wladimir J. van der Laan 92dd6c8dfd
Merge #9815: Trivial: use EXIT_ codes instead of magic numbers
a87d02a use EXIT_ codes instead of magic numbers (Marko Bencun)
2017-02-22 11:48:45 +01:00
Wladimir J. van der Laan 7e6dcd9995 random: Add fallback if getrandom syscall not available
If the code was compiled with newer (>=3.17) kernel headers but executed
on a system without the system call, every use of random would crash the
program. Add a fallback for that case.
2017-02-22 08:51:26 +01:00
Wladimir J. van der Laan 7cad849299 sanity: Move OS random to sanity check function
Move the OS random test to a sanity check function that is called every
time bitcoind is initialized.

Keep `src/test/random_tests.cpp` for the case that later random tests
are added, and keep a rudimentary test that just calls the sanity check.
2017-02-22 08:02:50 +01:00
Wladimir J. van der Laan aa09ccbb74 squashme: comment that NUM_OS_RANDOM_BYTES should not be changed lightly 2017-02-22 07:38:42 +01:00
gubatron eaea2bbb41 Removed redundant parameter from mempool.PrioritiseTransaction
(Also made the `const uint256 hash` parameter a `const uint256& hash` as suggested by @sdaftuar)
2017-02-21 20:44:23 -07:00
Wladimir J. van der Laan 224e6eb089 util: Specific GetOSRandom for Linux/FreeBSD/OpenBSD
These are available in sandboxes without access to files or
devices. Also [they are safer and more straightforward](https://en.wikipedia.org/wiki/Entropy-supplying_system_calls)
to use than `/dev/urandom` as reading from a file has quite a few edge
cases:

- Linux: `getrandom(buf, buflen, 0)`. [getrandom(2)](http://man7.org/linux/man-pages/man2/getrandom.2.html)
  was introduced in version 3.17 of the Linux kernel.
- OpenBSD: `getentropy(buf, buflen)`. The [getentropy(2)](http://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/getentropy.2)
  function appeared in OpenBSD 5.6.
- FreeBSD and NetBSD: `sysctl(KERN_ARND)`. Not sure when this was added
  but it has existed for quite a while.

Alternatives:

- Linux has sysctl `CTL_KERN` / `KERN_RANDOM` / `RANDOM_UUID`
  which gives 16 bytes of randomness. This may be available
  on older kernels, however [sysctl is deprecated on Linux](https://lwn.net/Articles/605392/)
  and even removed in some distros so we shouldn't use it.

Add tests for `GetOSRand()`:

- Test that no error happens (otherwise `RandFailure()` which aborts)
- Test that all 32 bytes are overwritten (initialize with zeros, try multiple times)

Discussion:

- When to use these? Currently they are always used when available.
  Another option would be to use them only when `/dev/urandom` is not
  available. But this would mean these code paths receive less testing,
  and I'm not sure there is any reason to prefer `/dev/urandom`.

Closes: #9676
2017-02-21 20:57:34 +01:00