Commit graph

8557 commits

Author SHA1 Message Date
Gregory Sanders 0b2294a980 SelectCoinsMinConf: Prefer coins with fewer ancestors 2016-12-13 09:41:04 -05:00
Wladimir J. van der Laan 26fe5c98ab
Merge #9326: Update for OpenSSL 1.1 API.
b05b1af Fix qt/paymentrequestplus.cpp for OpenSSL 1.1 API. (Gregory Maxwell)
bae1eef Fix wallet/test/crypto_tests.cpp for OpenSSL 1.1 API. (Gregory Maxwell)
2016-12-13 12:22:30 +01:00
Wladimir J. van der Laan 5233aefa3f
Merge #9305: Refactor: Removed begin/end_ptr functions.
8c1dbc5 Refactor: Removed begin/end_ptr functions. (Karl-Johan Alm)
2016-12-13 12:21:18 +01:00
Wladimir J. van der Laan cfd5e6b1dc
Merge #9334: Update to latest libsecp256k1
7b49f22 Squashed 'src/secp256k1/' changes from 7a49cac..8225239 (Pieter Wuille)
2016-12-13 12:16:47 +01:00
Wladimir J. van der Laan b6abdc77d3
Merge #9302: Return txid even if ATMP fails for new transaction
b3a7410 Return txid even if ATMP fails for new transaction (Pieter Wuille)
2016-12-13 12:15:27 +01:00
Luke Dashjr 6a32c0f69d
Qt/Test: Check handling of empty arguments in RPC debug console 2016-12-13 09:18:13 +01:00
Jonas Schnelli 89c8d2c12c
[Qt] Console: allow empty arguments 2016-12-13 09:17:35 +01:00
Richard Kiss e49a252bae Fix spelling. 2016-12-12 16:06:59 -05:00
Gregory Maxwell b05b1af10b Fix qt/paymentrequestplus.cpp for OpenSSL 1.1 API.
This avoids a compile failure on newly installed debian stretch systems.
2016-12-12 19:24:34 +00:00
Pieter Wuille 547a53d135 Update libsecp256k1 to master 2016-12-12 11:08:47 -08:00
Pieter Wuille 7b49f22bdb Squashed 'src/secp256k1/' changes from 7a49cac..8225239
8225239 Merge #433: Make the libcrypto detection fail the newer API.
12de863 Make the libcrypto detection fail the newer API.
2928420 Merge #427: Remove Schnorr from travis as well
8eecc4a Remove Schnorr from travis as well
a8abae7 Merge #310: Add exhaustive test for group functions on a low-order subgroup
b4ceedf Add exhaustive test for verification
83836a9 Add exhaustive tests for group arithmetic, signing, and ecmult on a small group
20b8877 Add exhaustive test for group functions on a low-order subgroup
80773a6 Merge #425: Remove Schnorr experiment
e06e878 Remove Schnorr experiment
04c8ef3 Merge #407: Modify parameter order of internal functions to match API parameter order
6e06696 Merge #411: Remove guarantees about memcmp-ability
40c8d7e Merge #421: Update scalar_4x64_impl.h
a922365 Merge #422: Restructure nonce clearing
3769783 Restructure nonce clearing
0f9e69d Restructure nonce clearing
9d67afa Update scalar_4x64_impl.h
7d15cd7 Merge #413: fix auto-enabled static precompuatation
00c5d2e fix auto-enabled static precompuatation
91219a1 Remove guarantees about memcmp-ability
353c1bf Fix secp256k1_ge_set_table_gej_var parameter order
541b783 Fix secp256k1_ge_set_all_gej_var parameter order
7d893f4 Fix secp256k1_fe_inv_all_var parameter order

git-subtree-dir: src/secp256k1
git-subtree-split: 8225239f490f79842a5a3b82ad6cc8aa11d5208e
2016-12-12 11:08:47 -08:00
Jonas Schnelli ed6b377ae2
[Qt] Console: add security warning 2016-12-12 15:58:40 +01:00
Gregory Maxwell bae1eef752 Fix wallet/test/crypto_tests.cpp for OpenSSL 1.1 API.
This avoids a compile failure on newly installed debian stretch systems.
2016-12-12 08:10:27 +00:00
MarcoFalke faf4ca84e4 [wallet] Disable free transactions when relay is disabled 2016-12-10 17:45:23 +01:00
Pieter Wuille a1dcf2e108
Merge #9240: Remove txConflicted
a874ab5 remove internal tracking of mempool conflicts for reporting to wallet (Alex Morcos)
bf663f8 remove external usage of mempool conflict tracking (Alex Morcos)
2016-12-09 16:31:03 -08:00
Pieter Wuille d38b0d7a6b
Merge #9307: Remove undefined FetchCoins method declaration
fe41f58 Remove undefined FetchCoins method declaration (Russell Yanofsky)
2016-12-09 16:21:28 -08:00
Pieter Wuille 815640ec6a
Merge #9295: [Wallet] Bugfix: Fundrawtransaction: don't terminate when keypool is empty
1a6eacb [QA] add fundrawtransaction test on a locked wallet with empty keypool (Jonas Schnelli)
c24a4f5 [Wallet] Bugfix: FRT: don't terminate when keypool is empty (Jonas Schnelli)
2016-12-09 16:14:54 -08:00
Alex Morcos 01fea7a048 If we don't allow free txs, always send a fee filter 2016-12-09 15:25:46 -05:00
Alex Morcos 5f0e27f1a8 Increase mempool expiry time to 2 weeks 2016-12-09 14:39:04 -05:00
Alex Morcos 06329393c7 Flush wallet after abandontransaction 2016-12-09 13:36:42 -05:00
Karl-Johan Alm 8c1dbc5e9d Refactor: Removed begin/end_ptr functions. 2016-12-09 13:15:19 +09:00
Pieter Wuille 760765d5a9 Update ctaes 2016-12-08 17:09:07 -08:00
Alex Morcos f8d43b8081 Avoid rollingMinimumFeeRate never being able to decay below half 2016-12-08 15:40:14 -05:00
Alex Morcos eab8e1b172 fix a bug if the min fee is 0 for FeeFilterRounder 2016-12-08 15:40:14 -05:00
BtcDrak c5c92c46fb
Update python tests for default tx version=2 2016-12-08 20:12:00 +00:00
BtcDrak dab207e4e6
Preserve tx version=1 for certain tests
Without this change, the tests would be affected by default
tx version increases.
2016-12-08 20:11:51 +00:00
Alex Morcos c5d746ace7
tiny test fix for mempool_tests 2016-12-08 20:11:39 +00:00
BtcDrak 1f0ca1ae1c
Bump default transaction version to 2 2016-12-08 20:11:27 +00:00
Pieter Wuille b3a74100b8 Return txid even if ATMP fails for new transaction 2016-12-08 11:55:32 -08:00
jonnynewbs d29505db22 Fix transaction size comments. Size now refers to virtual size as defined in BIP141. 2016-12-08 17:03:57 +00:00
Wladimir J. van der Laan 86017842d6
Merge #9291: Remove mapOrphanTransactionsByPrev from DoS_tests
819ca3f Remove mapOrphanTransactionsByPrev from DoS_tests (Pieter Wuille)
2016-12-08 08:38:15 +01:00
Wladimir J. van der Laan 9851a8461d
Merge #9255: qt: layoutAboutToChange signal is called layoutAboutToBeChanged
f36349e qt: Remove on_toggleNetworkActiveButton_clicked from RPCConsole (Wladimir J. van der Laan)
297cc20 qt: layoutAboutToChange signal is called layoutAboutToBeChanged (Wladimir J. van der Laan)
2016-12-08 08:14:16 +01:00
Wladimir J. van der Laan 2044e37beb
Merge #9266: Bugfix: Qt/RPCConsole: Put column enum in the right places
df17fe0 Bugfix: Qt/RPCConsole: Put column enum in the right places (Luke Dashjr)
2016-12-08 08:13:15 +01:00
Russell Yanofsky fe41f58365 Remove undefined FetchCoins method declaration 2016-12-07 15:41:56 -05:00
Alex Morcos b919179cbb remove no longer needed check for premature v2 txs 2016-12-07 09:58:20 -05:00
Wladimir J. van der Laan f36349e898 qt: Remove on_toggleNetworkActiveButton_clicked from RPCConsole
There is no network toggle button (anymore?) in the RPC console.
Removes another warning (#9250).
2016-12-07 05:55:16 +01:00
Pieter Wuille 09c4fd157c
Merge #9268: Fix rounding privacy leak introduced in #9260
9b9324e Fix rounding privacy leak introduced in #9260 (Matt Corallo)
2016-12-06 13:33:01 -08:00
Alex Morcos 28f8ae8adf Fix missed change to WalletTx structure 2016-12-06 08:56:12 -05:00
Jonas Schnelli c24a4f5981
[Wallet] Bugfix: FRT: don't terminate when keypool is empty 2016-12-06 13:45:56 +01:00
Jonas Schnelli e15660c16f
Merge #9280: [Qt] Show ModalOverlay by pressing the progress bar, allow hiding
89a3723 [Qt] Show ModalOverlay by pressing the progress bar, disabled show() in sync mode (Jonas Schnelli)
2016-12-06 13:03:33 +01:00
Gregory Maxwell f692fce8a4 Make RelayWalletTransaction attempt to AcceptToMemoryPool.
This resolves an issue where a wallet transaction which failed to
 relay previously because it couldn't make it into the mempool
 will not try again until restart, even though mempool conditions
 may have changed.

Abandoned and known-conflicted transactions are skipped.

Some concern was expressed that there may be users with many
 unknown conflicts would waste a lot of CPU time trying to
 add them to their memory pools over and over again.  But I am
 doubtful these users exist in any number, if they do exist
 they have worse problems, and they can mitigate any performance
 issue this might have by abandoning the transactions in question.
2016-12-06 08:01:27 +00:00
Pieter Wuille 80d073c9bc Complain when unknown rpcserialversion is specified 2016-12-05 23:26:32 -08:00
Pieter Wuille 819ca3f18e Remove mapOrphanTransactionsByPrev from DoS_tests
This is another violation of the one definition rule, as the type
for mapOrphanTransactionsByPrev did not match the one in
net_processing.cpp anymore. As it now depends on a custom Iterator,
it seems too much hassle to correctly expose it to the tests.
Instead, this commit just removes the one test it was referenced in.
2016-12-05 23:04:50 -08:00
Russell Yanofsky 07df40babb [test] Add CCoinsViewCache Access/Modify/Write tests
Add more comprehensive unit tests for CCoinsViewCache. Right now it is hard to
refactor caching code or fix bugs in the caching logic because you have to try
to mentally enumerate all the different states the cache might be in to make
sure a change doesn't cause unintended consequences. The new tests explicitly
enumerate relevant cache states, documenting and verifying the behavior in each
state, so it will be safer and easier to make changes to the caching code in
the future.
2016-12-05 18:30:46 -05:00
Alex Morcos a874ab5ccf remove internal tracking of mempool conflicts for reporting to wallet 2016-12-05 13:41:25 -05:00
Alex Morcos bf663f8e93 remove external usage of mempool conflict tracking 2016-12-05 13:41:25 -05:00
Jonas Schnelli 89a3723bdc
[Qt] Show ModalOverlay by pressing the progress bar, disabled show() in sync mode 2016-12-05 13:58:00 +01:00
instagibbs 412bab22b2 Adapt ZMQ/rest serialization to take rpcserialversion arg 2016-12-05 07:43:22 -05:00
Gregory Sanders bc7ff8db99 Add option to return non-segwit serialization via rpc 2016-12-05 07:43:22 -05:00
Wladimir J. van der Laan 7d5d44969b
Merge #9282: CMutableTransaction is defined as struct
c4b6fa8 CMutableTransaction is defined as struct. (Pavel Janík)
2016-12-05 12:55:03 +01:00
Wladimir J. van der Laan c01f16aaa0
Merge #9165: SendMoney: use already-calculated balance
ea83d00 SendMoney: use already-calculated balance (instagibbs)
2016-12-05 12:47:31 +01:00
Pavel Janík c4b6fa8edf CMutableTransaction is defined as struct. 2016-12-05 11:13:17 +01:00
Wladimir J. van der Laan 43e8150ef6
Merge #9269: Align struct COrphan definition
2efc438 Align struct COrphan definition (Pieter Wuille)
2016-12-05 11:09:26 +01:00
Wladimir J. van der Laan 613bda418f
Merge #8613: LevelDB 1.19
634ad51 Squashed 'src/leveldb/' changes from 20ca81f..a31c8aa (Pieter Wuille)
2016-12-05 10:58:36 +01:00
Pieter Wuille 2efc43874c Align struct COrphan definition 2016-12-05 00:35:07 -08:00
Pieter Wuille f6fb7acda4 Move CTxInWitness inside CTxIn 2016-12-04 23:47:12 -08:00
Wladimir J. van der Laan d04aebaec7
Merge #9014: Fix block-connection performance regression
dd0df81 Document ConnectBlock connectTrace postconditions (Matt Corallo)
2d6e561 Switch pblock in ProcessNewBlock to a shared_ptr (Matt Corallo)
2736c44 Make the optional pblock in ActivateBestChain a shared_ptr (Matt Corallo)
ae4db44 Create a shared_ptr for the block we're connecting in ActivateBCS (Matt Corallo)
fd9d890 Keep blocks as shared_ptrs, instead of copying txn in ConnectTip (Matt Corallo)
6fdd43b Add struct to track block-connect-time-generated info for callbacks (Matt Corallo)
2016-12-05 08:07:45 +01:00
Wladimir J. van der Laan 46904ee5d2
Merge #8580: Make CTransaction actually immutable
81e3228 Make CTransaction actually immutable (Pieter Wuille)
42fd8de Make DecodeHexTx return a CMutableTransaction (Pieter Wuille)
c3f5673 Make CWalletTx store a CTransactionRef instead of inheriting (Pieter Wuille)
a188353 Switch GetTransaction to returning a CTransactionRef (Pieter Wuille)
2016-12-05 08:05:48 +01:00
Jonas Schnelli 4d955fc582
Merge #9218: qt: Show progress overlay when clicking spinner icon
042f9fa qt: Show progress overlay when clicking spinner icon (Wladimir J. van der Laan)
827d9a3 qt: Replace NetworkToggleStatusBarControl with generic ClickableLabel (Wladimir J. van der Laan)
2016-12-04 20:57:57 +01:00
Matt Corallo a13fa4c80f Remove unused CDiskBlockPos* argument from ProcessNewBlock 2016-12-04 00:23:17 -08:00
Matt Corallo dd0df81ebd Document ConnectBlock connectTrace postconditions 2016-12-04 00:18:44 -08:00
Matt Corallo 2d6e5619af Switch pblock in ProcessNewBlock to a shared_ptr
This (finally) fixes a performance regression in
b3b3c2a562
2016-12-04 00:17:30 -08:00
Matt Corallo 2736c44c8e Make the optional pblock in ActivateBestChain a shared_ptr 2016-12-04 00:13:09 -08:00
Matt Corallo ae4db44d03 Create a shared_ptr for the block we're connecting in ActivateBCS 2016-12-04 00:13:09 -08:00
Matt Corallo fd9d89070a Keep blocks as shared_ptrs, instead of copying txn in ConnectTip 2016-12-04 00:13:09 -08:00
Matt Corallo 6fdd43b968 Add struct to track block-connect-time-generated info for callbacks 2016-12-04 00:13:09 -08:00
Alex Morcos dfbe0d530f Add unstored orphans with rejected parents to recentRejects 2016-12-03 08:38:20 -05:00
Gregory Maxwell 749be013f5 Move GetWarnings() into its own file. 2016-12-03 07:17:34 +00:00
Gregory Maxwell e3ba0ef956 Eliminate data races for strMiscWarning and fLargeWork*Found.
This moves all access to these datastructures through accessor functions
 and protects them with a lock.
2016-12-03 07:17:34 +00:00
Gregory Maxwell c63198f1c7 Make QT runawayException call GetWarnings instead of directly access strMiscWarning.
This is a first step in avoiding racy accesses to strMiscWarning.

The change required moving GetWarnings and related globals to util.
2016-12-03 07:17:28 +00:00
Matt Corallo 9b9324ee49 Fix rounding privacy leak introduced in #9260 2016-12-02 21:30:36 -08:00
Pieter Wuille 81e3228fcb Make CTransaction actually immutable 2016-12-02 18:37:43 -08:00
Pieter Wuille 42fd8dee30 Make DecodeHexTx return a CMutableTransaction 2016-12-02 18:28:22 -08:00
Pieter Wuille c3f5673a63 Make CWalletTx store a CTransactionRef instead of inheriting 2016-12-02 18:28:22 -08:00
Pieter Wuille a1883536b4 Switch GetTransaction to returning a CTransactionRef 2016-12-02 18:28:22 -08:00
Pieter Wuille 2efcfa5acf
Merge #9260: Mrs Peacock in The Library with The Candlestick (killed main.{h,cpp})
76faa3c Rename the remaining main.{h,cpp} to validation.{h,cpp} (Matt Corallo)
e736772 Move network-msg-processing code out of main to its own file (Matt Corallo)
87c35f5 Remove orphan state wipe from UnloadBlockIndex. (Matt Corallo)
2016-12-02 18:25:40 -08:00
MarcoFalke c36229b0b2
Merge #9251: Improvement of documentation of command line parameter 'whitelist'
8a70a9d Improvement of documentation of command line parameter 'whitelist' (wodry)
2016-12-02 20:34:06 +01:00
Matt Corallo 76faa3cdfe Rename the remaining main.{h,cpp} to validation.{h,cpp} 2016-12-02 09:42:51 -08:00
Matt Corallo e736772c56 Move network-msg-processing code out of main to its own file 2016-12-02 09:42:51 -08:00
MarcoFalke 5412c08c3c
Merge #9223: unification of Bloom filter representation
b7aa290 unification of Bloom filter representation (S. Matthew English)
2016-12-02 15:58:57 +01:00
Luke Dashjr df17fe046f Bugfix: Qt/RPCConsole: Put column enum in the right places
QModelIndex::data argument is a role, not a column
2016-12-02 13:51:14 +00:00
Wladimir J. van der Laan fe37fbe606 bitcoin-cli: Make error message less confusing
Sorry for the churn on this, but the current message (introduced in #9073)
isn't acceptable:

    $ src/bitcoin-cli getinfo
    rpc: couldn't connect to server
    (make sure server is running and you are connecting to the correct RPC port: -1 unknown)

Putting the error code after the words "RPC port" made me wonder whether
there was a port configuration issue.

This changes it to:

    $ src/bitcoin-cli getinfo
    error: couldn't connect to server: unknown (code -1)
    (make sure server is running and you are connecting to the correct RPC port)
2016-12-02 08:55:18 +01:00
Wladimir J. van der Laan 3fbf079262
Merge #9239: Disable fee estimates for 1 block target
e878689 Make GUI incapable of setting tx confirm target of 1 (Alex Morcos)
d824ad0 Disable fee estimates for a confirm target of 1 block (Alex Morcos)
2016-12-02 08:21:06 +01:00
Wladimir J. van der Laan c4d22f6eb2
Merge #9229: Remove calls to getaddrinfo_a
10ae7a7 Revert "Use async name resolving to improve net thread responsiveness" (Matt Corallo)
2016-12-02 05:48:45 +01:00
Pieter Wuille 605d701471 Merge in LevelDB 1.19 changes 2016-12-01 16:14:45 -08:00
Matt Corallo 87c35f5843 Remove orphan state wipe from UnloadBlockIndex.
As orphan state is now "network state", like in
d6ea737be1,

UnloadBlockIndex is only used during init if we end up reindexing
to clear our block state so that we can start over. However, at
that time no connections have been brought up as CConnman hasn't
been started yet, so all of the network processing state logic is
empty when its called.
2016-12-01 16:08:34 -08:00
Pieter Wuille dc6dee41f7
Merge #9183: Final Preparation for main.cpp Split
2c8c57e Document cs_main status when calling into PNB or PNBH (Matt Corallo)
58a215c Use ProcessNewBlockHeaders in CMPCTBLOCK processing (Matt Corallo)
a8b936d Use exposed ProcessNewBlockHeaders from ProcessMessages (Matt Corallo)
63fd101 Split ::HEADERS processing into two separate cs_main locks (Matt Corallo)
4a6b1f3 Expose AcceptBlockHeader through main.h (Matt Corallo)
2016-12-01 16:07:25 -08:00
Matt Corallo 10ae7a7b23 Revert "Use async name resolving to improve net thread responsiveness"
This reverts commit caf6150e97.

getaddrinfo_a has a nasty tendency to segfault internally in its
background thread, on every version of glibc I tested, especially
under helgrind.

See https://sourceware.org/bugzilla/show_bug.cgi?id=20874
2016-12-01 14:32:44 -08:00
Pieter Wuille ad826b3df9
Merge #9188: Make orphan parent fetching ask for witnesses.
5b0150a Make orphan parent fetching ask for witnesses. (Gregory Maxwell)
2016-12-01 13:34:49 -08:00
Pieter Wuille c1a5227684
Merge #9253: Fix calculation of number of bound sockets to use
9e1f468 Fix calculation of number of bound sockets to use (Matt Corallo)
2016-12-01 13:07:08 -08:00
Matt Corallo 2c8c57e72f Document cs_main status when calling into PNB or PNBH 2016-12-01 11:03:32 -08:00
Matt Corallo 58a215ce8c Use ProcessNewBlockHeaders in CMPCTBLOCK processing 2016-12-01 11:03:31 -08:00
Matt Corallo a8b936df20 Use exposed ProcessNewBlockHeaders from ProcessMessages 2016-12-01 11:03:31 -08:00
Wladimir J. van der Laan c79e52ad30
Merge #9230: Fix some benign races in timestamp logging
8b22efb Make fStartedNewLine an std::atomic_bool (Matt Corallo)
507145d Fix race when accessing std::locale::classic() (Matt Corallo)
2016-12-01 11:47:47 +01:00
Wladimir J. van der Laan 297cc20e70 qt: layoutAboutToChange signal is called layoutAboutToBeChanged
This was misnamed, resulting in a warning message and missing
functionality. I'm not sure what the change in behavior will be here,
this needs testing.

Also remove connection to non-existing slot "test".
This was used for testing if the signal arrived. It is no
longer necessary.

Fixes:

    2016-12-01 10:04:06 GUI: QObject::connect: No such signal PeerTableModel::layoutAboutToChange() in qt/rpcconsole.cpp:518
    2016-12-01 10:04:06 GUI: QObject::connect:  (receiver name: 'RPCConsole')
    2016-12-01 10:04:06 GUI: QObject::connect: No such slot RPCConsole::test() in qt/rpcconsole.cpp:781
    2016-12-01 10:04:06 GUI: QObject::connect:  (receiver name: 'RPCConsole')
2016-12-01 11:45:07 +01:00
Matt Corallo 9e1f46821d Fix calculation of number of bound sockets to use 2016-11-30 18:56:08 -08:00
Pieter Wuille 3bf06e9bac
Merge #9226: Remove fNetworkNode and pnodeLocalHost.
bdb922b Remove pnodeLocalHost. (Gregory Maxwell)
083f203 Remove fNetworkNode. (Gregory Maxwell)
2016-11-30 17:15:58 -08:00
Pieter Wuille 72ae6f8cf0
Merge #9244: Trivial refactor: Remove extern keyword from function declarations
446a8f9 Trivial refactor: Remove extern keyword from function declarations, as they are extern by default. (Karl-Johan Alm)
2016-11-30 16:15:20 -08:00
Pieter Wuille a143b88dbd
Merge #9010: Split up AppInit2 into multiple phases, daemonize after datadir lock errors
deec83f init: Get rid of fServer flag (Wladimir J. van der Laan)
16ca0bf init: Try to aquire datadir lock before and after daemonization (Wladimir J. van der Laan)
0cc8b6b init: Split up AppInit2 into multiple phases (Wladimir J. van der Laan)
2016-11-30 16:11:14 -08:00
wodry 8a70a9da3d Improvement of documentation of command line parameter 'whitelist' 2016-11-30 21:40:21 +01:00
Wladimir J. van der Laan 56bee4986d
Merge #9234: torcontrol: Explicitly request RSA1024 private key
7d3b627 torcontrol: Explicitly request RSA1024 private key (Wladimir J. van der Laan)
2016-11-30 12:45:16 +01:00
Karl-Johan Alm 446a8f9c90 Trivial refactor: Remove extern keyword from function declarations, as they are extern by default. 2016-11-30 10:27:21 +09:00
Alex Morcos e878689e55 Make GUI incapable of setting tx confirm target of 1 2016-11-29 12:49:03 -05:00
Alex Morcos d824ad030e Disable fee estimates for a confirm target of 1 block 2016-11-29 12:18:44 -05:00
Wladimir J. van der Laan deec83fd2c init: Get rid of fServer flag
There is no need to store this flag globally, the variable is only used
inside the initialization process.

Thanks to Alex Morcos for the idea.
2016-11-29 12:47:13 +01:00
Wladimir J. van der Laan 16ca0bfd28 init: Try to aquire datadir lock before and after daemonization
Before daemonization, just probe the data directory lock and print an
early error message if possible.

After daemonization get the data directory lock again and hold on to it until exit
This creates a slight window for a race condition to happen, however this condition is harmless: it
will at most make us exit without printing a message to console.

    $ src/bitcoind -testnet -daemon
    Bitcoin server starting
    $ src/bitcoind -testnet -daemon
    Error: Cannot obtain a lock on data directory /home/orion/.bitcoin/testnet3. Bitcoin Core is probably already running.
2016-11-29 12:47:13 +01:00
Wladimir J. van der Laan 0cc8b6bc44 init: Split up AppInit2 into multiple phases
This allows doing some of the steps before e.g. daemonization and some
fater.
2016-11-29 12:47:13 +01:00
Wladimir J. van der Laan e56cf67e6b
Merge #9202: bench: Add support for measuring CPU cycles
3532818 bench: Add support for measuring CPU cycles (Wladimir J. van der Laan)
2016-11-29 12:41:33 +01:00
Wladimir J. van der Laan 5488514b90
Merge #9225: Fix some benign races
dfed983 Fix unlocked access to vNodes.size() (Matt Corallo)
3033522 Remove double brackets in addrman (Matt Corallo)
dbfaade Fix AddrMan locking (Matt Corallo)
047ea10 Make fImporting an std::atomic (Matt Corallo)
42071ca Make fDisconnect an std::atomic (Matt Corallo)
2016-11-29 12:39:33 +01:00
Wladimir J. van der Laan 0a0441358c
Merge #9224: Prevent FD_SETSIZE error building on OpenBSD
498a1d7 Include select.h when WIN32 is not defined (Ivo van der Sangen)
2016-11-29 12:37:39 +01:00
Ivo van der Sangen 498a1d75e7 Include select.h when WIN32 is not defined 2016-11-29 12:35:41 +01:00
Wladimir J. van der Laan 7d3b627395 torcontrol: Explicitly request RSA1024 private key
When generating a new service key, explicitly request a RSA1024 one.

The bitcoin P2P protocol has no support for the longer hidden service names
that will come with ed25519 keys, until it does, we depend on the old
hidden service type so make this explicit.

See #9214.
2016-11-28 17:18:46 +01:00
fsb4000 15fa95d7e5 Fix some typos 2016-11-28 16:16:37 +07:00
Matt Corallo 8b22efb6f7 Make fStartedNewLine an std::atomic_bool
While this doesnt really fix the race of adding timestamps
mid-logical-line, it avoids the undefined behavior of using a
bool in multiple threads.
2016-11-27 15:36:44 -08:00
Matt Corallo 507145d785 Fix race when accessing std::locale::classic()
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78552
2016-11-27 15:36:44 -08:00
Gregory Maxwell bdb922b34c Remove pnodeLocalHost.
Mostly a legacy of the long removed pub/sub system.
2016-11-27 04:19:37 +00:00
Gregory Maxwell 083f203698 Remove fNetworkNode.
Matt pointed out to me that this appeared to be doing nothing (except involving itself in data races).
2016-11-27 04:13:54 +00:00
Matt Corallo dfed983f19 Fix unlocked access to vNodes.size() 2016-11-26 15:42:55 -08:00
Matt Corallo 303352286f Remove double brackets in addrman 2016-11-26 15:42:55 -08:00
Matt Corallo dbfaade72a Fix AddrMan locking 2016-11-26 15:42:55 -08:00
Matt Corallo 047ea1052d Make fImporting an std::atomic 2016-11-26 15:42:48 -08:00
S. Matthew English b7aa2902fd unification of Bloom filter representation
Output instances of "BloomFilter" changed to "Bloom filter", in accordance with Wikipedia standard notation: 

https://en.wikipedia.org/wiki/Bloom_filter

also to sync with the majority of cases in the self-same file
2016-11-26 14:57:19 +01:00
Matt Corallo 42071ca264 Make fDisconnect an std::atomic 2016-11-25 18:03:12 -08:00
Pieter Wuille 76fec09d87
Merge #9128: net: Decouple CConnman and message serialization
c7be56d net: push only raw data into CConnman (Cory Fields)
2ec935d net: add CVectorWriter and CNetMsgMaker (Cory Fields)
b7695c2 net: No need to check individually for disconnection anymore (Cory Fields)
fedea8a net: don't send any messages before handshake or after requested disconnect (Cory Fields)
d74e352 net: Set feelers to disconnect at the end of the version message (Cory Fields)
2016-11-25 11:18:23 -08:00
Cory Fields c7be56dcef net: push only raw data into CConnman
This fixes one of the last major layer violations in the networking stack.

The network side is no longer in charge of message serialization, so it is now
decoupled from Bitcoin structures. Only the header is serialized and attached
to the payload.
2016-11-25 12:37:33 -05:00
Cory Fields 2ec935dcaa net: add CVectorWriter and CNetMsgMaker
CVectorWriter is useful for overwriting or appending an existing byte vector.

CNetMsgMaker is a shortcut for creating messages on-the-fly which are suitable
for pushing to CConnman.
2016-11-25 12:09:58 -05:00
Cory Fields b7695c2275 net: No need to check individually for disconnection anymore 2016-11-25 12:09:58 -05:00
MarcoFalke e22f409f18
Merge #9220: Refactor: Stop using namespace std (bitcoin-cli/-tx).
2f2625a Removed using namespace std from bitcoin-cli/-tx and added std:: in appropriate places. (Karl-Johan Alm)
2016-11-25 11:35:53 +01:00
MarcoFalke 97ec6e5c90
Merge #9100: tx_valid: re-order inputs to how they are encoded
5262a15 tx_valid: re-order inputs to how they are encoded (Daniel Cousens)
2016-11-25 10:38:19 +01:00
Karl-Johan Alm 2f2625a0bb Removed using namespace std from bitcoin-cli/-tx and added std:: in appropriate places. 2016-11-25 17:17:57 +09:00
Wladimir J. van der Laan d932159f34
Merge #9189: Always add default_witness_commitment with GBT client support
95f4a03 [qa] Test getblocktemplate default_witness_commitment (Suhas Daftuar)
ad04d1c Always add default_witness_commitment with GBT client support (Pieter Wuille)
2016-11-25 08:26:25 +01:00
Wladimir J. van der Laan 042f9fa071 qt: Show progress overlay when clicking spinner icon
Bring up the modal progress overlay when the user clicks the spinner
icon in the task bar.

I think this is the intuitive thing to do when that icon is clicked.
2016-11-24 14:37:36 +01:00
Wladimir J. van der Laan 827d9a3be8 qt: Replace NetworkToggleStatusBarControl with generic ClickableLabel
Generalize the clickable label functionality.

We will use this to add similar functionality to the sync icon.
2016-11-24 14:35:03 +01:00
MarcoFalke bc121b0eb1
Merge #9216: Doc: Fix copypasted comment
f26da35 Fix copypasted comment. (Pavel Janík)
2016-11-24 14:00:34 +01:00
fanquake e3c4f7e182
Correct help output for waitfor RPC commands 2016-11-24 19:50:07 +08:00
Wladimir J. van der Laan db5e22e053
Merge #9190: qt: Plug many memory leaks
ed998ea qt: Avoid OpenSSL certstore-related memory leak (Wladimir J. van der Laan)
5204598 qt: Avoid shutdownwindow-related memory leak (Wladimir J. van der Laan)
e4f126a qt: Avoid splash-screen related memory leak (Wladimir J. van der Laan)
693384e qt: Prevent thread/memory leak on exiting RPCConsole (Wladimir J. van der Laan)
47db075 qt: Plug many memory leaks (Wladimir J. van der Laan)
2016-11-24 12:17:39 +01:00
Pavel Janík f26da35142 Fix copypasted comment. 2016-11-24 12:12:57 +01:00
Cory Fields fedea8a14d net: don't send any messages before handshake or after requested disconnect
Also, send reject messages earlier in SendMessages(), so that disconnections are
processed earlier.

These changes combined should ensure that no message is ever sent after
fDisconnect is set.
2016-11-23 19:53:28 -05:00
Cory Fields d74e352e01 net: Set feelers to disconnect at the end of the version message
This way we're not relying on messages going out after fDisconnect has been
set.

This should not cause any real behavioral changes, though feelers should
arguably disconnect earlier in the process. That can be addressed in a later
functional change.
2016-11-23 19:53:28 -05:00
Matt Corallo 63fd101c52 Split ::HEADERS processing into two separate cs_main locks
This will allow NotifyHeaderTip to be called from an
AcceptBlockHeader wrapper function without holding cs_main.
2016-11-23 16:29:38 -08:00
Matt Corallo 4a6b1f36b7 Expose AcceptBlockHeader through main.h 2016-11-23 16:29:38 -08:00
Pieter Wuille 93566e0c37
Merge #8930: Move orphan processing to ActivateBestChain
d2b88f9 Move orphan-conflict removal from main logic into a callback (Matt Corallo)
97e2802 Erase orphans per-transaction instead of per-block (Matt Corallo)
ec4525c Move orphan processing to ActivateBestChain (Matt Corallo)
2016-11-23 16:27:16 -08:00
Pieter Wuille 407d9232ef
Merge #9199: Always drop the least preferred HB peer when adding a new one.
ca8549d Always drop the least preferred HB peer when adding a new one. (Gregory Maxwell)
2016-11-23 16:14:21 -08:00
Matt Corallo d2b88f97a1 Move orphan-conflict removal from main logic into a callback
This makes the orphan map a part of net-processing logic instead
of main logic.
2016-11-23 12:29:26 -08:00
Wladimir J. van der Laan ed998ea7a0 qt: Avoid OpenSSL certstore-related memory leak
- Correctly manage the X509 and X509_STORE objects lifetime.
2016-11-23 12:33:37 +01:00
Wladimir J. van der Laan 5204598f8d qt: Avoid shutdownwindow-related memory leak
Store a reference to the shutdown window on BitcoinApplication,
so that it will be deleted when exiting the main loop.
2016-11-23 12:33:36 +01:00
Wladimir J. van der Laan e4f126a7ba qt: Avoid splash-screen related memory leak
Make splash screen queue its own deletion when it receives the finished
command, instead of relying on WA_DeleteOnClose which doesn't work under
these circumstances.
2016-11-23 12:33:36 +01:00
Wladimir J. van der Laan 693384eedb qt: Prevent thread/memory leak on exiting RPCConsole
Make ownership of the QThread object clear, so that the RPCConsole
can wait for the executor thread to quit before shutdown is called. This
increases overall thread safety, and prevents some objects from leaking
on exit.
2016-11-23 12:33:36 +01:00
Wladimir J. van der Laan 47db075377 qt: Plug many memory leaks
None of these are very serious, and are leaks in objects that are
created at most one time.

In most cases this means properly using the QObject parent hierarchy,
except for BanTablePriv/PeerTablePriv which are not QObject,
so use a std::unique_ptr instead.
2016-11-23 12:33:35 +01:00
Wladimir J. van der Laan 74ced54b7e
Merge #9204: Clarify CreateTransaction error messages
918b126 fix CreateTransaction error messages (instagibbs)
2016-11-23 08:42:06 +01:00
Wladimir J. van der Laan 5e8631b6cb
Merge #9205: Minor change to comment for consistency.
f004e67 Minor change to comment above new NODE_WITNESS service flag to keep it consitent with existing comment structure. Helps with readability. (Greg Walker)
2016-11-23 08:41:12 +01:00
Wladimir J. van der Laan 7e2bfd6241
Merge #9196: Send tip change notification from invalidateblock
67c6326 Send tip change notification from invalidateblock (Russell Yanofsky)
2016-11-23 08:40:20 +01:00
Wladimir J. van der Laan 791b58d148
Merge #8690: Do not fully sort all nodes for addr relay
a33b169 Do not fully sort all nodes for addr relay (Pieter Wuille)
2016-11-23 08:19:57 +01:00
Wladimir J. van der Laan 5ea5e0401c
Merge #9141: Remove unnecessary calls to CheckFinalTx
4512550 Remove unnecessary calls to CheckFinalTx (Jonas Schnelli)
2016-11-23 07:24:43 +01:00
Wladimir J. van der Laan 40022fe5f2
Merge #9142: Move -salvagewallet, -zap(wtx) to where they belong
2e44893 Move -salvagewallet, -zap(wtx) to where they belong (Jonas Schnelli)
2016-11-23 07:18:24 +01:00
Wladimir J. van der Laan 4d8558a287
Merge #9025: getrawtransaction should take a bool for verbose
240189b add testcases for getrawtransaction (John Newbery)
ce2bb23 getrawtransaction should take a bool for verbose (jnewbery)
2016-11-23 07:13:46 +01:00
Greg Walker f004e67df3 Minor change to comment above new NODE_WITNESS service flag to keep it consitent with existing comment structure. Helps with readability. 2016-11-22 18:59:20 +00:00
instagibbs 918b126901 fix CreateTransaction error messages 2016-11-22 13:40:57 -05:00
jnewbery ce2bb23aa5 getrawtransaction should take a bool for verbose 2016-11-22 14:37:33 +00:00
Jonas Schnelli ac489b2445
Merge #9130: Mention the new network toggle functionality in the tooltip.
1260c11 Mention the new network toggle functionality in the tooltip. (Pavel Janík)
2016-11-22 15:32:45 +01:00
Wladimir J. van der Laan 3532818746 bench: Add support for measuring CPU cycles
This adds cycle min/max/avg to the statistics.

Supported on x86 and x86_64 (natively through rdtsc), as well as Linux
(perf syscall).
2016-11-22 12:20:57 +01:00
Wladimir J. van der Laan e0a9cb25b0 bench: Fix subtle counting issue when rescaling iteration count
Make sure that the count is a zero modulo the new mask before
scaling, otherwise the next time until a measure triggers
will take only 1/2 as long as accounted for. This caused
the 'min time' to be potentially off by as much as 100%.
2016-11-22 10:01:41 +01:00
Jonas Schnelli e4dbeb9499
Merge #9185: [Qt] fix coincontrol sort issue
4231032 [Qt] Clean up and fix coincontrol tree widget handling (Wladimir J. van der Laan)
76af4eb [Qt] fix coincontrol sort issue (Jonas Schnelli)
2016-11-22 08:30:58 +01:00
Gregory Maxwell ca8549d2bd Always drop the least preferred HB peer when adding a new one.
When a BIP152 HB-mode peer is in the least preferred position and
 disconnects, they will not be by ForNode on the next loop. They
 will continue to sit in that position and prevent deactivating
 HB mode for peers that are still connected.

There is no reason for them to stay in the list if already gone,
 so drop the first element unconditionally if there are too many.

Fixes issue #9163.
2016-11-22 02:54:32 +00:00
Pieter Wuille ad04d1cb35 Always add default_witness_commitment with GBT client support 2016-11-21 15:01:04 -08:00
Wladimir J. van der Laan 0c577f2638
Merge #8872: Remove block-request logic from INV message processing
037159c Remove block-request logic from INV message processing (Matt Corallo)
3451203 [qa] Respond to getheaders and do not assume a getdata on inv (Matt Corallo)
d768f15 [qa] Make comptool push blocks instead of relying on inv-fetch (mrbandrews)
2016-11-21 15:41:32 +01:00
Wladimir J. van der Laan 210891143b
Merge #8837: allow bitcoin-tx to parse partial transactions
7451cf5 Allow bitcoin-tx to parse partial transactions (jnewbery)
2016-11-21 15:33:19 +01:00
Wladimir J. van der Laan b9a87b459d
Merge #9179: Set DEFAULT_LIMITFREERELAY = 0 kB/minute
fa7cc5a Set DEFAULT_LIMITFREERELAY = 0 kB/minute (MarcoFalke)
2016-11-21 15:27:48 +01:00
Wladimir J. van der Laan c3906403c8
Merge #9117: net: don't send feefilter messages before the version handshake is complete
4662553 net: don't send feefilter messages before the version handshake is complete (Cory Fields)
2016-11-21 11:51:03 +01:00
Wladimir J. van der Laan 4231032bfc
[Qt] Clean up and fix coincontrol tree widget handling
- Do sorting for date, amount and confirmations column as longlong, not
  unsigned longlong.
- Use `UserRole` to store our own data. This makes it treated as
  ancillary data prevents it from being displayed.
- Get rid of `getMappedColumn` `strPad` - these are no longer necessary.
- Get rid of hidden `_INT64` columns.
- Start enumeration from 0 (otherwise values are undefined).
2016-11-20 20:18:24 +01:00
Pieter Wuille b4e4ba475a Introduce convenience type CTransactionRef 2016-11-19 17:53:23 -08:00
Pieter Wuille 1662b437b3 Make CBlock::vtx a vector of shared_ptr<CTransaction> 2016-11-19 17:51:09 -08:00
Pieter Wuille da60506fc8 Add deserializing constructors to CTransaction and CMutableTransaction 2016-11-19 17:50:40 -08:00
Pieter Wuille 0e85204a10 Add serialization for unique_ptr and shared_ptr 2016-11-19 17:50:35 -08:00
Wladimir J. van der Laan ce612f1750
Merge #9186: test: Fix use-after-free in scheduler tests
12519bf test: Fix use-after-free in scheduler tests (Wladimir J. van der Laan)
2016-11-19 16:18:38 +01:00
Gregory Maxwell 5b0150a060 Make orphan parent fetching ask for witnesses.
In 0.13 orphan transactions began being treated as implicit
 INVs for their parents.  But the resulting getdata were
 not getting the witness flag.

This fixes issue #9182 reported by chjj and roasbeef on IRC.
2016-11-18 19:11:08 +00:00
Wladimir J. van der Laan 12519bf62b test: Fix use-after-free in scheduler tests
Make a copy of the boost time-point to wait for, otherwise the head of
the queue may be deleted by another thread while this one is waiting,
while the boost function still has a reference to it.

Although this problem is in non-test code, this is not an actual problem
outside of the tests because we use the thread scheduler with only one
service thread, so there will never be threads fighting at the head of
the queue.

The old boost fallback escapes this problem because it passes a scalar
value to wait_until instead of a const object reference.

Found by running the tests in LLVM-4.0-master asan.
2016-11-18 13:10:52 +01:00
Jonas Schnelli 76af4eb876
[Qt] fix coincontrol sort issue 2016-11-18 11:09:29 +01:00
Matt Corallo 97e28029c9 Erase orphans per-transaction instead of per-block 2016-11-17 17:10:00 -08:00
Matt Corallo ec4525ccc1 Move orphan processing to ActivateBestChain
This further decouples "main" and "net" processing logic by moving
orphan processing out of the chain-connecting cs_main lock and
into its own cs_main lock, beside all of the other chain callbacks.

Once further decoupling of net and main processing logic occurs,
orphan handing should move to its own lock, out of cs_main.

Note that this will introduce a race if there are any cases where
we assume the orphan map to be consistent with the current chain
tip, however I am confident there is no such case (ATMP will fail
without DoS score in all such cases).
2016-11-17 17:10:00 -08:00
MarcoFalke fa7cc5a508 Set DEFAULT_LIMITFREERELAY = 0 kB/minute 2016-11-18 00:23:25 +01:00
Pieter Wuille 9346f84299
Merge #9075: Decouple peer-processing-logic from block-connection-logic (#3)
ae22357 Replace CValidationState param in ProcessNewBlock with BlockChecked (Matt Corallo)
7c98ce5 Remove pfrom parameter from ProcessNewBlock (Matt Corallo)
e2e069d Revert "RPC: Give more details when "generate" fails" (Matt Corallo)
2016-11-17 13:23:50 -08:00
Wladimir J. van der Laan f6db48ad1c
Merge #8838: Calculate size and weight of block correctly in CreateNewBlock()
5f274a1 log block size and weight correctly. (jnewbery)
2016-11-17 14:14:51 +01:00
MarcoFalke cb2ed300a8
Merge #9155: [trivial] update comments for tx weight
07ede5d update comments for tx weight (Brian Deery)
2016-11-16 11:05:40 +01:00
Wladimir J. van der Laan 434e683f7b
Merge #9133: Unset fImporting for loading mempool
79f755d Unset fImporting for loading mempool (Alex Morcos)
2016-11-16 10:11:41 +01:00
Wladimir J. van der Laan 62af164638
Merge #9131: fNetworkActive is not protected by a lock, use an atomic
079142b fNetworkActive is not protected by a lock, use an atomic (Jonas Schnelli)
2016-11-16 10:09:52 +01:00
Pieter Wuille 6eeac6e30d
Merge #9164: [trivial] credit values are CAmount
20c3215 credit values are CAmount (Gregory Sanders)
2016-11-15 09:44:07 -08:00
instagibbs ea83d0098a SendMoney: use already-calculated balance 2016-11-15 11:56:45 -05:00
Gregory Sanders 20c3215a90 credit values are CAmount 2016-11-15 09:19:23 -05:00
Wladimir J. van der Laan 018a4eb120
Merge #9140: Bugfix: Correctly replace generated headers and fail cleanly
b74ff5c Bugfix: Correctly replace generated headers and fail cleanly (Luke Dashjr)
2016-11-15 10:34:56 +01:00
Wladimir J. van der Laan f54e4605fc
Merge #9132: Make strWalletFile const
f734505 Make strWalletFile const (Jonas Schnelli)
2016-11-15 10:06:01 +01:00
Wladimir J. van der Laan 770364b8ea
Merge #9160: [trivial] Fix hungarian variable name
ec34648 [trivial] Fix hungarian variable name (Russell Yanofsky)
2016-11-15 09:52:14 +01:00
Russell Yanofsky ec34648766 [trivial] Fix hungarian variable name
Follow up to comment https://github.com/bitcoin/bitcoin/pull/9058#discussion_r87676593
2016-11-14 14:02:24 -05:00
Brian Deery 07ede5d711 update comments for tx weight 2016-11-14 00:38:07 -06:00
MarcoFalke fa42e4a082 [qt] Make network disabled icon 50% opaque 2016-11-13 22:06:35 +01:00
Jonas Schnelli 4512550fa0
Remove unnecessary calls to CheckFinalTx 2016-11-12 13:50:39 +01:00
Pavel Janík 1260c1103b Mention the new network toggle functionality in the tooltip. 2016-11-12 13:28:21 +01:00
Jonas Schnelli 2e44893081
Move -salvagewallet, -zap(wtx) to where they belong 2016-11-12 10:25:34 +01:00
Luke Dashjr b74ff5cf0c Bugfix: Correctly replace generated headers and fail cleanly
Also removes generation of headers for *.raw files in test_bitcoin (none exist anymore)
2016-11-12 07:16:28 +00:00
Alex Morcos 79f755db41 Unset fImporting for loading mempool 2016-11-11 09:33:16 -05:00
Jonas Schnelli f7345050e9
Make strWalletFile const 2016-11-11 14:32:38 +01:00
Jonas Schnelli 079142b757
fNetworkActive is not protected by a lock, use an atomic 2016-11-11 14:09:52 +01:00
Luke Dashjr 5394b3940d Wallet: Split main logic from InitLoadWallet into CreateWalletFromFile 2016-11-11 11:35:49 +00:00
Luke Dashjr fb0c934d1b Wallet: Let the interval-flushing thread figure out the filename 2016-11-11 11:35:49 +00:00
Wladimir J. van der Laan 87ab49e4fe
Merge #9124: Use better name for local variable to prevent -Wshadow compiler warning
bf49f10 Use better name for local variable to prevent -Wshadow compiler warning (Pavel Janík)
2016-11-11 11:46:49 +01:00
Jonas Schnelli ab914a6530
Merge #8996: Network activity toggle
19f46f1 Qt: New network_disabled icon (Luke Dashjr)
54cf997 RPC/Net: Use boolean consistently for networkactive, and remove from getinfo (Luke Dashjr)
b2b33d9 Overhaul network activity toggle (Jonas Schnelli)
32efa79 Qt: Add GUI feedback and control of network activity state. (Jon Lund Steffensen)
e38993b RPC: Add "togglenetwork" method to toggle network activity temporarily (Jon Lund Steffensen)
7c9a98a Allow network activity to be temporarily suspended. (Jon Lund Steffensen)
2016-11-11 11:16:40 +01:00
Wladimir J. van der Laan 7977a1157a
Merge #9058: Fixes for p2p-compactblocks.py test timeouts on travis (#8842)
dac53b5 Modify getblocktxn handler not to drop requests for old blocks (Russell Yanofsky)
55bfddc [qa] Fix stale data bug in test_compactblocks_not_at_tip (Russell Yanofsky)
47e9659 [qa] Fix bug in compactblocks v2 merge (Russell Yanofsky)
2016-11-11 11:02:44 +01:00
Wladimir J. van der Laan 46027e8668
Merge #9112: Avoid ugly exception in log on unknown inv type
e9f25dd Avoid ugly exception in log on unknown inv type (Wladimir J. van der Laan)
2016-11-11 10:58:58 +01:00
Pavel Janík bf49f107ef Use better name for local variable to prevent -Wshadow compiler warning 2016-11-10 21:38:07 +01:00
Wladimir J. van der Laan 71bc39eb74
Merge #9049: Remove duplicatable duplicate-input check from CheckTransaction
e2b3fb3 Optimize vInOutPoints insertion a bit (Matt Corallo)
eecffe5 Remove redundant duplicate-input check from CheckTransaction (Matt Corallo)
b2e178a Add deserialize + CheckBlock benchmarks, and a full block hex (Matt Corallo)
2016-11-10 16:02:55 +01:00
MarcoFalke 4a2b170c07
Merge #9122: fix getnettotals RPC description about timemillis.
a79f864 fix getnettotals RPC description about timemillis. (Masahiko Hyuga)
2016-11-10 11:05:59 +01:00
Wladimir J. van der Laan aab102cbae
Merge #9121: Initialize variable to prevent compiler warning
bdcba6d Initialize variable to prevent compiler warning (Pavel Janík)
2016-11-10 10:35:07 +01:00
Wladimir J. van der Laan 537e0cb252
Merge #9120: bug: Missed one "return false" in recent refactoring in #9067
45d372f Missed one "return false" in recent refactoring in #9067 (UdjinM6)
2016-11-10 10:30:54 +01:00
Masahiko Hyuga a79f864945 fix getnettotals RPC description about timemillis. 2016-11-10 18:18:52 +09:00
Pavel Janík bdcba6d933 Initialize variable to prevent compiler warning 2016-11-10 08:11:51 +01:00
UdjinM6 45d372f889 Missed one "return false" in recent refactoring in #9067 2016-11-10 00:53:55 +03:00
Wladimir J. van der Laan fb156100f9
Merge #9111: Remove unused variable UNLIKELY_PCT from fees.h
d8edf03 Remove unused var UNLIKELY_PCT from fees.h (fanquake)
2016-11-09 21:54:56 +01:00
Matt Corallo e2b3fb349e Optimize vInOutPoints insertion a bit 2016-11-09 11:28:41 -08:00
Matt Corallo eecffe50ef Remove redundant duplicate-input check from CheckTransaction 2016-11-09 11:28:00 -08:00
Matt Corallo b2e178a2d2 Add deserialize + CheckBlock benchmarks, and a full block hex 2016-11-09 11:27:59 -08:00
Matt Corallo ae22357607 Replace CValidationState param in ProcessNewBlock with BlockChecked 2016-11-09 11:21:55 -08:00
Matt Corallo 7c98ce584e Remove pfrom parameter from ProcessNewBlock
This further decouples ProcessNewBlock from networking/peer logic.
2016-11-09 11:21:45 -08:00
Cory Fields 46625538d6 net: don't send feefilter messages before the version handshake is complete 2016-11-09 12:45:13 -05:00
Wladimir J. van der Laan e81df49644
Merge #9039: Various serialization simplifcations and optimizations
d59a518 Use fixed preallocation instead of costly GetSerializeSize (Pieter Wuille)
25a211a Add optimized CSizeComputer serializers (Pieter Wuille)
a2929a2 Make CSerAction's ForRead() constexpr (Pieter Wuille)
a603925 Avoid -Wshadow errors (Pieter Wuille)
5284721 Get rid of nType and nVersion (Pieter Wuille)
657e05a Make GetSerializeSize a wrapper on top of CSizeComputer (Pieter Wuille)
fad9b66 Make nType and nVersion private and sometimes const (Pieter Wuille)
c2c5d42 Make streams' read and write return void (Pieter Wuille)
50e8a9c Remove unused ReadVersion and WriteVersion (Pieter Wuille)
2016-11-09 13:52:04 +01:00
Wladimir J. van der Laan e9f25ddd00 Avoid ugly exception in log on unknown inv type
It is unexpected behavior for `ToString` to raise an exception. It
is expected to do a best-effort attempt at formatting but never fail.

Catch the exception and simply print unknown inv types as hexadecimal.

Fixes #9110.
2016-11-09 11:16:39 +01:00
Wladimir J. van der Laan e9847303e7
Merge #8874: Multiple Selection for peer and ban tables
1077577 Fix auto-deselection of peers (Andrew Chow)
addfdeb Multiple Selection for peer and ban tables (Andrew Chow)
2016-11-09 11:05:15 +01:00
fanquake d8edf03db7
Remove unused var UNLIKELY_PCT from fees.h 2016-11-09 17:51:27 +08:00
Matt Corallo e2e069dabc Revert "RPC: Give more details when "generate" fails"
This only returned information in the case of CheckBlock failure,
but breaks future changes.
2016-11-08 17:39:44 -08:00
Andrew Chow 1077577546 Fix auto-deselection of peers 2016-11-08 15:11:25 -05:00
Jorge Timón 1adf82ac39
RPC: Give more details when "generate" fails 2016-11-08 15:08:56 +01:00
Andrew Chow addfdebe1a Multiple Selection for peer and ban tables
Allows multiple selection and action for the nodes in the peer and ban tables in the Debug Window.
2016-11-08 08:50:04 -05:00
Wladimir J. van der Laan 4e5782438c
Merge #9088: Reduce ambiguity of warning message
77cbbd9 Make warning message about wallet balance possibly being incorrect less ambiguous. (R E Broadley)
2016-11-08 11:05:08 +01:00
Wladimir J. van der Laan f53023dbb8
Merge #9067: Fix exit codes
4441018 Every main()/exit() should return/use one of EXIT_ codes instead of magic numbers (UdjinM6)
bd0de13 Fix exit codes: - `--help`, `--version` etc should exit with `0` i.e. no error ("not enough args" case should still trigger an error) - error reading config file should exit with `1` (UdjinM6)
2016-11-08 10:55:03 +01:00
Jonas Schnelli b8f43e3331
Merge #9095: test: Fix test_random includes
fa8278e test: Fix test_random includes (MarcoFalke)
2016-11-08 08:41:57 +01:00
Pieter Wuille dc6b9406bd
Merge #9026: Fix handling of invalid compact blocks
d4833ff Bump the protocol version to distinguish new banning behavior. (Suhas Daftuar)
88c3549 Fix compact block handling to not ban if block is invalid (Suhas Daftuar)
c93beac [qa] Test that invalid compactblocks don't result in ban (Suhas Daftuar)
2016-11-07 18:11:18 -08:00
Daniel Cousens 5262a151e1 tx_valid: re-order inputs to how they are encoded 2016-11-08 11:58:39 +11:00
Matt Corallo 037159cebf Remove block-request logic from INV message processing 2016-11-07 17:41:00 -05:00
Pieter Wuille 9f554e03eb
Merge #9045: Hash P2P messages as they are received instead of at process-time
fe1dc62 Hash P2P messages as they are received instead of at process-time (Matt Corallo)
2016-11-07 14:19:44 -08:00
Pieter Wuille d59a518466 Use fixed preallocation instead of costly GetSerializeSize
Dbwrapper used GetSerializeSize() to compute the size of the buffer
to preallocate. For some cases (specifically: CCoins) this requires
a costly compression call. Avoid this by just using fixed size
preallocations instead.
2016-11-07 13:56:27 -08:00
Pieter Wuille 25a211aa9e Add optimized CSizeComputer serializers
To get the advantages of faster GetSerializeSize() implementations
back that were removed in "Make GetSerializeSize a wrapper on top of
CSizeComputer", reintroduce them in the few places in the form of a
specialized Serialize() implementation. This actually gets us in a
better state than before, as these even get used when they're invoked
indirectly in the serialization of another object.
2016-11-07 13:56:27 -08:00
Pieter Wuille a2929a26f5 Make CSerAction's ForRead() constexpr
The CSerAction's ForRead() method does not depend on any runtime
data, so guarantee that requests to it can be optimized out by
making it constexpr.

Suggested by Cory Fields.
2016-11-07 13:56:27 -08:00
Pieter Wuille a603925c77 Avoid -Wshadow errors
Suggested by Pavel Janik.
2016-11-07 13:56:27 -08:00
Pieter Wuille 528472111b Get rid of nType and nVersion
Remove the nType and nVersion as parameters to all serialization methods
and functions. There is only one place where it's read and has an impact
(in CAddress), and even there it does not impact any of the recursively
invoked serializers.

Instead, the few places that need nType or nVersion are changed to read
it directly from the stream object, through GetType() and GetVersion()
methods which are added to all stream classes.
2016-11-07 13:56:27 -08:00
Pieter Wuille 657e05ab2e Make GetSerializeSize a wrapper on top of CSizeComputer
Given that in default GetSerializeSize implementations created by
ADD_SERIALIZE_METHODS we're already using CSizeComputer(), get rid
of the specialized GetSerializeSize methods everywhere, and just use
CSizeComputer. This removes a lot of code which isn't actually used
anywhere.

For CCompactSize and CVarInt this actually removes a more efficient
size computing algorithm, which is brought back in a later commit.
2016-11-07 13:56:22 -08:00
Pieter Wuille fad9b66504 Make nType and nVersion private and sometimes const
Make the various stream implementations' nType and nVersion private
and const (except in CDataStream where we really need a setter).
2016-11-07 13:49:11 -08:00
Russell Yanofsky dac53b58b5 Modify getblocktxn handler not to drop requests for old blocks
The current getblocktxn implementation drops and ignores requests for old
blocks, which causes occasional sync_block timeouts during the
p2p-compactblocks.py test as reported in
https://github.com/bitcoin/bitcoin/issues/8842.

The p2p-compactblocks.py test setup creates many new blocks in a short
period of time, which can lead to getblocktxn requests for blocks below the
hardcoded depth limit of 10 blocks. This commit changes the getblocktxn
handler not to ignore these requests, so the peer nodes in the test setup
will reliably be able to sync.

The protocol change is documented in BIP-152 update "Allow block responses
to getblocktxn requests" at https://github.com/bitcoin/bips/pull/469.

The protocol change is not expected to affect nodes running outside the test
environment, because there shouldn't normally be lots of new blocks being
rapidly added that need to be synced.
2016-11-07 14:35:11 -05:00
UdjinM6 4441018d08 Every main()/exit() should return/use one of EXIT_ codes instead of magic numbers 2016-11-07 21:31:38 +03:00
Pieter Wuille c2c5d42f36 Make streams' read and write return void
The stream implementations had two cascading layers (the upper one
with operator<< and operator>>, and a lower one with read and write).
The lower layer's functions are never cascaded (nor should they, as
they should only be used from the higher layer), so make them return
void instead.
2016-11-07 09:39:46 -08:00
Pieter Wuille 50e8a9ccd7 Remove unused ReadVersion and WriteVersion
CDataStream and CAutoFile had a ReadVersion and WriteVersion method
that was never used. Remove them.
2016-11-07 09:39:46 -08:00
MarcoFalke fa8278e845 test: Fix test_random includes 2016-11-07 16:11:51 +01:00