Commit graph

8254 commits

Author SHA1 Message Date
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
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
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
Jonas Schnelli 78cdd643d3
Merge #9094: qt: Use correct conversion function for boost::path datadir
e760b30 qt: Use correct conversion function for boost::path datadir (Wladimir J. van der Laan)
2016-11-07 14:20:12 +01:00
Wladimir J. van der Laan 0b2322b144
Merge #8981: Wshadow: Do not shadow argument with a local variable
ff6639b Do not shadow local variable (Pavel Janík)
2016-11-07 13:44:00 +01:00