Commit graph

6690 commits

Author SHA1 Message Date
Pieter Wuille 5400ef6bcb Replace trickle nodes with per-node/message Poisson delays
We used to have a trickle node, a node which was chosen in each iteration of
the send loop that was privileged and allowed to send out queued up non-time
critical messages. Since the removal of the fixed sleeps in the network code,
this resulted in fast and attackable treatment of such broadcasts.

This pull request changes the 3 remaining trickle use cases by random delays:
* Local address broadcast (while also removing the the wiping of the seen filter)
* Address relay
* Inv relay (for transactions; blocks are always relayed immediately)

The code is based on older commits by Patrick Strateman.
2015-12-11 22:20:38 +01:00
Wladimir J. van der Laan 9ee02cf564
Merge pull request #7156
6e76587 rpc: remove cs_main lock from `createrawtransaction` (Wladimir J. van der Laan)
2015-12-11 14:55:38 +01:00
Wladimir J. van der Laan 9bbe71b641 net: Add and document network messages in protocol.h
- Avoids string typos (by making the compiler check)
- Makes it easier to grep for handling/generation of a certain message type
- Refer directly to documentation by following the symbol in IDE
- Move list of valid message types to protocol.cpp:
    protocol.cpp is a more appropriate place for this, and having
    the array there makes it easier to keep things consistent.
2015-12-10 12:14:06 +01:00
Wladimir J. van der Laan 5dc63ed1ca
Merge pull request #7179
2041190 test: Add basic test for `reject` code (Wladimir J. van der Laan)
9fc6ed6 net: Fix sent reject messages for blocks and transactions (Wladimir J. van der Laan)
2015-12-10 11:58:02 +01:00
Wladimir J. van der Laan 00b4b8d1c4
Merge pull request #7154
a3c3ddb [Qt] add InMempool() info to transaction details (Jonas Schnelli)
2015-12-09 10:48:27 +01:00
MarcoFalke fafd09375e [wallet] Adjust pruning test 2015-12-09 09:34:48 +01:00
Wladimir J. van der Laan 0800092fc2
Merge pull request #4906
fc0f52d Added a test for the pruning of extraneous inputs after ApproximateBestSet (Murch)
af9510e Moved set reduction to the end of ApproximateBestSubset to reduce performance impact (Murch)
5c03483 Coinselection prunes extraneous inputs from ApproximateBestSubset (AlSzacrel)
2015-12-08 10:23:01 +01:00
Murch fc0f52d780 Added a test for the pruning of extraneous inputs after ApproximateBestSet 2015-12-07 20:08:37 +01:00
Murch af9510e037 Moved set reduction to the end of ApproximateBestSubset to reduce performance impact 2015-12-07 17:36:47 +01:00
Wladimir J. van der Laan e3bc5e0e92 net: Account for sendheaders verack messages
Looks like these were forgotten in #6589.
2015-12-07 15:17:53 +01:00
Wladimir J. van der Laan 9fc6ed6003 net: Fix sent reject messages for blocks and transactions
Ever since we #5913 have been sending invalid reject messages
for transactions and blocks.
2015-12-07 14:53:20 +01:00
Wladimir J. van der Laan dc0305d15a
Merge pull request #6589
ca188c6 log bytes recv/sent per command (Jonas Schnelli)
2015-12-07 13:54:22 +01:00
Jonas Schnelli ca188c629e
log bytes recv/sent per command 2015-12-07 13:32:59 +01:00
AlSzacrel 5c03483e26 Coinselection prunes extraneous inputs from ApproximateBestSubset
A further pass over the available inputs has been added to ApproximateBestSubset after a candidate set has been found. It will prune any extraneous inputs in the selected subset, in order to decrease the number of input and the resulting change.
2015-12-06 23:26:45 +01:00
Matt Corallo 96918a2f09 Don't do mempool lookups for "mempool" command without a filter 2015-12-05 17:45:44 +08:00
Gregory Maxwell 6aadc75578 Disconnect on mempool requests from peers when over the upload limit.
Mempool requests use a fair amount of bandwidth when the mempool is large,
 disconnecting peers using them follows the same logic as disconnecting
 peers fetching historical blocks.
2015-12-03 20:13:10 +00:00
Wladimir J. van der Laan 54a550bef8
Merge pull request #7113
086ee67 Switch to a more efficient rolling Bloom filter (Pieter Wuille)
2015-12-03 13:36:07 +01:00
Wladimir J. van der Laan 8843676621
Merge pull request #7133
aa4b0c2 When not filtering blocks, getdata sends more in one test (Pieter Wuille)
d41e44c Actually only use filterInventoryKnown with MSG_TX inventory messages. (Gregory Maxwell)
b6a0da4 Only use filterInventoryKnown with MSG_TX inventory messages. (Patick Strateman)
6b84935 Rename setInventoryKnown filterInventoryKnown (Patick Strateman)
e206724 Remove mruset as it is no longer used. (Gregory Maxwell)
ec73ef3 Replace setInventoryKnown with a rolling bloom filter. (Gregory Maxwell)
2015-12-03 13:16:46 +01:00
Wladimir J. van der Laan c12ff995f7
Now that 0.12 has been branched, master is 0.12.99
... in preparation for 0.13
2015-12-03 12:07:01 +01:00
Wladimir J. van der Laan 3cd836c1d8
Merge pull request #7158
fab8347 [qt] Use tr() instead of _() (MarcoFalke)
2015-12-03 10:52:49 +01:00
Suhas Daftuar 901b01d674 Remove GetMinRelayFee
One test in AcceptToMemoryPool was to compare a transaction's fee
agains the value returned by GetMinRelayFee. This value was zero for
all small transactions.  For larger transactions (between
DEFAULT_BLOCK_PRIORITY_SIZE and MAX_STANDARD_TX_SIZE), this function
was preventing low fee transactions from ever being accepted.

With this function removed, we will now allow transactions in that range
with fees (including modifications via PrioritiseTransaction) below
the minRelayTxFee, provided that they have sufficient priority.
2015-12-02 12:59:30 -05:00
Suhas Daftuar 27fae3484c Use fee deltas for determining mempool acceptance 2015-12-02 12:59:30 -05:00
Suhas Daftuar 9ef2a25603 Update replace-by-fee logic to use fee deltas 2015-12-02 12:59:30 -05:00
Suhas Daftuar eb306664e7 Fix mempool limiting for PrioritiseTransaction
Redo the feerate index to be based on mining score, rather than fee.

Update mempool_packages.py to test prioritisetransaction's effect on
package scores.
2015-12-02 12:59:30 -05:00
MarcoFalke fab83476ac [qt] Use tr() instead of _()
Also, `make translate`
2015-12-02 17:25:59 +01:00
MarcoFalke fabd10a9c9 Fix typo in wallet.cpp 2015-12-02 15:21:18 +01:00
paveljanik 5e151a842c PartitionCheck: remove useless spaces 2015-12-02 15:18:23 +01:00
Jorge Timón fad0088e75 TRIVIAL: Chainparams: Remove unused CBaseUnitTestParams 2015-12-02 15:18:23 +01:00
antonio-fr 74f7341fec Update miner.cpp: Fix typo in comment 2015-12-02 15:18:23 +01:00
MarcoFalke e69bad19f8 [trivial] Fix typo in peertablemodel.cpp 2015-12-02 15:18:23 +01:00
paveljanik 8a03727d9c Fix various typos 2015-12-02 15:18:22 +01:00
Wladimir J. van der Laan df2ced5c83
Merge pull request #7128
02354c9 Constrain rpcport default values to a single location in code (Luke Dashjr)
2015-12-02 14:38:43 +01:00
Wladimir J. van der Laan 93236c0455
qt: Final translation update before 0.12 fork
- Add new translations (finally, after a long time)
- update-translation script was not considering new translations - oops
  - fixed this, also remove (nearly) empty translations
- Update translation process, it was still describing the old repository
  structure
2015-12-02 14:28:35 +01:00
Wladimir J. van der Laan 83f06ca937
Merge pull request #6216
db6047d Take the training wheels off anti-fee-sniping (Peter Todd)
2015-12-02 13:56:57 +01:00
Wladimir J. van der Laan 6e76587360 rpc: remove cs_main lock from createrawtransaction
This is a pure utility function that doesn't use
main's data structures, so it does not require that lock.
2015-12-02 13:42:47 +01:00
Wladimir J. van der Laan 7c7a05d274
Merge pull request #7147
9827091 Squashed 'src/univalue/' changes from 5839ac3..2740c4f (MarcoFalke)
2015-12-02 13:26:54 +01:00
Wladimir J. van der Laan 0dd194c917
Merge pull request #7146
1812de9 Name union to prevent compiler warning (Pavel Janík)
2015-12-02 12:58:25 +01:00
Wladimir J. van der Laan 8e598dc4ea
Merge pull request #7118
b212f94 Describe maxmempool and mempoolminfee in the getmempoolinfo RPC help. (Pavel Janík)
2015-12-02 12:44:04 +01:00
MarcoFalke fad4ea836d Merge commit '982709199f1b4e9e35211c419a81938f9f1dd4ed' into bitcoin 2015-12-02 12:28:48 +01:00
Wladimir J. van der Laan 1b0241fcec
Merge pull request #7144
8f0d79e test: Disable scheduler test manythreads (Wladimir J. van der Laan)
2015-12-02 10:18:20 +01:00
Pavel Janík 1812de9091 Name union to prevent compiler warning 2015-12-02 08:40:47 +01:00
Jonas Schnelli a3c3ddbd7b
[Qt] add InMempool() info to transaction details 2015-12-02 08:38:31 +01:00
Pieter Wuille dd5862c4cd Flush coins cache also after transaction processing 2015-12-01 15:52:09 -08:00
Matt Corallo bde953e281 Uncache input txn in utxo cache if a tx is not accepted to mempool 2015-12-01 15:52:09 -08:00
Matt Corallo 97bf377bd1 Add CCoinsViewCache::HaveCoinsInCache to check if a tx is cached 2015-12-01 15:52:09 -08:00
Matt Corallo 677aa3d88c Discard txn cache entries that were loaded for removed mempool txn 2015-12-01 15:52:07 -08:00
Matt Corallo b2e74bd292 Get the set of now-uncacheable-txn from CTxMemPool::TrimToSize 2015-12-01 15:50:39 -08:00
Matt Corallo 74d0f90262 Add method to remove a tx from CCoinsViewCache if it is unchanged 2015-12-01 15:50:39 -08:00
Alex Morcos 553cad94e2 Rewrite CreateNewBlock
Use the score index on the mempool to only add sorted txs in order.  Remove much of the validation while building the block, relying on mempool to be consistent and only contain txs that can be mined.
The mempool is assumed to be consistent as far as not containing txs which spend non-existent outputs or double spends, and scripts are valid.  Finality of txs is still checked (except not coinbase maturity, assumed in mempool).
Still TestBlockValidity in case mempool consistency breaks and return error state if an invalid block was created.
Unit tests are modified to realize that invalid blocks can now be constructed if the mempool breaks its consistency assumptions and also updated to have the right fees, since the cached value is now used for block construction.

Conflicts:
	src/miner.cpp
2015-12-01 12:09:37 -05:00
Alex Morcos 5f12263302 Expose FormatStateMessage 2015-12-01 10:10:25 -05:00
Alex Morcos 1f09287c66 Make accessing mempool parents and children public 2015-12-01 10:10:25 -05:00
Alex Morcos 7230187b1d Add TxPriority class and comparator 2015-12-01 10:10:25 -05:00
Alex Morcos f3fe83673e Add a score index to the mempool.
The score index is meant to represent the order of priority for being included in a block for miners.  Initially this is set to the transactions modified (by any feeDelta) fee rate.  Index improvements and unit tests by sdaftuar.
2015-12-01 10:10:25 -05:00
Alex Morcos c49d5bc9e6 Store the total sig op count of a tx.
Store sum of legacy and P2SH sig op counts.  This is calculated in AcceptToMemory pool and storing it saves redoing the expensive calculation in block template creation.
2015-12-01 10:10:25 -05:00
Wladimir J. van der Laan 8f0d79e3c8 test: Disable scheduler test manythreads
It causes occasional deadlocks, resulting in false negatives in Travis.

Disable the test for now.
Works around #6540.
2015-12-01 14:43:38 +01:00
Wladimir J. van der Laan bc1f427570
qt: periodic translations update 2015-12-01 13:26:50 +01:00
Wladimir J. van der Laan c0c08c7c68
Merge pull request #7141
aabc897 rpc: Don't translate warning messages (Wladimir J. van der Laan)
2015-12-01 13:21:16 +01:00
Wladimir J. van der Laan a60538bc45
Merge pull request #7143
6da12df qt: use QMetaObject::invokeMethod for cross-thread signaling in clientmodel (Wladimir J. van der Laan)
2015-12-01 13:20:34 +01:00
Wladimir J. van der Laan 2ef5ffa59a
Merge pull request #6915
2d8860e Fix removeForReorg to use MedianTimePast (Suhas Daftuar)
b7fa4aa Don't call removeForReorg if DisconnectTip fails (Suhas Daftuar)
7e49f5f Track coinbase spends in CTxMemPoolEntry (Suhas Daftuar)
bb8ea1f removeForReorg calls once-per-disconnect-> once-per-reorg (Matt Corallo)
474b84a Make indentation in ActivateBestChainStep readable (Matt Corallo)
b0a064c Fix comment in removeForReorg (Matt Corallo)
9b060e5 Fix removal of time-locked transactions during reorg (Matt Corallo)
0c9959a Add failing test checking timelocked-txn removal during reorg (Matt Corallo)
2015-12-01 13:17:34 +01:00
Wladimir J. van der Laan 9afbd96919
Merge pull request #7022
50947ef Change default block priority size to 0 (Alex Morcos)
2015-12-01 12:39:34 +01:00
Wladimir J. van der Laan 6da12dff28 qt: use QMetaObject::invokeMethod for cross-thread signaling in clientmodel
It's surprising to me that Q_EMIT even worked for this.

But it doesn't build in Qt4, so switch back to
`QMetaObject::invokeMethod`. Fixes #7138.
2015-12-01 11:55:10 +01:00
Pavel Janík b212f94dd9 Describe maxmempool and mempoolminfee in the getmempoolinfo RPC help. 2015-12-01 11:26:32 +01:00
Luke Dashjr 02354c93be Constrain rpcport default values to a single location in code 2015-12-01 10:18:18 +00:00
Wladimir J. van der Laan 8f761e87c3
Merge pull request #7136
fa19a58 HelpMessage: Don't hide -mintxfee behind showDebug (MarcoFalke)
faffc17 rpcwallet: Clarify what settxfee does (MarcoFalke)
9999cb0 Fix url in .travis.yml (MarcoFalke)
fa22a10 contrib: Del. gitian downloader config and update gitian README (MarcoFalke)
fad3035 [doc] Minor markdown fixes (MarcoFalke)
2015-12-01 10:23:05 +01:00
Wladimir J. van der Laan 327291af02
Merge pull request #6914
114b581 Prevector type (Pieter Wuille)
2015-12-01 10:22:14 +01:00
Wladimir J. van der Laan aabc897801 rpc: Don't translate warning messages
But keep translating them in the GUI.
This - necessarily - requires duplication of a few messages.
Alternative take on #7134, that keeps the translations from being wiped.

Also document GetWarnings() input argument.

Fixes #5895.
2015-12-01 10:07:22 +01:00
Wladimir J. van der Laan 9490bd71bd
Merge pull request #7096
ff723da [Qt] improve minimum absolute fee option - Only display the minimum absolute fee control if CoinControl is enabled (Jonas Schnelli)
31b508a [Qt] make use of the nMinimumTotalFee (absolute) in coincontrols fee calculation (Jonas Schnelli)
80462dd [Qt] use ASYMP_UTF8 (≈) whenever we show a fee that is not absolute (Jonas Schnelli)
ecc7c82 Move fPayAtLeastCustomFee function to CC (Pieter Wuille)
2015-12-01 09:59:03 +01:00
Wladimir J. van der Laan 30c2d8c635
Merge pull request #7105
9ac63d6 Keep track of explicit wallet conflicts instead of using mempool (Pieter Wuille)
2015-12-01 09:22:08 +01:00
Wladimir J. van der Laan 1b5118bfa0
Merge pull request #7079
ebb25f4 Limit setAskFor and retire requested entries only when a getdata returns. (Gregory Maxwell)
5029698 prevent peer flooding request queue for an inv (kazcw)
2015-12-01 09:02:33 +01:00
Gregory Maxwell c143c499c8
Merge pull request #7072
996d311 [RPC] Add transaction size to JSON output (Nick)
2015-11-30 22:58:43 -08:00
Alex Morcos 50947ef23f Change default block priority size to 0
Make RPC tests have a default block priority size of 50000 (the old default) so we can still use free transactions in RPC tests.  When priority is eliminated, we will have to make a different change if we want to continue allowing free txs.
2015-11-30 16:16:24 -05:00
Gregory Maxwell 438ee59839
Merge pull request #7044
d52fbf0 Added additional config option for multiple RPC users. (Gregory Sanders)
2015-11-30 12:25:28 -08:00
Suhas Daftuar 2d8860e820 Fix removeForReorg to use MedianTimePast 2015-11-30 14:35:17 -05:00
Suhas Daftuar b7fa4aa387 Don't call removeForReorg if DisconnectTip fails 2015-11-30 13:12:55 -05:00
Suhas Daftuar 7e49f5f8b4 Track coinbase spends in CTxMemPoolEntry
This allows us to optimize CTxMemPool::removeForReorg.
2015-11-30 13:12:53 -05:00
Matt Corallo bb8ea1f630 removeForReorg calls once-per-disconnect-> once-per-reorg 2015-11-30 13:03:57 -05:00
Matt Corallo 474b84a741 Make indentation in ActivateBestChainStep readable 2015-11-30 13:03:56 -05:00
Matt Corallo b0a064c4b8 Fix comment in removeForReorg 2015-11-30 13:02:05 -05:00
Matt Corallo 9b060e5cfb Fix removal of time-locked transactions during reorg 2015-11-30 13:02:04 -05:00
MarcoFalke fa19a588b9 HelpMessage: Don't hide -mintxfee behind showDebug 2015-11-30 18:02:12 +01:00
MarcoFalke faffc172ec rpcwallet: Clarify what settxfee does 2015-11-30 18:01:43 +01:00
Wladimir J. van der Laan 34e02e0147
Merge pull request #7094
1bb289f Assert now > 0 in GetTime GetTimeMillis GetTimeMicros (Patick Strateman)
2015-11-30 14:49:57 +01:00
Wladimir J. van der Laan eb7741605b
Merge pull request #7008
c035306 Change GetPriority calculation. (Alex Morcos)
71f1d9f Modify variable names for entry height and priority (Alex Morcos)
5945819 Remove default arguments for CTxMemPoolEntry() (Alex Morcos)
2015-11-30 14:37:05 +01:00
Wladimir J. van der Laan 9b8fc6c89a
Merge pull request #7035
4531fc4 torcontrol: only output disconnect if -debug=tor (Daniel Cousens)
2015-11-30 14:20:22 +01:00
Jonas Schnelli ff723da6f6
[Qt] improve minimum absolute fee option
- Only display the minimum absolute fee control if CoinControl is enabled
2015-11-30 14:18:57 +01:00
Jonas Schnelli 31b508a18b
[Qt] make use of the nMinimumTotalFee (absolute) in coincontrols fee calculation 2015-11-30 14:09:05 +01:00
Jonas Schnelli 80462dda0a
[Qt] use ASYMP_UTF8 (≈) whenever we show a fee that is not absolute 2015-11-30 14:09:04 +01:00
Pieter Wuille ecc7c82361
Move fPayAtLeastCustomFee function to CC 2015-11-30 14:09:04 +01:00
Wladimir J. van der Laan 96b802510d
Merge pull request #7112
9af5f9c Move uiInterface.NotifyBlockTip signal above the core/wallet signal - This will keep getbestblockhash more in sync with blocknotify callbacks (Jonas Schnelli)
4082e46 [Qt] call GuessVerificationProgress synchronous during core signal, pass double over UI signal (Jonas Schnelli)
947d20b [Qt] reduce cs_main in getVerificationProgress() (Jonas Schnelli)
e6d50fc [Qt] update block tip (height and date) without locking cs_main, update always (each block) (Jonas Schnelli)
012fc91 NotifyBlockTip signal: switch from hash (uint256) to CBlockIndex* - also adds a boolean for indication if the tip update was happening during initial sync - emit notification also during initial sync (Jonas Schnelli)
2015-11-30 13:04:29 +01:00
Gregory Maxwell d41e44c9ac Actually only use filterInventoryKnown with MSG_TX inventory messages.
Previously this logic could erroneously filter a MSG_BLOCK inventory message.
2015-11-30 12:53:48 +01:00
Patick Strateman b6a0da45db Only use filterInventoryKnown with MSG_TX inventory messages.
Previously this logic could erroneously filter a MSG_BLOCK inventory message.
2015-11-30 12:53:48 +01:00
Patick Strateman 6b849350ab Rename setInventoryKnown filterInventoryKnown 2015-11-30 12:53:48 +01:00
Gregory Maxwell e20672479e Remove mruset as it is no longer used. 2015-11-30 12:53:48 +01:00
Gregory Maxwell ec73ef37ec Replace setInventoryKnown with a rolling bloom filter.
Mruset setInventoryKnown was reduced to a remarkably small 1000
 entries as a side effect of sendbuffer size reductions in 2012.

This removes setInventoryKnown filtering from merkleBlock responses
 because false positives there are especially unattractive and
 also because I'm not sure if there aren't race conditions around
 the relay pool that would cause some transactions there to
 be suppressed. (Also, ProcessGetData was accessing
 setInventoryKnown without taking the required lock.)
2015-11-30 12:53:48 +01:00
Daniel Cousens 4531fc4272 torcontrol: only output disconnect if -debug=tor 2015-11-30 22:20:43 +11:00
Wladimir J. van der Laan a7751824ce
Merge pull request #7103
fa506c0 [wallet] Add rpc tests to verify fee calculations (MarcoFalke)
4b89f01 Default fPayAtLeastCustomFee to false (Ryan Havar)
2015-11-30 12:18:20 +01:00
Jonas Schnelli 9af5f9cb87
Move uiInterface.NotifyBlockTip signal above the core/wallet signal
- This will keep getbestblockhash more in sync with blocknotify callbacks
2015-11-30 11:34:09 +01:00
Wladimir J. van der Laan 9ebedc1756
Merge pull request #7126
fa4b627 Move blocksonly parameter interaction to InitParameterInteraction() (MarcoFalke)
2015-11-30 11:34:09 +01:00
Wladimir J. van der Laan 74b5ce24c6
Merge pull request #7116
cb491e7 Trivial: Fix warning introduced by #7053 by casting to uint64_t (Jorge Timón)
2015-11-30 10:18:46 +01:00
Jonas Schnelli fa93174a7c
Merge pull request #7127
a6cbc02 Bugfix: Default -uiplatform is not actually the platform this build was compiled on (Luke Dashjr)
2015-11-30 09:14:42 +01:00