e4f4ea47eb lint: Catch use of [] or {} as default parameter values in Python functions (practicalswift)
25dd867150 Avoid using mutable default parameter values (practicalswift)
Pull request description:
Avoid common Python default parameter gotcha when mutable `dict`/`list`:s are used as default parameter values.
Examples of this gotcha caught during review:
* https://github.com/bitcoin/bitcoin/pull/16673#discussion_r317415261
* https://github.com/bitcoin/bitcoin/pull/14565#discussion_r241942304
Perhaps surprisingly this is how mutable list and dictionary default parameter values behave in Python:
```
>>> def f(i, j=[], k={}):
... j.append(i)
... k[i] = True
... return j, k
...
>>> f(1)
([1], {1: True})
>>> f(1)
([1, 1], {1: True})
>>> f(2)
([1, 1, 2], {1: True, 2: True})
```
In contrast to:
```
>>> def f(i, j=None, k=None):
... if j is None:
... j = []
... if k is None:
... k = {}
... j.append(i)
... k[i] = True
... return j, k
...
>>> f(1)
([1], {1: True})
>>> f(1)
([1], {1: True})
>>> f(2)
([2], {2: True})
```
The latter is typically the intended behaviour.
This PR fixes two instances of this and adds a check guarding against this gotcha going forward :-)
ACKs for top commit:
Sjors:
Oh Python... ACK e4f4ea47eb. Testing tip: swap the two commits.
Tree-SHA512: 56e14d24fc866211a20185c9fdb274ed046c3aed2dc0e07699e58b6f9fa3b79f6d0c880fb02d72b7fe5cc5eb7c0ff6da0ead33123344e1a872209370c2e49e3f
403e372407 qa: Relax so that the subscriber is ready before publishing zmq messages (João Barbosa)
Pull request description:
Prevents the syndrome "slow joiner" - see http://zguide.zeromq.org/py:all#sockets-and-patterns - by relaxing before publishing messages.
ACKs for top commit:
MarcoFalke:
unsigned ACK 403e372407
Tree-SHA512: 0e856accbc450a9b09160bdce5112b2103dc9436cc317d31fb1c9634ebd76823a300a2e727818057fb4d0a615271772ff23e80553a13e9aa1935500de5eeec5f
8a3b2eb175 move-only: move coins statistics utils out of RPC (James O'Beirne)
Pull request description:
This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11):
Parent PR: #15606
Issue: #15605
Specification: https://github.com/jamesob/assumeutxo-docs/tree/master/proposal
---
In the short-term, this move-only commit will help with fuzzing (https://github.com/bitcoin/bitcoin/pull/15606#issuecomment-524482297). Later, these procedures will be used to compute statistics (particularly a content hash) for UTXO sets coming in from snapshots.
Most easily reviewed with `git ... --color-moved=dimmed_zebra`. A nice follow-up would be adding unittests, which I'll do if nobody else gets around to it.
ACKs for top commit:
MarcoFalke:
ACK 8a3b2eb175, checked --color-moved=dimmed-zebra
Tree-SHA512: a187d2f7590ad2450b8e8fa3d038c80a04fc3d903618c24222d7e3172250ce51badea35860c86101f2ba266eb4354e6efb8d7d508b353f29276e4665a1efdf74
These procedures will later be used in the ChainstateManager to compute
statistics (particularly a content hash) for UTXO sets coming in from
snapshots.
eb2d64b9e0 doc: Add spacing to command in translation_process.md (Chuf)
Pull request description:
Add spacing to the command used for updating `bitcoin_locale.qrc` entries. This makes it slightly easier to copy output into the relevant Makefile.
ACKs for top commit:
fanquake:
Tested ACK - eb2d64b9e0 - thanks.
Tree-SHA512: 079180962062994a3127ba05f7bb27a4145cb6a50354076864bf546dbbd80802ba9f10c943c43b6b3544d7225b646b7a8f1e38e0f148902c1813426b6f5036c3
a64dbeffe4 doc: Update labels in CONTRIBUTING.md (Hennadii Stepanov)
Pull request description:
This PR:
- adds `build` label
- makes labels lowercase (in accordance to current customs in this repo); also a lowercase label improves readability of PR title itself, e.g.,
```
doc: Update labels in CONTRIBUTING.md
```
reads better than
```
Doc: Update labels in CONTRIBUTING.md
```
- improves label names readability
- splits long labels (as suggested by **jonatack**)
ACKs for top commit:
practicalswift:
ACK a64dbeffe4
fanquake:
ACK a64dbeffe4
Tree-SHA512: f82e5e357490978f41035763b86cc005cf4a94099012cd0b246b664e00567ac7fa7a604bbb466b8318d94568084e3c67eecff5df152e0f39997d0a2fd9cfee77
92528c260e Support serialization of std::vector<bool> (Pieter Wuille)
Pull request description:
This adds support for serialization of `std::vector<bool>`, as a prerequisite of #16702.
ACKs for top commit:
MarcoFalke:
ACK 92528c260e (only looked at the diff on GitHub)
practicalswift:
ACK 92528c260e -- diff looks correct
jamesob:
ACK 92528c260e
Tree-SHA512: 068246a55a889137098f817bf72d99fc3218a560d62a97c59cccc0392b110f6778843cee4e89d56f271ac64e03a0f64dc5e2cc22daa833fbbbe9234c5f42d7b9
66ad75472f [Doc] Add documentation for the new whitelist permissions (nicolas.dorier)
Pull request description:
Documenting the new feature https://github.com/bitcoin/bitcoin/pull/16248 . Ping Sjors .
ACKs for top commit:
Sjors:
Indeed, re-ACK 66ad75472
Tree-SHA512: e6860bb6fae921287da7920a8db534e6a1a23871dd78dd6da030f00adf23e204cd23b194d67361bf34d4ef5a7815fc3fd7c81a3f2f35e4cfbe6ee2f2e6daec25
c295cba5a2 depends: zeromq: disable draft classes and methods (fanquake)
0072237b9e depends: xproto: configure flags cleanup (fanquake)
6a8ada3a4f depends: qrencode: configure flags cleanup (fanquake)
86beb8cdc4 depends: fontconfig: configure flags cleanup (fanquake)
e656d95ec7 depends: libxcb: configure flags cleanup (fanquake)
e439388b35 depends: libXau: configure flags cleanup (fanquake)
Pull request description:
Related to #16354.
This PR adds additional configure flags to packages in depends to explicitly disable features we aren't using; similar to #16183. It also fixes passing `--without-tools` to `qrencode`.
I've added `--disable-drafts` to `zeromq`:
```bash
Build and install draft classes and methods [default=yes]
```
I'm not entirely sure how far we want to take this. i.e in the `zeromq` package we explicitly pass `--without-libsodium`, even though it's disabled by default.
Do we also want to explicitly pass all the other `--without` flags? :
```bash
--with-libgssapi_krb5 require libzmq build with libgssapi_krb5
[default=no]
--with-libsodium use libsodium instead of built-in tweetnacl
[default=no]
--with-pgm build libzmq with PGM extension. Requires pkg-config
[default=no]
--with-norm build libzmq with NORM protocol extension,
optionally specifying norm path [default=no]
--with-vmci build libzmq with VMCI transport [default=no]
```
ACKs for top commit:
dongcarl:
ACK c295cba5a2
Tree-SHA512: df6d38b863b4008ed2cb06c97eb0e21eaa4b5fde552876065ba7f3c87bf6e372e5b954a51bf3fde2151cfb6d2c022227d34337fc6e50ce0caa1d518abbd2412a
74e3876989 Release notes: add previously undocumented changes (David A. Harding)
7e1634a927 Release notes: edit previously-detached notes (David A. Harding)
e7415a5a95 Doc: move detached release notes into release-notes.md (David A. Harding)
Pull request description:
Merges in detached release notes, edits each change down to a single paragraph bullet point (or, in a couple cases, two individual bullet points in separate sections each with a single paragraph). Adds notes for some undocumented changes I found reviewing `git log --merges`. Also tries something new: adds the PR number(s) after each entry to make it easier for both reviewers and end-user readers to look up the details behind each change. (If the PR numbers are unwanted, they're easy to remove either in this PR or later in the release process.)
I also checked the 0.18 branch but I didn't find anything in the current release notes that had been backported.
A particular focus in my editing was trying to keep things concise, particularly by pointing to RPC documentation when available (or upcoming, as in #16629). I do suspect that one downside of detached notes is that people write longer summaries than they would if they knew there were already 300 other lines of release notes. :-)
The first commit only moves notes, puts them in bullet form, adjusts indentation appropriately, and drops unneeded headers. It can be reviewed with `git diff --color-moved=dimmed-zebra` for a little bit of a speedup, but unfortunately I wasn't smart enough to split my copy/pasting and line wrapping into separate commits, so it's not a transparently move-only change.
ACKs for top commit:
fanquake:
ACK 74e3876989 - Thanks for doing this. It's nice to have a gauge of what's going to be in the `0.19.0` release.
meshcollider:
ACK 74e3876989
Tree-SHA512: 676668765849d5a67520dd8ac49de85ac1bfb5ba2dc09504e75db77d79c7e2c58b5cee16c58591ec575cb3682e630231baba7fd07565d19f8d02243e06fcb9ab
a4765bd77f gui: Ensure tx send error highlight is visible (bpay)
Pull request description:
Rebased and squashed #14956.
> If sending to multiple recipients and one of the recipient fields is malformed, the highlighted field may not be visible due to being scrolled out of view. This results in a confusing lack of error feedback.
> Avoid this problem by ensuring the first field containing an error is scrolled into view when Send is clicked.
You can see the behavior here: https://imgur.com/a/QZG5TQc
How to test:
Add a few recipients and give any of them an invalid address or amount. Scroll the invalid recipient out of view and hit Send. With this change, the GUI will scroll to show the invalid recipient, with master it will not, "hiding" the error.
ACKs for top commit:
jonatack:
Tested ACK a4765bd77f on Linux Debian with Qt 5.11.3. Change is that I had added an inadvertent typo in my make bash alias; fixed.
hebasto:
ACK a4765bd77f, tested on Debian 9.9 with system Qt 5.7.1.
Tree-SHA512: a5653ca44d6d540214bdb424b0b75a06a5872cff41b0cd8cffd9cef99ebf04a17a3652e561139ac75315b39c3347e5f7ae304fa35e14b48bdae4768a416df9b0
We shouldn't rely on this sync call to get an accurate view of txn
state, if a tx conflicts with one in mapTx we are going to update
our wallet dependencies in AddToWalletIfInvolvingMe while conflicting
txn get connected. If it doesn't conflict with one of our dependencies
we are not going to track it anyway.
This is a cleanup, as this SyncTransaction is redundant with the
following one for confirmation which is triggering the MarkConflicted
logic. We keep the loop because set of conflicted txn isn't same as txn
included in block.
Instead of relying on combination of hashBlock and nIndex
values to manage tx in its lifecycle, we introduce 4
status : CONFIRMED, UNCONFIRMED, CONFLICTED, ABANDONED.
hashBlock and nIndex magic values should only be used at
serialization/deserialization for backward-compatibility.
At block disconnection, we know flag txn as UNCONFIRMED where
previously they kept their states until being override by a
block connection or abandontransaction call. This is a change
in behavior for which user may have to call abandon twice
if transaction is disconnected and not accepted back in the mempool.
We assert status transitioning right in AddToWallet. Doing so
flagged a misbehavior in ComputeTimeSmart unit test where same
tx is confirmed twice in different block. To avoid inconsistencies
we unconfirmed tx before new connection in different block. We
also remove a cs_main lock in test, as AddToWallet and its
callees don't rely on locked chain.
In Qt 5.12 and before the QFontMetrics::width() is used and it is
deprecated since Qt 13.0.
In Qt 5.11 the QFontMetrics::horizontalAdvance() was introduced.
If sending to multiple recipients and one of the recipient fields is malformed,
the highlighted field may not be visible due to being scrolled out of view,
leading to a confusing lack of error feedback when clicking Send. To avoid this
problem ensure the first field containing an error is scrolled into view
when Send is clicked.
2483266c59 packages.md: document depends build targets (Russell Yanofsky)
be27161ee4 Clarify need to specify --prefix with depends (Russell Yanofsky)
Pull request description:
There seems to be some confusion about exactly how to use depends, when to pass a prefix to `./configure` etc (see #16367, #16654).
I've cherry-picked two of russ's commits out of #16367, as they are clear stand-alone improvements and we don't have to wait for #16367 to improve the depends documentation.
ACKs for top commit:
Sjors:
utACK 2483266
hebasto:
ACK 2483266c59, I have reviewed the code and it looks OK, I agree it can be merged.
jonasschnelli:
ACK 2483266c59
Tree-SHA512: a198c288248f573519a3b0ef384626b61cc803803280af9a448c28466e3d9949bed0332af6618dac19e81c5a6e9694afa83d976b176fd13c32a6c2c3fea3fc1f
bca388db0d gui: remove unused PlatformStyle::TextColorIcon (fanquake)
Pull request description:
This is unused after #16612.
ACKs for top commit:
emilengler:
Concept ACK bca388d
practicalswift:
ACK bca388db0d -- diff looks correct & less cruft is better
hebasto:
ACK bca388db0d, I have reviewed the code and it looks OK, I agree it can be merge.
jonasschnelli:
utACK bca388db0d
Tree-SHA512: ae5c5cfc02cf2e6f138e75e227320f4c430b93bd529a8ead7ba971ceb5bbc997cdb721c6fd8a46a5a897008f0bc6e519422d6beef240b9d2e28ecf4f8cbbcc6a