Commit graph

1070 commits

Author SHA1 Message Date
Wladimir J. van der Laan dc58258adf Introduce REJECT_INTERNAL codes for local AcceptToMempool errors
Add status codes specific to AcceptToMempool procession of transactions.
These can never happen due to block validation, and must never be sent
over the P2P network. Add assertions where appropriate.
2015-08-11 17:29:33 +02:00
Wladimir J. van der Laan a0625b8085
Merge pull request #5913
5922b67 Add assertion and cast before sending reject code (Wladimir J. van der Laan)
a651403 Add absurdly high fee message to validation state (for RPC propagation) (Shaul Kfir)
2015-08-05 19:12:48 +02:00
Wladimir J. van der Laan 5922b6774e Add assertion and cast before sending reject code
This gets rid of a warning. Add an assertion to make sure that the
reject code is in the correct range for the network protocol
(if it is outside the range it must be a bug)
2015-08-05 19:02:19 +02:00
Wladimir J. van der Laan c384800027
Merge pull request #6462
7b79cbd limit total length of user agent comments (Pavol Rusnak)
557f8ea implement uacomment config parameter which can add comments to user agent as per BIP-0014 (Pavol Rusnak)
2015-08-05 15:43:10 +02:00
Pavol Rusnak 7b79cbd722 limit total length of user agent comments
Reworked-By: Wladimir J. van der Laan <laanwj@gmail.com>
2015-08-05 09:38:20 +02:00
Wladimir J. van der Laan 219b916545
Merge pull request #6498
a8d0407 Move recentRejects initialization to top of InitBlockIndex (Wladimir J. van der Laan)
0847d9c Keep track of recently rejected transactions (Peter Todd)
d741371 Only use randomly created nonces in CRollingBloomFilter. (Pieter Wuille)
d2d7ee0 Make CRollingBloomFilter set nTweak for you (Peter Todd)
a3d65fe Reuse vector hashing code for uint256 (Pieter Wuille)
bbe4108 Add uint256 support to CRollingBloomFilter (Peter Todd)
2015-08-03 20:13:43 +02:00
Wladimir J. van der Laan f18b8ec7cf Make sure LogPrintf strings are line-terminated
Fix the cases where LogPrint[f] was accidentally called without line
terminator, which resulted in concatenated log lines.

(see e.g. #6492)
2015-08-03 17:40:55 +02:00
Wladimir J. van der Laan a8d0407c4f Move recentRejects initialization to top of InitBlockIndex
This avoids that premature return in the condition that a new chain is initialized
results in NULL pointer errors due to recentReject not being constructed.

Also add assertions where it is used.
2015-07-31 17:58:12 +02:00
Wladimir J. van der Laan 675d2feffa
Merge pull request #6224
59b49cd Eliminate signed/unsigned comparison warning (Suhas Daftuar)
04b5d23 Replace sleep with syncing using pings (Suhas Daftuar)
6b1066f Ignore whitelisting during IBD for unrequested blocks. (Suhas Daftuar)
bfc30b3 Ignore unrequested blocks too far ahead of tip (Suhas Daftuar)
2015-07-29 20:04:15 +02:00
Peter Todd 0847d9cb5f
Keep track of recently rejected transactions
Nodes can have divergent policies on which transactions they will accept
and relay.  This can cause you to repeatedly request and reject the same
tx after its inved to you from various peers which have accepted it.
Here we add rolling bloom filter to keep track of such rejections,
clearing the filter every time the chain tip changes.

Credit goes to Alex Morcos, who created the patch that this code is
based on.

Original code by Peter Todd. Refactored to not construct the
filter at startup time by Pieter Wuille.
2015-07-28 15:50:13 -04:00
Pieter Wuille eddaba7b56
Revert "Cache transaction validation successes"
This reverts commit 17b11428c1.
2015-07-28 20:15:00 +02:00
Peter Todd d2d7ee0e86 Make CRollingBloomFilter set nTweak for you
While CBloomFilter is usually used with an explicitly set nTweak,
CRollingBloomFilter is only used internally. Requiring every caller to
set nTweak is error-prone and redundant; better to have the class handle
that for you with a high-quality randomness source.

Additionally when clearing the filter it makes sense to change nTweak as
well to recover from a bad setting, e.g. due to insufficient randomness
at initialization, so the clear() method is replaced by a reset() method
that sets a new, random, nTweak value.
2015-07-27 18:38:49 +02:00
Pieter Wuille 17b11428c1 Cache transaction validation successes 2015-07-27 15:28:43 +02:00
Wladimir J. van der Laan ca37e0f339
Merge pull request #5697
60c8bac Includes: Cleanup around net main and wallet (Jorge Timón)
9dd793f TRIVIAL: Missing includes (Jorge Timón)
2015-07-27 14:40:29 +02:00
Jorge Timón 60c8bac77c Includes: Cleanup around net main and wallet
-Move from .h to .cpp: in main, net and wallet
-Remove unnecessary #include "main.h"
-Cleanup some wallet files includes
2015-07-23 21:10:26 +02:00
Jorge Timón 9dd793f499 TRIVIAL: Missing includes 2015-07-23 21:10:22 +02:00
Wladimir J. van der Laan d2464dfee9
Merge pull request #6287
a794284 locking: add a quick example of GUARDED_BY (Cory Fields)
2b890dd locking: fix a few small issues uncovered by -Wthread-safety (Cory Fields)
cd27bba locking: teach Clang's -Wthread-safety to cope with our scoped lock macros (Cory Fields)
2015-07-23 18:45:26 +02:00
Pavel Vasin 2cb8ee9ac7 remove unused inv from ConnectTip() 2015-07-16 12:31:36 +03:00
Suhas Daftuar 59b49cd074 Eliminate signed/unsigned comparison warning 2015-07-11 07:05:18 -04:00
Wladimir J. van der Laan 9546a977d3
Merge pull request #6335
9238ecb Policy: MOVEONLY: 3 functions to policy.o: (Luke Dashjr)
627b9de Policy: MOVEONLY: Create policy/policy.h with some constants (Jorge Timón)
2015-07-06 18:54:20 +02:00
Wladimir J. van der Laan d0a10c1959
Merge pull request #6329
0c37634 acceptnonstdtxn option to skip (most) "non-standard transaction" checks, for testnet/regtest only (Luke Dashjr)
2015-07-03 14:00:06 +02:00
Luke Dashjr 0c376340a4 acceptnonstdtxn option to skip (most) "non-standard transaction" checks, for testnet/regtest only 2015-07-03 08:29:16 +00:00
Jonas Schnelli 409bccfbf5 use CBanEntry as object container for banned nodes
- added a reason enum for a ban
- added creation time for a ban

Using CBanEntry as container will keep banlist.dat extenable.
2015-07-02 20:29:36 +02:00
Shaul Kfir a651403e09 Add absurdly high fee message to validation state (for RPC propagation) 2015-06-30 15:59:11 -04:00
Suhas Daftuar 6b1066fab4 Ignore whitelisting during IBD for unrequested blocks. 2015-06-30 09:42:56 -04:00
Luke Dashjr 9238ecb417 Policy: MOVEONLY: 3 functions to policy.o:
- [script/standard.o] IsStandard
- [main.o] IsStandardTx
- [main.o] AreInputsStandard

Also, don't use namespace std in policy.cpp
2015-06-26 17:59:10 +02:00
Jorge Timón 627b9deff4 Policy: MOVEONLY: Create policy/policy.h with some constants 2015-06-26 17:59:07 +02:00
Wladimir J. van der Laan 24f24896d6
Merge pull request #6299
4f40716 test: Move reindex test to standard tests (Wladimir J. van der Laan)
36c97b4 Bugfix: Don't check the genesis block header before accepting it (Jorge Timón)
2015-06-26 15:40:59 +02:00
Wladimir J. van der Laan e34a8acd9f
Merge pull request #6233
3e91433 Advance pindexLastCommonBlock for blocks in chainActive (Suhas Daftuar)
2015-06-25 16:36:23 +02:00
Jorge Timón 36c97b4e5d Bugfix: Don't check the genesis block header before accepting it
This fixes an error triggered when running with -reindex after #5975
2015-06-21 01:24:51 +02:00
Cory Fields a794284e61 locking: add a quick example of GUARDED_BY
This was chosen not because it's necessarily helpful, but because its locking
assumptions were already correct.
2015-06-16 04:10:21 -04:00
Wladimir J. van der Laan c1fb0e1075
Merge pull request #6274
02a6702 Add option `-alerts` to opt out of alert system (Wladimir J. van der Laan)
2015-06-15 09:57:33 +02:00
Wladimir J. van der Laan 02a6702a82 Add option -alerts to opt out of alert system
Make it possible to opt-out of the centralized alert system by providing
an option `-noalerts` or `-alerts=0`. The default remains unchanged.

This is a gentler form of #6260, in which I went a bit overboard by
removing the alert system completely.

I intend to add this to the GUI options in another pull after this.
2015-06-15 09:53:33 +02:00
Wladimir J. van der Laan 8ccc07c077
Merge pull request #6256
65b9454 Use best header chain timestamps to detect partitioning (Gavin Andresen)
2015-06-12 16:44:36 +02:00
Wladimir J. van der Laan dd8fe8215a
Merge pull request #6221
c257a8c Prune: Support noncontiguous block files (Adam Weiss)
2015-06-11 18:24:35 +02:00
Wladimir J. van der Laan eba2f061a0
Merge pull request #6061
eb83719 Consensus: Refactor: Separate Consensus::CheckTxInputs and GetSpendHeight in CheckInputs (Jorge Timón)
2015-06-10 18:04:38 +02:00
Jorge Timón eb837199a0 Consensus: Refactor: Separate Consensus::CheckTxInputs and GetSpendHeight in CheckInputs 2015-06-10 14:07:30 +02:00
Jorge Timón 425c3a87ff Consensus: Separate CheckIndexAgainstCheckpoint() from ContextualCheckBlockHeader 2015-06-10 13:04:50 +02:00
Wladimir J. van der Laan 3a1d3e8f52
Merge pull request #5985
14d4eef Fix removing of orphan transactions (Alex Morcos)
2015-06-10 12:15:19 +02:00
Wladimir J. van der Laan 8d9f0a6069
Merge pull request #5927
dce8360 Reduce checkpoints' effect on consensus. (Pieter Wuille)
2015-06-10 10:33:12 +02:00
Gavin Andresen 65b9454503
Use best header chain timestamps to detect partitioning
The partition checking code was using chainActive timestamps
to detect partitioning; with headers-first syncing, it should use
(and with this pull request, does use) pIndexBestHeader timestamps.

Fixes issue #6251
2015-06-08 16:34:58 -04:00
Philip Kaufmann a9ac95c1bc use const references where appropriate 2015-06-04 19:34:18 +02:00
Suhas Daftuar 3e9143386a Advance pindexLastCommonBlock for blocks in chainActive
This prevents an edge case where a block downloaded and pruned
in-between successive calls to FindNextBlocksToDownload could
cause the block to be unnecessarily re-requested.
2015-06-04 13:00:26 -04:00
Adam Weiss c257a8c9a6 Prune: Support noncontiguous block files
In some corner cases, it may be possible for recent blocks to end up in
the same block file as much older blocks.  Previously, the pruning code
would stop looking for files to remove upon first encountering a file
containing a block that cannot be pruned, now it will keep looking for
candidate files until the target is met and all other criteria are
satisfied.

This can result in a noncontiguous set of block files (by number) on
disk, which is fine except for during some reindex corner cases, so
make reindex preparation smarter such that we keep the data we can
actually use and throw away the rest.  This allows pruning to work
correctly while downloading any blocks needed during the reindex.
2015-06-03 13:25:33 -04:00
Suhas Daftuar bfc30b3437 Ignore unrequested blocks too far ahead of tip 2015-06-03 11:36:04 -04:00
Suhas Daftuar 9be0e6837b Be stricter in processing unrequested blocks
AcceptBlock will no longer process an unrequested block, unless it has not
been previously processed and has more work than chainActive.Tip()
2015-06-02 13:54:29 -04:00
Wladimir J. van der Laan 88a7ead5de
Merge pull request #6172
a1ba077 Ignore getheaders requests when not synced. (Suhas Daftuar)
2015-06-02 07:56:02 +02:00
Wladimir J. van der Laan 87550eefc1
Merge pull request #6183
28bf062 Fix off-by-one error w/ nLockTime in the wallet (Peter Todd)
2015-06-01 11:33:33 +02:00
Wladimir J. van der Laan 921ea89bc3
Merge pull request #6195
8273793 Eliminate compiler warning due to unused variable (Suhas Daftuar)
2015-06-01 08:49:47 +02:00
Suhas Daftuar 8273793350 Eliminate compiler warning due to unused variable 2015-05-27 13:04:59 -04:00