Commit Graph

16033 Commits

Author SHA1 Message Date
Wladimir J. van der Laan d3a185a33b net: Move misbehaving logging to net logging category
This moves the error messages for misbehavior (when available) into the
line that reports the misbehavior, as well as moves the logging to the
`net` category.

This is a continuation of #11583 and avoids serious-looking errors due
to misbehaving peers.

To do this, Misbehaving() gains an optional `message` argument.

E.g. change:

    2018-01-18 16:02:27 Misbehaving: x.x.x.x:62174 peer=164603 (80 -> 100) BAN THRESHOLD EXCEEDED
    2018-01-18 16:02:27 ERROR: non-continuous headers sequence

to

    2018-01-18 16:02:27 Misbehaving: x.x.x.x:62174 peer=164603 (80 -> 100) BAN THRESHOLD EXCEEDED: non-continuous headers sequence
2018-01-24 12:18:29 +01:00
Jonas Schnelli 7f812502b7
Mention that other RPC calls report keys as "imported" while txns are still missing 2018-01-23 20:24:53 -10:00
Jonas Schnelli ccd8ef65f9
Reduce cs_main lock in ReadBlockFromDisk, only read GetBlockPos under the lock 2018-01-23 20:24:53 -10:00
Jonas Schnelli bc356b4268
Make sure WalletRescanReserver has successfully reserved the rescan 2018-01-23 20:24:18 -10:00
Jonas Schnelli dbf8556b4d
Add RAII wallet rescan reserver 2018-01-23 20:23:57 -10:00
Jonas Schnelli 8d0b610fe8
Avoid pemanent cs_main/cs_wallet lock during wallet rescans 2018-01-23 20:22:33 -10:00
MarcoFalke fae7b14a04 qa: Make TestNodeCLI command optional in send_cli 2018-01-23 13:57:34 -05:00
MarcoFalke ffffb10a9f qa: Rename cli.args to cli.options
That is the name in bitcoin-cli -help
2018-01-23 13:55:40 -05:00
Russell Yanofsky 04ededf001 Make CKey::Load references const
No change in behavior, this just prevents CKey::Load arguments from looking
like outputs.
2018-01-23 13:16:56 -05:00
Sjors Provoost 596c44633f
[wallet] use P2WPKH change output if any destination is P2WPKH or P2WSH
Only if -changetype is not set and -addresstype is not "legacy".
2018-01-23 17:56:15 +01:00
MarcoFalke b5e4b9b510
Merge #12187: [Docs] Updating benchmarkmarking.md with an updated sample output
b21244e0be Updating benchmarkmarking.md with an updated sample output and help options (Jeff Rade)

Pull request description:

  This PR is just a documentation update for someone (or myself) that looks into finishing up #7883 in the future.

  Looked through #7883 and appears [ryanofsky's PR](https://github.com/bitcoin/bitcoin/pull/8873) setup the benchmarks, but there are `FIXME` comments to pull in data from `test/` to get a larger data set (assuming reason why 7883 is still open).

Tree-SHA512: d758efc659c75f2b3ceb376f5a466c4234354077e4671ac3eb901c082c4e519ce5ff592cea4742711050b4ce56a1b65ef69433dd74e7db3eb11a8567d517d9e2
2018-01-22 08:44:36 -05:00
MarcoFalke b987ca4ee4
Merge #12227: test_runner: Readable output if create_cache.py fails
ac96e788fa test_runner: Readable output if create_cache.py fails (Russell Yanofsky)

Pull request description:

  Without this change, create_cache.py process output is shown as a byte() object
  with \n escapes in a single line that is hard to read.

Tree-SHA512: 49cd0fff037c03f558e31a1281712cc4419df6c4ed8b342057a3d54ab6b31180e1a23cb586686952d81b8add5bec07844efa8cdf16ad20f40cc903a19437fda5
2018-01-22 08:28:09 -05:00
MarcoFalke b03013396c
Merge #12241: [trivial][docs] Fix incorrect link in /test/ README.md
bf1897710f [trivial][docs] Fix incorrect link in /test/ README.md (fanquake)

Pull request description:

Tree-SHA512: f9024a5b6b03c591b9e02057aedd862f479d4b38d293dd04a07e411b877c0fb5b4d95ced7d09190bb8a83078fe8c97db24c5dcdac7cbd59d37b41f614d423026
2018-01-22 08:20:28 -05:00
fanquake bf1897710f
[trivial][docs] Fix incorrect link in /test/ README.md 2018-01-22 18:52:55 +08:00
Matt Corallo 2b839abd3e Update chainparams comment for more info on service bits per dnsseed 2018-01-19 12:41:28 -10:00
Matt Corallo 62e764219b Fall back to oneshot for DNS Seeds which don't support filtering.
This allows us to not have to update the chainparams whenever a
DNS Seed changes its filtering support, as well fixes a bug
introduced in 44407100f where returned nodes will never be
attempted.
2018-01-19 12:41:28 -10:00
Matt Corallo 51ae7660b8 Use GetDesireableServiceFlags in static seeds, document this.
44407100f broke inserting entries into addrman from static seeds
(as well as dnsseeds which did not support service bits). Static
seeds were already being filtered by UA for 0.13.1+ (ie
NODE_WITNESS), so simply changing the default service bits to
include NODE_WITNESS (and updating docs appropriately) is
sufficient.

For DNS Seeds, we will later fix by falling back to oneshot if a
seed does not support filtering.
2018-01-19 12:40:05 -10:00
Russell Yanofsky ac96e788fa test_runner: Readable output if create_cache.py fails
Without this change, create_cache.py process output is shown as a byte() object
with \n escapes in a single line that is hard to read.
2018-01-19 13:04:03 -05:00
Jeff Rade b21244e0be Updating benchmarkmarking.md with an updated sample output and help options 2018-01-19 11:41:56 -06:00
Wladimir J. van der Laan f4c942e361
Merge #12220: Error if relative -walletdir is specified
ec527c6 Don't allow relative -walletdir paths (Russell Yanofsky)

Pull request description:

  This makes it an error to explicitly specify a non-absolute -walletdir path, and also adds a debug.log warning if a relative rather than absolute -datadir path is configured.

  Specifying paths relative to the current working directory in a daemon process can be dangerous, because files can fail to be located even if the configuration doesn't change, but the daemon is started up differently.

  Specifying a relative -datadir now adds a warning to the debug log. It would not be backwards-compatible to forbid relative -datadir paths entirely, and it could also be inconvenient for command line testing.

  Specifying a relative -walletdir now results in a startup error. But since the -walletdir option is new in 0.16.0, there should be no compatibility issues. Another reason not to use working directory paths for -walletdir specifically is that the default -walletdir is a "wallets" subdirectory inside the datadir, so it could be surprising that setting -walletdir manually would choose a directory rooted in a completely different location.

Tree-SHA512: 67cbdae677f82487a9031c5ec96b0205a488ab08718a0f4f49365e025119f3d7f6cfc88ba1eba04c1ecd8b9561a5b2c42e2e1a267af7c08c76b83e5e361f5a31
2018-01-19 17:46:17 +01:00
Wladimir J. van der Laan 34328b4980 Use PACKAGE_NAME instead of hardcoding application name in log message 2018-01-19 11:15:01 +01:00
MarcoFalke 9a97f39afa
Merge #12212: Trivial: Fix spelling in zapwallettxes test description
7767842600 Trivial: Fix spelling in zapwallettxes test description (Jeremiah Buddenhagen)

Pull request description:

Tree-SHA512: 9b7ff6ac75c8cacfa6ebf7992a1688e109643ea6a43cd7977b1d0f0d5e3ca627c0d8aa55f503a1fb492e7da16a8b97621837230ab42af99dcacc28a0a14ecf5c
2018-01-18 15:43:49 -05:00
Russell Yanofsky ec527c6c88 Don't allow relative -walletdir paths
Also warn if bitcoind is configured to use a relative -datadir path.

Specifying paths relative to the current working directory in a daemon process
can be dangerous, because files can fail to be located even if the
configuration doesn't change, but the daemon is started up differently.

Specifying a relative -datadir now adds a warning to the debug log. It would
not be backwards-compatible to forbid relative -datadir paths entirely, and it
could also be also inconvenient for command line testing.

Specifying a relative -walletdir now results in a startup error. But since the
-walletdir option is new in 0.16.0, there should be no compatibility issues.
Another reason not to use working directory paths for -walletdir specifically
is that the default -walletdir is a "wallets" subdirectory inside the datadir,
so it could be surprising that setting -walletdir manually would choose a
directory rooted in a completely different location.
2018-01-18 15:09:27 -05:00
Wladimir J. van der Laan e839d6570d
Merge #12166: [docs] Clarify -walletdir usage
97c3cad [docs] Clarify -walletdir usage (John Newbery)

Pull request description:

  After discussion with @ryanofsky around #11687 , I think this documentation is a bit clearer for how the new `-walletdir` argument works.

Tree-SHA512: f279cab82524dbc0d75e6f9891f0e228ec4c8d0df3e16f351057fa243ddd263ff786f05383fd00a09b89edcc07dab211be5b64387f77271edf8af0177bcf667d
2018-01-18 21:09:27 +01:00
Jonas Schnelli 10d10d7fad
Merge #12211: Avoid potential null dereference in ReceiveCoinsDialog constructor
cc90a4f46 Avoid potential null dereference in ReceiveCoinsDialog constructor (Russell Yanofsky)

Pull request description:

  Not a bug in practice because current `WalletModel::getDefaultAddressType()` implementation does not dereference its `this` pointer.

  Encountered issue while rebasing #10244 after #11991 was merged.

Tree-SHA512: d76afc410d4a436ec62936196fdac1af89c221d8c0d6e73349024afe55bbf8820f843177a8fe8210aa8021d45a17a0ecd9b6f693381e3edb234d9897cece29d7
2018-01-18 09:46:58 -10:00
Wladimir J. van der Laan 898f560b55
Merge #12206: qa: Sync with validationinterface queue in sync_mempools
fa1e69e qa: Sync with validationinterface queue in sync_mempools (MarcoFalke)

Pull request description:

  Commit e545dedf72 moved `TransactionAddedToMempool` to the background scheduler thread. Thus, adding a transaction to the mempool will no longer add it to the wallet immediately. Functional tests, that `sync_mempools` and then call into wallet rpcs will race against the scheduler thread.

  Fix that race by flushing the scheduler queue.

  Fixes #12205; Fixes #12171;
  References #9584;

Tree-SHA512: 14d99cff9c4756de9fad412f04e6d8e25bb9a0938f24ed8348de79df5b4ee67763dac5214b1a69e77e60787d81ee642976d1482b1b5637edfc4892a238ed22af
2018-01-18 15:05:40 +01:00
Wladimir J. van der Laan 17180fa608
Merge #12210: wallet: Deprecate addwitnessaddress
cdf3e03 wallet: Deprecate addwitnessaddress (Wladimir J. van der Laan)

Pull request description:

  Now that segwit is natively supported by the wallet, deprecate the hack `addwitnessaddress`.

Tree-SHA512: f33b1c33d200fa8f1a0fba424b30e9c2a78147cde8bb0a3fd41194b77980454cddfb23da256cd6fe78726e87161deaa23357d0764e74c3eb83177cc518afa49c
2018-01-18 11:03:53 +01:00
Wladimir J. van der Laan cdf3e03a72 wallet: Deprecate addwitnessaddress
Now that segwit is natively supported by the wallet, deprecate the hack `addwitnessaddress`.
2018-01-18 10:24:18 +01:00
Jeremiah Buddenhagen 7767842600 Trivial: Fix spelling in zapwallettxes test description
[skip ci]
2018-01-17 16:49:45 -08:00
MarcoFalke fa1e69e52b qa: Sync with validationinterface queue in sync_mempools 2018-01-17 16:44:32 -05:00
Russell Yanofsky cc90a4f46b Avoid potential null dereference in ReceiveCoinsDialog constructor
Not a bug in practice because current WalletModel::getDefaultAddressType()
implementation does not dereference its `this` pointer.
2018-01-17 13:23:26 -05:00
Wladimir J. van der Laan c7978be899
Merge #12101: Clamp walletpassphrase timeout to 2^30 seconds and check its bounds
134cdc7 Test walletpassphrase timeout bounds and clamping (Andrew Chow)
0b63e3c Clamp walletpassphrase timeout to 2^(30) seconds and check its bounds (Andrew Chow)

Pull request description:

  Fixes #12100

  Makes the timeout be clamped to 2^30 seconds to avoid the issue with sign flipping with large timeout values and thus relocking the wallet instantly. Unlocking for at most ~34 years should be sufficient.

  Also checks that the timeout is not negative to avoid instant relocks.

Tree-SHA512: 426922f08c54e323d259e25dcdbebc2cd560708a65111ce6051493a7e7c61e79d9da1ea4026cc0d68807d728f5d7c0d7c58168c6ef4167b94cf6c2877af88794
2018-01-17 12:15:59 +01:00
Wladimir J. van der Laan adce1de9a6
Merge #12198: rpc: Add deprecation error for `getinfo`
49e5f3f rpc: Add deprecation error for `getinfo` (Wladimir J. van der Laan)

Pull request description:

  Add a short informative deprecation message when users use `getinfo`, that points them to the new calls
   here to get the different information fields.
  This is meant to be temporary, for one release only.

Tree-SHA512: 4fccd8853762d0740d051d9e74cdea5ad6f8d5c0ba67d69e8dd2ac8a1538d8270c1a1fab755d9f052ff3b3677753b09138c8c5ca0bc92d156de90413cd5c1814
2018-01-17 12:08:59 +01:00
Wladimir J. van der Laan 49e5f3ff7e rpc: Add deprecation error for `getinfo`
Add a short informative deprecation message when users use `getinfo`,
that points them to the new calls where to get the different information fields.
2018-01-17 10:06:13 +01:00
Jonas Schnelli 062c8b69f4
Merge #11991: [qt] Receive: checkbox for bech32 address
63ac8907c [qt] receive tab: bech32 address opt-in checkbox (Sjors Provoost)

Pull request description:

  <img width="647" alt="schermafbeelding 2018-01-12 om 18 34 48" src="https://user-images.githubusercontent.com/10217/34887691-a6a796fe-f7c7-11e7-8b89-87ce07c61ce3.png">

  Checkbox does what you would expect. Press tab from the amount field to get there.

  It's unchecked by default.

  When launched with `-addresstype=bech32` it's checked by default. When launched with `-addresstype=legacy` it unchecked and disabled.

  The change in `receivecoinsdialog.ui` is smaller than it looks, due to the way git handles XML diffs. I had to add a horizontal spacer to make it look decent, see https://github.com/bitcoin/bitcoin/issues/11950#issuecomment-352870909. This causes column numbers to change in the rest of the grid.

  I recommend testing on at least one other OS than OSX to be on the safe side.

Tree-SHA512: ec4b733b796d9a94278a5d8040a69d9574ef50021e68f94f61f2da75d1bb57f39272cbc9f1f7d34f733a19640daf666a23844fcd132f83bfdaf327d9d1d6f105
2018-01-16 20:48:38 -10:00
Sjors Provoost 63ac8907ce
[qt] receive tab: bech32 address opt-in checkbox
When launched with -adresstype=legacy the checkbox will be hidden.
2018-01-16 20:11:40 +00:00
MarcoFalke cad504bf4c
Merge #12177: trivial: fix address_type help text of getnewaddress and getrawchangeaddress
5f911c5cc2 trivial: fix address_type help text of getnewaddress and getrawchangeaddress (mruddy)

Pull request description:

  "p2sh" in the help messages should have been "p2sh-segwit".

  The messages before this patch:

  `help getnewaddress`
  "address_type"   (string, optional) The address type to use. Options are "legacy", "**p2sh**", and "bech32". Default is set by -addresstype.

  `help getrawchangeaddress`
  "address_type"           (string, optional) The address type to use. Options are "legacy", "**p2sh**", and "bech32". Default is set by -changetype.

Tree-SHA512: 6dfc0bebe577995f5521b83a12854045ac3eda4e65c9b92fc581da4ee68ab1218e05af82f2154bb2640a0813c5f79e010cd9e5ada449494c8831b3757bda854c
2018-01-16 08:03:48 -05:00
Wladimir J. van der Laan 0c74e2e890 Log debug build status and warn when running benchmarks
Log whether the starting instance of bitcoin core is a debug or release
build (--enable-debug).

Also warn when running the benchmarks with a debug build, to prevent
mistakes comparing debug to non-debug results.
2018-01-16 11:48:33 +01:00
Wladimir J. van der Laan 66e3af709d
Merge #11904: Add a lock to the wallet directory
2f3bd47 Abstract directory locking into util.cpp (MeshCollider)
5260a4a Make .walletlock distinct from .lock (MeshCollider)
64226de Generalise walletdir lock error message for correctness (MeshCollider)
c9ed4bd Add a test for wallet directory locking (MeshCollider)
e60cb99 Add a lock to the wallet directory (MeshCollider)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/11888, needs a 0.16 milestone

  Also adds a test that the lock works.

  https://github.com/bitcoin/bitcoin/pull/11687 will probably rework this to a per-wallet lock instead of just the walletdir, but this fixes the current issue

Tree-SHA512: 98e52d67f820e3b8f919cf361ffbb7d928f1bd67603e0ed26c5076ea02d9b3a90c3535ddf7329f3b88171396fa28dd3c87adab3577a8a217bd1e4247bda99138
2018-01-16 11:11:59 +01:00
MeshCollider 2f3bd47d44 Abstract directory locking into util.cpp 2018-01-16 19:05:46 +13:00
MeshCollider 5260a4aca1 Make .walletlock distinct from .lock 2018-01-16 19:05:46 +13:00
MeshCollider 64226de908 Generalise walletdir lock error message for correctness 2018-01-16 19:05:45 +13:00
MeshCollider c9ed4bd58c Add a test for wallet directory locking 2018-01-16 19:05:45 +13:00
MeshCollider e60cb99c58 Add a lock to the wallet directory 2018-01-16 19:02:57 +13:00
Wladimir J. van der Laan bbc91b7699
Merge #12173: [Qt] Use flexible font size for QRCode image address
59f9e2a Use flexible font size for QRCode image address (Jonas Schnelli)

Pull request description:

  Bech32 addresses are currently cut off in the QRCode image in the GUI receive tab.
  This adds a simple font size calculation logic that "must" (down to 4pt) fix into the given image width.

  Examples OSX HiDPI:
  <img width="332" alt="bildschirmfoto 2018-01-12 um 11 25 40" src="https://user-images.githubusercontent.com/178464/34896144-c0c65d76-f78c-11e7-93e1-94dc8e203269.png">
  <img width="322" alt="bildschirmfoto 2018-01-12 um 11 25 46" src="https://user-images.githubusercontent.com/178464/34896145-c0edfe1c-f78c-11e7-8c09-c15155e2160e.png">

  Examples Ubuntu non HIDPI:
  <img width="314" alt="bildschirmfoto 2018-01-12 um 11 27 51" src="https://user-images.githubusercontent.com/178464/34896151-c88347f4-f78c-11e7-8a03-df8049dcfed6.png">
  <img width="322" alt="bildschirmfoto 2018-01-12 um 11 27 42" src="https://user-images.githubusercontent.com/178464/34896152-c8bb881c-f78c-11e7-89d2-6f04ec608a19.png">

Tree-SHA512: d749763fb748b146f77fd8d88fb7d29b07a46cde0b0f303a4006ae9cc3521b3c2e8ab43b828e243514109379898b198552e17b8f316c5a869b0cc8246b054b86
2018-01-15 23:33:43 +01:00
Jonas Schnelli 59f9e2aaf3
Use flexible font size for QRCode image address 2018-01-15 09:33:46 -10:00
John Newbery 97c3cada92 [docs] Clarify -walletdir usage 2018-01-15 10:26:15 -05:00
Wladimir J. van der Laan 44080a90a2
Merge #12118: Sort mempool by min(feerate, ancestor_feerate)
0a22a52 Use mempool's ancestor sort in transaction selection (Suhas Daftuar)
7abfa53 Add test for new ancestor feerate sort behavior (Suhas Daftuar)
9a51319 Sort mempool by min(feerate, ancestor_feerate) (Suhas Daftuar)
6773f92 Refactor CompareTxMemPoolEntryByDescendantScore (Suhas Daftuar)

Pull request description:

  This more closely approximates the desirability of a given transaction for
  mining, and should result in less re-sorting when transactions get removed from
  the mempool after being mined.

  I measured this as approximately a 5% speedup in removeForBlock.

Tree-SHA512: ffa36b567c5dfe3e8908c545a459b6a5ec0de26e7dc81b1050dd235cac9046564b4409a3f8c5ba97bd8b30526e8fec8f78480a912e317979467f32305c3dd37b
2018-01-15 15:36:35 +01:00
Wladimir J. van der Laan 4db16ec827
Merge #11796: [tests] Functional test naming convention
5fecd84 [tests] Remove redundant import in blocktools.py test (Anthony Towns)
9b20bb4 [tests] Check tests conform to naming convention (Anthony Towns)
7250b4e [tests] README.md nit fixes (Anthony Towns)
82b2712 [tests] move witness util functions to blocktools.py (John Newbery)
1e10854 [tests] [docs] update README for new test naming scheme (John Newbery)

Pull request description:

  Splitting #11774 into two parts -- this part updates the README with the proposed naming convention, and adds some checks to test_runner.py that the number of tests violating the naming convention doesn't increase too much. Idea is this part of the change should not introduce merge conflicts or require much rebasing, so reviews of the complicated bits won't become invalidated too often; while the second part will just be file renames, which will require regular rebasing and will introduce merge conflicts with pending PRs, but can be merged later, and should also be much easier to review, since it will only include relatively trivial changes.

Tree-SHA512: b96557d41714addbbfe2aed62fb5a48639eaeb1eb3aba30ac1b3a86bb3cb8d796c6247f9c414c4695c4bf54c0ec9968ac88e2f88fb62483bc1a2f89368f7fc80
2018-01-15 10:38:01 +01:00
Wladimir J. van der Laan 9501dc27b3
Merge #12127: Remove unused mempool index
8e617e3 Remove unused mempool index (Suhas Daftuar)

Pull request description:

  We haven't used the "mining_score" index since 0.12, so remove it.

Tree-SHA512: ae37b8663194986eaeecfc2bbeca7ecb4ae6f0d8384515fa218cbc939a580d4b9f7f997c5297c3f1b3c3a0651edb092f373ac9a4808aaec30d38cb99d5f3ed70
2018-01-15 09:57:24 +01:00