Commit Graph

1103 Commits

Author SHA1 Message Date
Matt Corallo e6c7b362ab Print mempool size in KB when adding txn 2015-10-13 01:05:43 -07:00
Matt Corallo 9c9b66f771 Fix calling mempool directly, instead of pool, in ATMP 2015-10-13 00:44:03 -07:00
Wladimir J. van der Laan 28e3249e53 Bump minrelaytxfee default
To bridge the time until a dynamic method for determining this fee is
merged.

This is especially aimed at the stable releases (0.10, 0.11) because
full mempool limiting, as will be in 0.12, is too invasive and risky to
backport.
2015-10-09 19:36:32 +02:00
Wladimir J. van der Laan 4899a04c24
Merge pull request #5987
e761d7a Bugfix: Allow mining on top of old tip blocks for testnet (fixes testnet-in-a-box use case) (Luke Dashjr)
2015-10-01 14:11:56 +02:00
Jeff Garzik cf9bb11f97
Merge pull request #6588 2015-10-01 05:58:51 -04:00
Wladimir J. van der Laan 4f44530bc3
Merge pull request #6680
d76a8ac use CBlockIndex* insted of uint256 for UpdatedBlockTip signal (Jonas Schnelli)
2015-09-30 11:08:30 +02:00
Luke Dashjr e761d7a94f Bugfix: Allow mining on top of old tip blocks for testnet (fixes testnet-in-a-box use case) 2015-09-29 19:46:34 +00:00
Wladimir J. van der Laan 5b77244c60
Merge pull request #6550
3b33ec8 Avoid duplicate CheckBlock checks (Pieter Wuille)
391dff1 Do not store Merkle branches in the wallet. (Pieter Wuille)
2015-09-23 19:37:51 +02:00
Wladimir J. van der Laan 4939eabb75
Merge pull request #6688
131c23d Fix locking in GetTransaction. (Alex Morcos)
2015-09-23 16:53:40 +02:00
Wladimir J. van der Laan 999c8be81a
Merge pull request #6148
ae6f957 Enable block relay when pruning (Suhas Daftuar)
0da6ae2 Do not inv old or missing blocks when pruning (Suhas Daftuar)
2015-09-23 14:04:08 +02:00
Wladimir J. van der Laan 6264e5b378
Merge pull request #6646
6ecaec3 [Trivial] [logging] Rm extraneous cleansubver in serveral debug messages. (Gregory Maxwell)
2015-09-23 12:05:05 +02:00
Pieter Wuille 3b33ec85ed Avoid duplicate CheckBlock checks 2015-09-22 18:51:08 +02:00
Pieter Wuille 391dff16fe Do not store Merkle branches in the wallet.
Assume that when a wallet transaction has a valid block hash and transaction position
in it, the transaction is actually there. We're already trusting wallet data in a
much more fundamental way anyway.

To prevent backward compatibility issues, a new record is used for storing the
block locator in the wallet. Old wallets will see a wallet file synchronized up
to the genesis block, and rescan automatically.
2015-09-22 18:51:07 +02:00
Suhas Daftuar 5add7a74a6 Track transaction packages in CTxMemPoolEntry
Associate with each CTxMemPoolEntry all the size/fees of descendant
mempool transactions.  Sort mempool by max(feerate of entry, feerate
of descendants).  Update statistics on-the-fly as transactions enter
or leave the mempool.

Also add ancestor and descendant limiting, so that transactions can
be rejected if the number or size of unconfirmed ancestors exceeds
a target, or if adding a transaction would cause some other mempool
entry to have too many (or too large) a set of unconfirmed in-
mempool descendants.
2015-09-19 13:25:48 -04:00
Alex Morcos 131c23d027 Fix locking in GetTransaction.
GetTransaction needs to lock cs_main until ReadBlockFromDisk completes, the data inside CBlockIndex's can change since pruning.  This lock was held by all calls to GetTransaction except rest_tx.
2015-09-17 20:26:28 -04:00
Jonas Schnelli d76a8acb9b use CBlockIndex* insted of uint256 for UpdatedBlockTip signal
- removes mapBlockIndex find operation
- theoretically allows removing the cs_main lock during zqm notification while introducing a new file position lock
2015-09-16 16:51:21 +02:00
João Barbosa 5624e055b3 Add UpdatedBlockTip signal to CMainSignals and CValidationInterface 2015-09-16 10:59:32 +01:00
Gregory Maxwell 6ecaec395c [Trivial] [logging] Rm extraneous cleansubver in serveral debug messages.
We log the cleanSubVer as part of connect.  It is not uniquely more informative
 than any of the other data we have about a peer, often less.  It's also often
 long now as well.  There is no need to output it as part of mempoolrej,
 AcceptToMemoryPool, or pong entries.  Leaving it out makes our log entries
 more uniform and consistent.
2015-09-08 23:11:10 +00:00
Matt Corallo afb0ccaf9c Add NODE_BLOOM service bit and bump protocol version
Lets nodes advertise that they offer bloom filter support explicitly.
The protocol version bump allows SPV nodes to assume that NODE_BLOOM is
set if NODE_NETWORK is set for pre-70011 nodes.

Also adds an option to turn bloom filter support off for nodes which
advertise a version number >= 70011. Nodes attempting to use bloom
filters on such protocol versions are banned, and a later upgade
should drop nodes of an older version which attempt to use bloom
filters.

Much code stolen from Peter Todd.

Implements BIP 111
2015-09-05 23:29:13 -07:00
Tom Harding 9524c4d35c In (strCommand == "tx"), return if AlreadyHave()
The main effect is to exit processing for recently-rejected hashes,
in case they are pushed to us without prior advertisement.  This
behavior was seen in the wild.

An additional effect is to do early checks for mempool or mapOrphan
existence.  No logging or nDoS tracking is needed for failures of
these checks.
2015-09-03 10:16:59 -07:00
Patrick Strateman 4bac601610 Record nMinPingUsecTime 2015-08-22 15:38:23 -07:00
Wladimir J. van der Laan 80cddbbba9
Merge pull request #6539
9f68ed6 typofixes (found by misspell_fixer) (Veres Lajos)
2015-08-19 17:28:00 +02:00
Wladimir J. van der Laan 87f37e259d
Merge pull request #6519
7f1f8f5 Move mempool rejections to new debug category (Wladimir J. van der Laan)
66daed5 Add information to errors in ConnectBlock, CheckBlock (Wladimir J. van der Laan)
6cab808 Remove most logging from transaction validation (Wladimir J. van der Laan)
9003c7c Add function to convert CValidationState to a human-readable message (Wladimir J. van der Laan)
dc58258 Introduce REJECT_INTERNAL codes for local AcceptToMempool errors (Wladimir J. van der Laan)
fbf44e6 Add debug message to CValidationState for optional extra information (Wladimir J. van der Laan)
2015-08-11 17:36:50 +02:00
Wladimir J. van der Laan 7f1f8f5edf Move mempool rejections to new debug category
Move mempool rejections to debug category `mempoolrej`, to make it possible
to show them without enabling the entire category `mempool` which is
high volume.
2015-08-11 17:29:34 +02:00
Wladimir J. van der Laan 66daed5e1b Add information to errors in ConnectBlock, CheckBlock
Add detailed state information to the errors, as it is no longer being
logged downstream.

Also add the state information to mempool rejection debug message in
ProcessMessages.
2015-08-11 17:29:34 +02:00
Wladimir J. van der Laan 6cab808272 Remove most logging from transaction validation
Remove unnecessary direct logging in CheckTransaction,
AcceptToMemoryPool, CheckTxInputs, CScriptCheck::operator()

All status information should be returned in the CValidationState.
Relevant debug information is also added to the CValidationState using
the recently introduced debug message.

Do keep the "BUG! PLEASE REPORT THIS! ConnectInputs failed against MANDATORY but not STANDARD flags"
error as it is meant to appear as bug in the log.
2015-08-11 17:29:34 +02:00
Wladimir J. van der Laan 9003c7cdd8 Add function to convert CValidationState to a human-readable message
It is necessary to be able to concisely log a validation state.
Convert CValidationState to a human-readable message for logging.
2015-08-11 17:29:33 +02:00
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
Veres Lajos 9f68ed6b6d typofixes (found by misspell_fixer) 2015-08-10 22:06:27 +01:00
Daniel Kraft 69c3bde448 Add some const declarations where they are appropriate.
Declare some arguments of functions as "const" pointers where they are
not meant to be modified.
2015-08-08 18:18:41 +02:00
Wladimir J. van der Laan e545371b77
Merge pull request #6377
c433828 Handle no chain tip available in InvalidChainFound() (Ross Nicoll)
2015-08-07 09:14:53 +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
Ross Nicoll c433828df9 Handle no chain tip available in InvalidChainFound()
Handle the case where no chain tip is available, in InvalidChainFound(). This fixes a null pointer deference when running unit tests, if the genesis block or block validation code is broken.
2015-07-22 21:10:09 +00: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