Commit graph

12976 commits

Author SHA1 Message Date
Russell Yanofsky 9acf25cc01 Return error when importmulti called with invalid address.
Lack of error checking noticed by Alex Morcos <morcos@chaincode.com>
2017-02-13 17:54:51 -05:00
Luke Dashjr 0b4f273e9c Bugfix: Qt/Options: Restore persistent "restart required" notice 2017-02-13 22:50:16 +00:00
Wladimir J. van der Laan d978c41e1e
Merge #9736: Pre-0.14.0 hardcoded seeds update
a60677e Pre-0.14.0 hardcoded seeds update (Wladimir J. van der Laan)
bfa9393 contrib/seeds: Update PATTERN_AGENT (Wladimir J. van der Laan)
4dfac2c Update seeds tooling to Python 3 (Wladimir J. van der Laan)
2017-02-11 08:46:10 +01:00
Pieter Wuille a06ede9a13
Merge #9708: Clean up all known races/platform-specific UB at the time PR was opened
db2dc7a Move CNode::addrLocal access behind locked accessors (Matt Corallo)
036073b Move CNode::addrName accesses behind locked accessors (Matt Corallo)
d8f2b8a Make nTimeBestReceived atomic (Matt Corallo)
22b4966 Move [clean|str]SubVer writes/copyStats into a lock (Matt Corallo)
0f31872 Make nServices atomic (Matt Corallo)
96f42d8 Make nStartingHeight atomic (Matt Corallo)
512731b Access fRelayTxes with cs_filter lock in copyStats (Matt Corallo)
ae683c1 Avoid copying CNodeStats to make helgrind OK with buggy std::string (Matt Corallo)
644f123 Make nTimeConnected const in CNode (Matt Corallo)
321d0fc net: fix a few races. Credit @TheBlueMatt (Cory Fields)
2017-02-10 16:58:55 -08:00
Russell Yanofsky a80f98b1c7 Use importmulti timestamp when importing watch only keys
When importing a watch-only address over importmulti with a specific timestamp,
the wallet's nTimeFirstKey is currently set to 1. After this change, the
provided timestamp will be used and stored as metadata associated with
watch-only key. This can improve wallet performance because it can avoid the
need to scan the entire blockchain for watch only addresses when timestamps are
provided.

Also adds timestamp to validateaddress return value (needed for tests).

Fixes #9034.
2017-02-10 16:11:19 -05:00
Russell Yanofsky a58370e6a2 Dedup nTimeFirstKey update logic
Also make nTimeFirstKey member variable private.

This is just a cleanup change, it doesn't change behavior in any significant
way.
2017-02-10 15:49:00 -05:00
Russell Yanofsky 266a8114cb Use MTP for importmulti "now" timestamps 2017-02-10 15:40:28 -05:00
Russell Yanofsky 3cf991756c Add test to check new importmulti "now" value
Easiest way to test this was to expose the timestamp via the validateaddress
RPC (which was already looking up and returning key metadata).
2017-02-10 15:40:28 -05:00
Russell Yanofsky 442887f27f Require timestamps for importmulti keys
Additionally, accept a "now" timestamp, to allow avoiding rescans for keys
which are known never to have been used.

Note that the behavior when "now" is specified is slightly different than the
previous behavior when no timestamp was specified at all. Previously, when no
timestamp was specified, it would avoid rescanning during the importmulti call,
but set the key's nCreateTime value to 1, which would not prevent future block
reads in later ScanForWalletTransactions calls. With this change, passing a
"now" timestamp will set the key's nCreateTime to the current block time
instead of 1.

Fixes #9491
2017-02-10 15:40:28 -05:00
MarcoFalke b860915f8b
Merge #9707: Fix RPC failure testing
9db8eec Fix RPC failure testing (John Newbery)
2017-02-10 18:02:56 +01:00
Matt Corallo db2dc7a58c Move CNode::addrLocal access behind locked accessors 2017-02-10 11:32:41 -05:00
Matt Corallo 036073bf87 Move CNode::addrName accesses behind locked accessors 2017-02-10 11:32:41 -05:00
Matt Corallo d8f2b8a8c0 Make nTimeBestReceived atomic 2017-02-10 11:32:41 -05:00
Matt Corallo 22b4966a29 Move [clean|str]SubVer writes/copyStats into a lock 2017-02-10 11:32:41 -05:00
Matt Corallo 0f31872615 Make nServices atomic 2017-02-10 11:32:41 -05:00
Matt Corallo 96f42d8a12 Make nStartingHeight atomic 2017-02-10 11:32:40 -05:00
Matt Corallo 512731bed0 Access fRelayTxes with cs_filter lock in copyStats 2017-02-10 11:32:40 -05:00
Matt Corallo ae683c1b19 Avoid copying CNodeStats to make helgrind OK with buggy std::string 2017-02-10 11:32:40 -05:00
Matt Corallo 644f1234e2 Make nTimeConnected const in CNode 2017-02-10 11:32:40 -05:00
Cory Fields 321d0fc6b6 net: fix a few races. Credit @TheBlueMatt
These are (afaik) all long-standing races or concurrent accesses. Going
forward, we can clean these up so that they're not all individual atomic
accesses.

- Reintroduce cs_vRecv to guard receive-specific vars
- Lock vRecv/vSend for CNodeStats
- Make some vars atomic.
- Only set the connection time in CNode's constructor so that it doesn't change
2017-02-10 11:32:39 -05:00
Wladimir J. van der Laan 2447c1024e
Merge #9698: net: fix socket close race
9a0b784 net: add a lock around hSocket (Cory Fields)
45e2e08 net: rearrange so that socket accesses can be grouped together (Cory Fields)
2017-02-10 12:42:53 +01:00
Wladimir J. van der Laan a60677e394 Pre-0.14.0 hardcoded seeds update 2017-02-10 11:04:34 +01:00
Wladimir J. van der Laan bfa9393c06 contrib/seeds: Update PATTERN_AGENT
gmaxwell: Adds the newest versions, drops everything multiple softforks ago.
2017-02-10 11:04:33 +01:00
Wladimir J. van der Laan 4dfac2c950 Update seeds tooling to Python 3
All the other tooling scripts require Python 3, it makes sense to do so
here too.

Also document the dependency on python3-dnspython.
2017-02-10 10:29:09 +01:00
Wladimir J. van der Laan 7179e7ca0d qt: Periodic translations update 2017-02-10 08:56:36 +00:00
Wladimir J. van der Laan 5e903a5ed9 devtools: Handle Qt formatting characters edge-case in update-translations.py
If both numeric format specifiers and "others" are used, assume we're
dealing with a Qt-formatted message. In the case of Qt formatting (see
https://doc.qt.io/qt-5/qstring.html#arg) only numeric formats are
replaced at all. This means "(percentage: %1%)" is valid (which was
introduced in #9461), without needing any kind of escaping that would be
necessary for strprintf.  Without this, this function would wrongly
detect '%)' as a printf format specifier.
2017-02-10 08:56:27 +00:00
Jonas Schnelli 33f3b21407
Merge #9730: Remove bitseed.xf2.org form the dns seed list
ca9955e Remove bitseed.xf2.org form the dns seed list (Jonas Schnelli)
2017-02-10 09:14:21 +01:00
Matt Corallo 66f861ade9 Add a test for P2P inactivity timeouts 2017-02-09 17:34:03 -05:00
Jonas Schnelli ca9955e706
Remove bitseed.xf2.org form the dns seed list 2017-02-09 11:28:01 +01:00
Wladimir J. van der Laan 36f9d3ae6d
Merge #9718: Qt/Intro: Various fixes
a9baa6d Bugfix: Qt/Intro: Pruned nodes never require *more* space (Luke Dashjr)
93ffba7 Bugfix: Qt/Intro: Chain state needs to be stored even with the full blockchain (Luke Dashjr)
c8cee26 Qt/Intro: Update block chain size (Luke Dashjr)
2017-02-09 07:30:10 +01:00
Koki Takahashi 36164faa33 Fix typo and spelling inconsistency in CONTRIBUTING.md
Fix spellings of GitHub

Remove unnecessary changes

Fix GitHub spelling on doc/translation_process.md
2017-02-09 11:56:44 +09:00
Luke Dashjr a9baa6d742 Bugfix: Qt/Intro: Pruned nodes never require *more* space 2017-02-08 19:16:00 +00:00
Luke Dashjr 93ffba7163 Bugfix: Qt/Intro: Chain state needs to be stored even with the full blockchain 2017-02-08 18:51:05 +00:00
Luke Dashjr c8cee26100 Qt/Intro: Update block chain size 2017-02-08 18:51:05 +00:00
Matt Corallo b436f92f72 qa: Expose on-connection to mininode listeners 2017-02-08 12:05:13 -05:00
Matt Corallo 8aaba7a6b7 qa: mininode learns when a socket connects, not its first action 2017-02-08 12:05:13 -05:00
John Newbery 9db8eecac1 Fix RPC failure testing
Make sure that RPC tests are actually checking failures correctly by:

- Catching JSON RPC exceptions and verifying the error codes and messages.
- Failing the test case if the JSON RPC exception isn't raised.
2017-02-08 10:24:02 -05:00
Wladimir J. van der Laan dd163f5788
Merge #9674: Always enforce strict lock ordering (try or not)
618ee92 Further-enforce lockordering by enforcing directly after TRY_LOCKs (Matt Corallo)
2a962d4 Fixup style a bit by moving { to the same line as if statements (Matt Corallo)
8465631 Always enforce lock strict lock ordering (try or not) (Matt Corallo)
fd13eca Lock cs_vSend and cs_inventory in a consistent order even in TRY (Matt Corallo)
2017-02-08 14:46:43 +01:00
Wladimir J. van der Laan 6a55515a9b
Merge #9705: build: Add options to override BDB cflags/libs
5cc2ebb Update OpenBSD and FreeBSD build steps (Wladimir J. van der Laan)
8713de8 build: Add options to override BDB cflags/libs (Wladimir J. van der Laan)
2017-02-08 14:38:28 +01:00
MarcoFalke d304fef374
Merge #9712: bench: Fix initialization order in registration
29c5328 bench: Fix initialization order in registration (Wladimir J. van der Laan)
2017-02-08 04:43:13 +01:00
Matt Corallo 2cbd1196b7 Disconnect peers which we do not receive VERACKs from within 60 sec 2017-02-07 17:44:46 -05:00
Matt Corallo 618ee9249b Further-enforce lockordering by enforcing directly after TRY_LOCKs 2017-02-07 14:15:28 -05:00
Wladimir J. van der Laan 29c53289a9 bench: Fix initialization order in registration
The initialization order of global data structures in different
implementation units is undefined. Making use of this is essentially
gambling on what the linker does, the so-called [Static initialization
order fiasco](https://isocpp.org/wiki/faq/ctors#static-init-order).

In this case it apparently worked on Linux but failed on OpenBSD and
FreeBSD.

To create it on first use, make the registration structure local to
a function.

Fixes #8910.
2017-02-07 19:07:29 +01:00
practicalswift a47da4b6fe Use z = std::max(x - y, 0); instead of z = x - y; if (z < 0) z = 0; 2017-02-07 15:46:38 +01:00
Wladimir J. van der Laan b709fe7ffc
Merge #9532: Remove unused variables
90fd29b Remove unused int64_t nSinceLastSeen (practicalswift)
ac4a095 Remove unused Python variables (practicalswift)
2017-02-07 15:28:50 +01:00
Wladimir J. van der Laan 729de15b63
Merge #9604: [Trivial] add comment about setting peer as HB peer.
dd5b011 [Trivial] add comment about setting peer as HB peer. (John Newbery)
2017-02-07 13:03:57 +01:00
Wladimir J. van der Laan 5cc2ebb619 Update OpenBSD and FreeBSD build steps
Re-try with most recent versions, and use BDB_CFLAGS/BDB_LIBS to
directly point at BerkeleyDB instead of CPPFLAGS hacks.
2017-02-07 13:01:41 +01:00
Wladimir J. van der Laan 8713de83a0 build: Add options to override BDB cflags/libs
Add environment settings to specify the CFLAGS and LIBS to be used for
BerkeleyDB directly. These will completely by-pass autodetection in the
same way as other similar flags.

```
BDB_CFLAGS  C compiler flags for BerkeleyDB, bypasses autodetection
BDB_LIBS    Linker flags for BerkeleyDB, bypasses autodetection
```

Implements #3921.
2017-02-07 13:01:41 +01:00
Cory Fields 9a0b784dea net: add a lock around hSocket 2017-02-06 14:48:50 -05:00
Cory Fields 45e2e08561 net: rearrange so that socket accesses can be grouped together 2017-02-06 14:48:50 -05:00