Commit Graph

9312 Commits

Author SHA1 Message Date
Cory Fields c851be4b25 net: define NodeId as an int64_t
This should make occurances of NodeId wrapping essentially impossible for
real-world usage.
2017-04-12 13:42:02 -04:00
John Newbery d0cd0bd6d9 Make CWallet::SyncTransactions() interface friendlier 2017-04-11 17:17:46 -04:00
John Newbery 714e4ad13d AddToWalletIfInvolvingMe should test pIndex, not posInBlock 2017-04-11 10:23:32 -04:00
John Newbery 7fd50c3b70 allow libevent logging to be updated during runtime 2017-04-10 17:05:59 -04:00
John Newbery 5255aca3f4 [rpc] Add logging RPC
Adds an RPC to get and set currently active logging categories.
2017-04-10 17:05:59 -04:00
John Newbery 4d9950d3bc Set BCLog::LIBEVENT correctly for old libevent versions. 2017-04-10 17:05:59 -04:00
practicalswift 66082e0119 [trivial] Fix typos (tempoarily → temporarily, inadvertantly → inadvertently) 2017-04-10 22:44:57 +02:00
Matt Corallo d89f8adf25 Make DisconnectBlock and ConnectBlock static in validation.cpp 2017-04-10 16:20:12 -04:00
Wladimir J. van der Laan 67023e9004
Merge #9725: CValidationInterface Cleanups
b1a6d4c Take a CTransactionRef in AddToWalletIfInvolvingMe to avoid a copy (Matt Corallo)
1c95e2f Use std::shared_ptr instead of boost::shared_ptr in ScriptForMining (Matt Corallo)
91f1e6c Remove dead-code tracking of requests for blocks we generated (Matt Corallo)
acad82f Add override to functions using CValidationInterface methods (Matt Corallo)
e6d5e6c Hold cs_wallet for whole block [dis]connection processing (Matt Corallo)
461e49f SyncTransaction->TxAddedToMempool/BlockConnected/Disconnected (Matt Corallo)
f404334 Handle SyncTransaction in ActivateBestChain instead of ConnectTrace (Matt Corallo)
a147687 Keep conflictedTxs in ConnectTrace per-block (Matt Corallo)
d3167ba Handle conflicted transactions directly in ConnectTrace (Matt Corallo)
29e6e23 Make ConnectTrace::blocksConnected private, hide behind accessors (Matt Corallo)
822000c Add pblock to connectTrace at the end of ConnectTip, not start (Matt Corallo)
f5e9a01 Include missing #include in zmqnotificationinterface.h (Matt Corallo)

Tree-SHA512: 8893d47559da3b28d2ef7359768547cba8a4b43b6f891d80f5848f995a84b1517bfb0f706fdc8cd43f09a1350349eb440d9724a59363ab517dfcc4fcb31b2018
2017-04-10 21:21:01 +02:00
Alex Morcos 68af651498 MOVEONLY: move TxConfirmStats to cpp 2017-04-10 13:56:50 -04:00
Alex Morcos 2332f19bef Initialize TxConfirmStats in constructor
and change to storing as a pointer.
2017-04-10 13:56:50 -04:00
Alex Morcos 5ba81e54e0 Read and Write fee estimate file directly from CBlockPolicyEstimator 2017-04-10 13:56:50 -04:00
Alex Morcos 14e10aa842 Call estimate(Smart)Fee directly from CBlockPolicyEstimator 2017-04-10 13:56:50 -04:00
Alex Morcos dbb9e3699b Give CBlockPolicyEstimator it's own lock 2017-04-10 13:51:51 -04:00
Alex Morcos f6187d6e39 Make processBlockTx private. 2017-04-10 13:51:51 -04:00
Alex Morcos ae7327b832 Make feeEstimator its own global instance of CBlockPolicyEstimator 2017-04-10 13:51:51 -04:00
KibbledJiveElkZoo 8c3e6c6987 Changed "Send" button default status from true to false
Changed the "Send" button's default status from true to false to prevent
quirky Windows autofocus behavior.
2017-04-10 11:52:18 -05:00
Wladimir J. van der Laan e183ea2047
Merge #10164: Wallet: reduce excess logic InMempool()
3491476 Wallet: reduce excess logic InMemPool() (Kewde)

Tree-SHA512: 554ea2827cfd482281fae0ba3d0a7989dbfeace98a35462732ea08bf3cc94c9564a9ea8ca2fa9905b963367d0b56a490ef0d83ceb6731c8f06187de98b6a7f23
2017-04-10 15:27:34 +02:00
Wladimir J. van der Laan e19586a8a9
Merge #10135: [p2p] Send the correct error code in reject messages
5d08c9c Send the correct error code in reject messages (John Newbery)

Tree-SHA512: 0cd3ef3ae202584b138cc0bbfba4125635822e0c5a755fb9276a604b39286959ab22dabc3104aa5d7e71358cd69d965de2a333ff04bf3e8ed43cf0296ac01264
2017-04-10 14:44:22 +02:00
Wladimir J. van der Laan a27dbc55b1
Merge #9949: [bench] Avoid function call arguments which are pointers to uninitialized values
218d915 [bench] Avoid function call arguments which are pointers to uninitialized values (practicalswift)

Tree-SHA512: 68d62e9442094f171433291b7f13dba20fc7ead5fd7f2292e1eb97ae51aa2345d40224c4a65c2e5d3552802b3cd0f675a82b6181cf5b77e964355650b25089f0
2017-04-10 14:19:55 +02:00
Wladimir J. van der Laan 51833a1734
Merge #10156: Fix for issues with startup and multiple monitors on windows.
e9ff818 Fix for issues with startup and multiple monitors on windows. (Allan Doensen)

Tree-SHA512: 8502042a9b5a2fd6f5e409163bee9bd7c85e34c158754f393065f8cc6cdd0f8505b9a1803069d01fc1fb2df04d1b2ed6291388851f2ed3608eb2dd53fc22e06e
2017-04-10 11:34:20 +02:00
Allan Doensen e9ff818b69 Fix for issues with startup and multiple monitors on windows. 2017-04-10 11:17:12 +02:00
Jonas Schnelli 1fa4ae67a3
Merge #9890: Add a button to open the config file in a text editor
9ab9e7d Add a button to open the config file in a text editor (Eric Shaw Jr)

Tree-SHA512: 1d13be9ac788a05a5116dbb3e1136ef65732dc2b5634547860612658109668922c9ea80b77bde4ba5beaa762d54f2a986a6064d4e34e963cdcd3d126a4eced37
2017-04-10 10:46:21 +02:00
practicalswift 9a763d4f86 Remove excess logic. 2017-04-10 10:24:49 +02:00
Wladimir J. van der Laan 813eacf81b
Merge #10167: [trivial] Fix typo ("improssible" → "impossible")
bcca57e [trivial] Fix typo ("improssible" → "impossible") (practicalswift)

Tree-SHA512: 87cdd0474b9e5d5150d3be7f93c61df126f7444f6e0cf34e763b25d68ad9149497535f34f7638eb42291a78d1ca2cff576014331151daedd26c57df5c31b9b0c
2017-04-10 09:27:25 +02:00
Wladimir J. van der Laan ed09dd3f5a
Merge #10142: Run bitcoin_test-qt under minimal QPA platform
bf10264 Run bitcoin_test-qt under minimal QPA platform (Russell Yanofsky)

Tree-SHA512: 35782f0d7e4dcdc27d991d5a10fcffbd2d201139293fe7917ef6f7cd7ae4d3a162ebc21f83266d821ae3bad86f62d947b047bb317f6c5899df4d6bcb4c957157
2017-04-10 09:01:58 +02:00
NicolasDorier fd44ac1e8b [Wallet] Rename std::pair<const CWalletTx*, unsigned int> to CInputCoin 2017-04-08 03:50:14 +00:00
John Newbery dd7e43e438 Fix build warning from #error text 2017-04-07 14:37:25 -04:00
practicalswift bcca57eff0 [trivial] Fix typo ("improssible" → "impossible") 2017-04-07 18:29:54 +02:00
Wladimir J. van der Laan a5fd746674
Merge #9681: Refactor Bumpfee, move core functionality to CWallet
5f59d3e Improve CFeeBumper interface, add comments, make use of std::move (Jonas Schnelli)
0df22ed Cancel feebump is vErrors is not empty (Jonas Schnelli)
44cabe6 Use static calls for GetRequiredFee and GetMinimumFee, remove make_pair from emplace_back (Jonas Schnelli)
bb78c15 Restore CalculateMaximumSignedTxSize function signature (Jonas Schnelli)
51ea44f Use "return false" instead assert() in CWallet::SignTransaction (Jonas Schnelli)
bcc72cc Directly abort execution in FeeBumper::commit if wallet or tx is not available (Jonas Schnelli)
2718db0 Restore invalid fee check (must be > 0) (Jonas Schnelli)
0337a39 Refactor Bumpfee core functionality (Jonas Schnelli)
d1a95e8 Bumpfee move request parameter interaction to the top (Jonas Schnelli)

Tree-SHA512: 0e6d1f3322ed671fa2291e59ac9556ce4646bc78267edc6eedc46b0014b7b08aa83c30315358b911d82898847d4845634a18b67e253a7b699dcc852eb2652c07
2017-04-07 15:51:26 +02:00
Wladimir J. van der Laan 928695bee6
Merge #10155: build: Deduplicate version numbers
9ff7818 doc: Update release process for simplified version bumping (Wladimir J. van der Laan)
08d9aee build: Remove duplicate version information from src/clientversion.h (Wladimir J. van der Laan)
168a703 doc: Make build system insert version in Doxyfile (Wladimir J. van der Laan)
b67eb8d doc: Remove version numbers from READMEs (Wladimir J. van der Laan)

Tree-SHA512: 531e44282b1c1383a382847a5605177917dfbf78acfaa754d1cbadd2e165c7e34ddbd01790f87615083fac359571708c2551ad24b712aab1f84a2068360c3a17
2017-04-07 15:41:04 +02:00
Wladimir J. van der Laan a3a2160b66
Merge #10162: [trivial] Log calls to getblocktemplate
1352092 Log calls to getblocktemplate (John Newbery)

Tree-SHA512: de2c6faac8baea2f63eb499dbcd0669062a71759050cf8bcada9b454fe82f056c23635d41c755badf55158ffc40a380f82bea1f40c8a2cc51604d981515b71eb
2017-04-07 14:55:29 +02:00
Matt Corallo b1a6d4cd56 Take a CTransactionRef in AddToWalletIfInvolvingMe to avoid a copy 2017-04-07 11:53:43 +02:00
Matt Corallo 1c95e2f9c9 Use std::shared_ptr instead of boost::shared_ptr in ScriptForMining 2017-04-07 11:53:43 +02:00
Matt Corallo 91f1e6ce5e Remove dead-code tracking of requests for blocks we generated 2017-04-07 11:53:43 +02:00
Matt Corallo acad82f375 Add override to functions using CValidationInterface methods 2017-04-07 11:53:43 +02:00
Matt Corallo e6d5e6cbbe Hold cs_wallet for whole block [dis]connection processing
This simplifies fixing the wallet-returns-stale-info issue as we
now hold cs_wallet across an entire block instead of only per-tx.
2017-04-07 11:53:43 +02:00
Matt Corallo 461e49fee2 SyncTransaction->TxAddedToMempool/BlockConnected/Disconnected
This simplifies fixing the wallet-returns-stale-info issue as we
can now hold cs_wallet across an entire block instead of only
per-tx (though we only actually do so in the next commit).

This change also removes the NOT_IN_BLOCK constant in favor of only
passing the CBlockIndex* parameter to SyncTransactions when a new
block is being connected, instead of also when a block is being
disconnected.

This change adds a parameter to BlockConnectedDisconnected which
lists the transactions which were removed from mempool due to
confliction as a result of this operation. While its somewhat of a
shame to make block-validation-logic generate a list of mempool
changes to be included in its generated callbacks, fixing this isnt
too hard.

Further in this change-set, CValidationInterface starts listening
to mempool directly, placing it in the middle and giving it a bit
of logic to know how to route notifications from block-validation,
mempool, etc (though not listening for conflicted-removals yet).
2017-04-07 11:53:43 +02:00
Matt Corallo f404334910 Handle SyncTransaction in ActivateBestChain instead of ConnectTrace
This makes a later change to move it all into one per-block callback
simpler.
2017-04-07 11:53:43 +02:00
Matt Corallo a1476877ce Keep conflictedTxs in ConnectTrace per-block 2017-04-07 11:53:43 +02:00
Matt Corallo d3167ba9bb Handle conflicted transactions directly in ConnectTrace 2017-04-07 11:53:42 +02:00
Matt Corallo 29e6e231c8 Make ConnectTrace::blocksConnected private, hide behind accessors 2017-04-07 11:53:42 +02:00
Matt Corallo 822000cf82 Add pblock to connectTrace at the end of ConnectTip, not start
This makes ConnectTip responsible for the ConnectTrace instead
of splitting the logic between ActivateBestChainStep and ConnectTip
2017-04-07 11:53:41 +02:00
Matt Corallo f5e9a019a4 Include missing #include in zmqnotificationinterface.h 2017-04-07 11:52:38 +02:00
Kewde 3491476b6f Wallet: reduce excess logic InMemPool()
removed the excess logic, return directly instead of using if-statement.
2017-04-07 00:53:12 +00:00
Wladimir J. van der Laan 8c28670e92
Merge #9902: Lightweight abstraction of boost::filesystem
f110272 Remove `namespace fs=fs` (Wladimir J. van der Laan)
75594bd torcontrol: Use fs::path instead of std::string for private key path (Wladimir J. van der Laan)
2a5f574 Use fsbridge for fopen and freopen (Wladimir J. van der Laan)
bac5c9c Replace uses of boost::filesystem with fs (Wladimir J. van der Laan)
7d5172d Replace includes of boost/filesystem.h with fs.h (Wladimir J. van der Laan)
19e36bb Add fs.cpp/h (Wladimir J. van der Laan)

Tree-SHA512: 2c34f059dfa6850b9323f3389e9090a6b5f839a457a2960d182c2ecfafd9883c956f5928bb796613402d3aad68ebc78259796a7a313f4a6cfa98aaf507a66842
2017-04-06 20:35:15 +02:00
John Newbery 1352092dbd Log calls to getblocktemplate 2017-04-06 10:37:30 -04:00
Wladimir J. van der Laan 08d9aee3eb build: Remove duplicate version information from src/clientversion.h
Fail when the version information is not defined otherwise when
HAVE_CONFIG_H is not set.
2017-04-06 10:41:34 +02:00
Wladimir J. van der Laan c7e73eafa1
Merge #10151: [logging] initialize flag variable to 0 (and continue if GetLogCategory() fails)
cd7f394 initialize flag variable to 0 (and continue if GetLogCategory() fails) (John Newbery)

Tree-SHA512: d0f2653bd0e71ed763220cb08d3a5335c5bdfe2f54ff7f9302d97f3265d7aa7f57606fe416a61aaac1535dbb046d0fb40a61f5a9d5cf234b042268e00ee7679d
2017-04-05 11:30:10 +02:00
Wladimir J. van der Laan 3c95bd43d8
Merge #10154: init: Remove redundant logging code
faafa80 init: Remove redundant logging code (MarcoFalke)

Tree-SHA512: 5ad0e9aba0e25a36025dd4ee5e5fddd2c0039f95bafd0f33300ea59e2f9bba807da6a1a8b4311d6aad5a360b99163edf4a4f161cb13f0f38580d8d6b504c94ad
2017-04-05 11:28:07 +02:00
Wladimir J. van der Laan fade78854c
Merge #10153: logging: Fix off-by-one for shrinkdebugfile default
faab624 logging: Fix off-by-one for shrinkdebugfile (MarcoFalke)

Tree-SHA512: d6153e06067906172ff0611af9e585a3ecf0a7d56925b6ad7c12e75aa802441047059b9b6f6c78e79916c3f2abc8f1998bfd2d5b84201ec6421f727c08da3c21
2017-04-05 09:23:58 +02:00
Wladimir J. van der Laan f93f9b9296
Merge #10144: Prioritisetransaction wasn't always updating ancestor fee
9bef02e Bugfix: ancestor modifed fees were incorrect for descendants (Suhas Daftuar)
ba7dd8b Test prioritisetransaction and ancestor fee state (Suhas Daftuar)

Tree-SHA512: 01977d88e1afb093a003f22a6f29ea60df3d70a179fe7e55910b9c8c340c4af9fb20cdc804c40235b62c43c453f0194eda0d0d4dbd365d2d98347f5dbe5de01c
2017-04-05 08:36:52 +02:00
Wladimir J. van der Laan 5fc6a77aa6
Merge #10133: Clean up calculations of pcoinsTip memory usage
1b55e07 Make threshold for flushing more conservative. (Alex Morcos)
f33afd3 Lower default memory footprint slightly (Alex Morcos)
5b95a19 Make pcoinsTip memory calculations consistent (Alex Morcos)

Tree-SHA512: d0061138596cf89008397b8729d9b25293938b1ad454cc99a6fe2f6210e94f76dfa78a8f0fce4c1ba3efec4e742a9c1a3ab26676a4a8346d3e7c3055d032669b
2017-04-05 08:10:43 +02:00
MarcoFalke faafa801e8 init: Remove redundant logging code 2017-04-05 01:03:26 +02:00
MarcoFalke faab6241d0 logging: Fix off-by-one for shrinkdebugfile 2017-04-05 00:42:48 +02:00
John Newbery cd7f39467a initialize flag variable to 0 (and continue if GetLogCategory() fails) 2017-04-04 14:59:35 -04:00
Wladimir J. van der Laan 72bc7e1303
Merge #10146: Better error handling for submitblock
30f30c0 Add braces to submitblock per current style. (Gregory Maxwell)
4f15ea1 Check transaction count early in submitblock. (Gregory Maxwell)
ada0caa Make GetWitnessCommitmentIndex callable on blocks without a coinbase txn. (Gregory Maxwell)

Tree-SHA512: 02dcd337ad9cdd8e4fa6a42c009d016026d1229c193676ed6fcc9ce55e924fedec57f516ac1e95c3db0985243ba908307338ce783a70416cb292bed881002bfc
2017-04-04 09:00:23 +02:00
Suhas Daftuar 9bef02e365 Bugfix: ancestor modifed fees were incorrect for descendants
If prioritisetransaction was called for a tx with in-mempool
descendants, the modified ancestor fee values for those descendants was
incorrect.
2017-04-03 15:50:15 -04:00
Wladimir J. van der Laan 471ed00fcd
Merge #10123: Allow debug logs to be excluded from specified component
3bde556 Add -debugexclude option to switch off logging for specified components (John Newbery)

Tree-SHA512: 30202e3f2085fc2fc5dd4bedb92988f4cb162c612a42cf8f6395a7da326f34975ddc347f82bc4ddca6c84c438dc0cc6e87869f90c7ff88105dbeaa52a947fa43
2017-04-03 17:42:40 +02:00
Russell Yanofsky bf1026412d Run bitcoin_test-qt under minimal QPA platform
Fixes broken "make check" reported by Matt Corallo <git@bluematt.me> in
https://github.com/bitcoin/bitcoin/issues/10110

Fix was suggested and initially implemented by
Cory Fields <cory-nospam-@coryfields.com> in
https://github.com/bitcoin/bitcoin/pull/10117#issuecomment-290275236
2017-04-03 11:07:40 -04:00
John Newbery 3bde556429 Add -debugexclude option to switch off logging for specified components 2017-04-03 09:04:42 -04:00
Wladimir J. van der Laan cb598cfba1
Merge #9533: Allow non-power-of-2 signature cache sizes
7482781 Allow non-power-of-2 signature cache sizes (Pieter Wuille)

Tree-SHA512: 5731c22b46c5ae81cf6d52000c28e39b243a47d96d91079942a5b5a10db214449217f71aa2195e18f8a3917cb206b04c75dc13e4522eb700a1dbf1819013ba22
2017-04-03 13:24:34 +02:00
Wladimir J. van der Laan f110272dc9 Remove `namespace fs=fs`
Having these inside functions is silly and redundant now.
2017-04-03 12:33:14 +02:00
Wladimir J. van der Laan 75594bd7f2 torcontrol: Use fs::path instead of std::string for private key path 2017-04-03 12:33:14 +02:00
Wladimir J. van der Laan 2a5f574762 Use fsbridge for fopen and freopen
Abstracts away how a path is opened to a `FILE*`.

Reduces the number of places where path is converted to a string
for anything else but printing.
2017-04-03 12:32:32 +02:00
Wladimir J. van der Laan bac5c9cf64 Replace uses of boost::filesystem with fs
Step two in abstracting away boost::filesystem.

To repeat this, simply run:
```
git ls-files \*.cpp \*.h | xargs sed -i 's/boost::filesystem/fs/g'
```
2017-04-03 12:32:32 +02:00
Wladimir J. van der Laan 7d5172d354 Replace includes of boost/filesystem.h with fs.h
This is step one in abstracting the use of boost::filesystem.
2017-04-03 12:32:32 +02:00
Wladimir J. van der Laan 19e36bbef6 Add fs.cpp/h 2017-04-03 12:32:32 +02:00
Wladimir J. van der Laan a2cd0b0eec
Merge #10058: No need to use OpenSSL malloc/free
6d5dd60 No need to use OpenSSL malloc/free (Thomas Snider)

Tree-SHA512: 29f790067ffd5a10a8e1a621318a0ba445691f57c804aa3b7c8ca372c8408d8c7fe703c42b48018e400fc32e3feff5ab401d97433910ce2c50e69da0b8a6662e
2017-04-03 12:06:02 +02:00
Gregory Maxwell 30f30c0f99 Add braces to submitblock per current style. 2017-04-03 07:23:07 +00:00
Gregory Maxwell 4f15ea102d Check transaction count early in submitblock.
There is no point in even hashing a submitted block which doesn't have
 a coinbase transaction.

This also results in more useful error reporting on corrupted input.

Thanks to rawodb for the bug report.
2017-04-03 07:15:36 +00:00
Gregory Maxwell ada0caa165 Make GetWitnessCommitmentIndex callable on blocks without a coinbase txn.
This isn't actually needed anywhere, but it's less brittle.
2017-04-02 21:28:17 +00:00
practicalswift 4b87973c32 [rpc] Remove auth cookie on shutdown
Accidentally removed in 40b556d374
2017-04-02 15:52:41 +02:00
Matthias Grundmann 31a14d4909
Correct indentation and remove unnecessary braces 2017-04-02 14:41:38 +02:00
Wladimir J. van der Laan 2b477e6aa1
Merge #10098: Make qt wallet test compatible with qt4
e9a6461 Make qt wallet test compatible with qt4 (Russell Yanofsky)

Tree-SHA512: a3e4598986cb3c5c20aaa1d440abc886d84fcc69a6ee4079787cfc8e3a2dce655060ff95612cb15ce8b5a9b8911e4afe2281345b59a4353ec32edf3771338381
2017-04-02 11:58:41 +02:00
Jonas Schnelli 5f59d3ecb7
Improve CFeeBumper interface, add comments, make use of std::move 2017-04-02 10:12:43 +02:00
Jonas Schnelli 0df22ed6fd
Cancel feebump is vErrors is not empty 2017-04-02 10:12:43 +02:00
Jonas Schnelli 44cabe6380
Use static calls for GetRequiredFee and GetMinimumFee, remove make_pair from emplace_back 2017-04-02 10:12:43 +02:00
Jonas Schnelli bb78c1599e
Restore CalculateMaximumSignedTxSize function signature 2017-04-02 10:12:43 +02:00
Jonas Schnelli 51ea44f01c
Use "return false" instead assert() in CWallet::SignTransaction 2017-04-02 10:12:43 +02:00
Jonas Schnelli bcc72cccc7
Directly abort execution in FeeBumper::commit if wallet or tx is not available 2017-04-02 10:12:42 +02:00
Jonas Schnelli 2718db0705
Restore invalid fee check (must be > 0) 2017-04-02 10:12:42 +02:00
Jonas Schnelli 0337a39d31
Refactor Bumpfee core functionality 2017-04-02 10:12:39 +02:00
Jonas Schnelli d1a95e8d3d
Bumpfee move request parameter interaction to the top 2017-04-02 09:48:48 +02:00
Wladimir J. van der Laan 427d2fd04e
Merge #10128: Speed Up CuckooCache tests
3f098cc Decrease testcase sizes in cuckoocache tests (Jeremy Rubin)

Tree-SHA512: 71a0e171be8d5473c791440aa4353d99b885b926b7284a3a1914c95e0c2c77925d5f3a6f329778cd81931a4e5832a082cb31d82ee8adb433d357d2e2b4f7a9e5
2017-04-02 09:04:03 +02:00
Gregory Maxwell 6b3bb3d9ba Change LogAcceptCategory to use uint32_t rather than sets of strings.
This changes the logging categories to boolean flags instead of strings.

This simplifies the acceptance testing by avoiding accessing a scoped
 static thread local pointer to a thread local set of strings.  It
 eliminates the only use of boost::thread_specific_ptr outside of
 lockorder debugging.

This change allows log entries to be directed to multiple categories
 and makes it easy to change the logging flags at runtime (e.g. via
 an RPC, though that isn't done by this commit.)

It also eliminates the fDebug global.

Configuration of unknown logging categories now produces a warning.
2017-04-01 18:53:29 +00:00
Wladimir J. van der Laan 351d0ad404
Merge #10129: scheduler: fix sub-second precision with boost < 1.50
e025246 scheduler: fix sub-second precision with boost < 1.50 (Cory Fields)

Tree-SHA512: b9d4875406c1a2bf3cb6412d7511c24d871bfba6a2ea5ccfbbf7392f2f8850027b001b776da422fea592878da21d897b1aa56d92bc2239869055dce79fd442ac
2017-04-01 12:25:56 +02:00
Alex Morcos 1b55e07b7a Make threshold for flushing more conservative.
Always leave a reasonable buffer of 50MB for usage from newly connected block (once over 50%) and increase the high water mark buffer to 200MB.
2017-03-31 14:30:31 -04:00
John Newbery 5d08c9c579 Send the correct error code in reject messages 2017-03-31 14:22:25 -04:00
Alex Morcos f33afd3b2b Lower default memory footprint slightly 2017-03-31 14:07:56 -04:00
Alex Morcos 5b95a190e8 Make pcoinsTip memory calculations consistent
Since we are more accurately measuring pcoinsTip peak usage at twice the current in dynamic usage, it makes sense to double the default (this will lead to the same effective usage and peak usage as previously).
We should also double the buffer used to avoid flushing if above 90% but still sufficient space remaining.
2017-03-31 13:15:39 -04:00
Cory Fields e025246fe2 scheduler: fix sub-second precision with boost < 1.50 2017-03-31 11:54:58 -04:00
Wladimir J. van der Laan 4aa07fa735
Merge #10095: refactor: Move GetDifficulty out of `rpc/server.h`
f885b67 refactor: Make rest.cpp dependency on `*toJSON` in `blockchain.cpp` explicit (Wladimir J. van der Laan)
8d8f28d refactor: Move RPCNotifyBlockChange out of `rpc/server.h` (Wladimir J. van der Laan)
e6dcfee refactor: Move GetDifficulty out of `rpc/server.h` (Wladimir J. van der Laan)

Tree-SHA512: fc2656611d18442f2fddba5ac1554d958151f6785c2039afdfc36735d7e71592d9686ff6cc7b2ad95180071d7514470e62c52d697c5a1e88f851bddaf5942edb
2017-03-31 12:57:30 +02:00
Wladimir J. van der Laan 9ab26bf7e4
Merge #10126: Compensate for memory peak at flush time
7228ce8 Compensate for memory peak at flush time (Pieter Wuille)

Tree-SHA512: 97e9848410fab061402c85d8440c54a50dd8a0203b2ea194013ea116700a6dc1b4b26b8c5f9c9c68c1f5c6b935c5d6c737437c1911b003d9ff5445c570cd449d
2017-03-31 12:06:14 +02:00
Wladimir J. van der Laan ba12b3a844
Merge #10120: util: Work around (virtual) memory exhaustion on 32-bit w/ glibc
625488a util: Work around (virtual) memory exhaustion on 32-bit w/ glibc (Wladimir J. van der Laan)

Tree-SHA512: 99b610a8cf9561998af90e16fc19320fddd30c987e8f33325d63df0f56d70235b94d9482e80f28154d4b33a3ecf4961686380c444ec18d1da5e8804a8b6f4de1
2017-03-31 11:30:59 +02:00
Wladimir J. van der Laan de301b0488
Merge #10130: bitcoin-tx input verification (awemany, jnewbery)
19ecd1e Add tests for bitcoin-tx input checking (John Newbery)
21704f6 Check stderr when testing bitcoin-tx (John Newbery)
eb66bf9 bitcoin-tx: Fix missing range check (Awemany)

Tree-SHA512: 08c6153cf7dd5e0ecd23e24d81af4c0f17534d484179dd91dcd78d42df14c91284341d31cc695469a64c507bce72c34231748b7cabb7df8f1051d228fb0a62c5
2017-03-31 10:21:38 +02:00
Awemany eb66bf9bdd bitcoin-tx: Fix missing range check
The number of arguments is not checked MutateTxAddOutAddr(..), meaning
that

> ./bitcoin-tx -create outaddr=

accessed the vStrInputParts vector beyond its bounds.

This also includes work by jnewbery to check the inputs for
MutateTxAddPubKey()
2017-03-30 15:35:24 -04:00
Jeremy Rubin 3f098cccf6 Decrease testcase sizes in cuckoocache tests 2017-03-30 15:30:45 -04:00
Pieter Wuille 7228ce853d Compensate for memory peak at flush time 2017-03-30 12:05:05 -07:00
Wladimir J. van der Laan cde9b1a864
Merge #9959: Mining: Prevent slowdown in CreateNewBlock on large mempools
011124a Update benchmarking with package statistics (Suhas Daftuar)
42cd8c8 Add benchmarking for CreateNewBlock (Suhas Daftuar)
eed816a Mining: return early when block is almost full (Suhas Daftuar)

Tree-SHA512: c0d8f71e4e0441acf3f4ca12f8705e413b59b323659346a447145653def71710537fb4c6d80cad8e36d68b0aabf19c92e9eab7135a8897b053ed58720856cdda
2017-03-30 20:55:29 +02:00
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