Commit graph

22765 commits

Author SHA1 Message Date
MacroFake
718304d222
Merge bitcoin/bitcoin#26084: sendall: check if the maxtxfee has been exceeded
6f8e3818af sendall: check if the maxtxfee has been exceeded (ishaanam)

Pull request description:

  Previously the `sendall` RPC didn't check whether the fees of the transaction it creates exceed the set `maxtxfee`. This PR adds this check to `sendall` and a test case for it.

ACKs for top commit:
  achow101:
    ACK 6f8e3818af
  Xekyo:
    ACK 6f8e3818af
  glozow:
    Concept ACK 6f8e3818af. The high feerate is unlikely but sendall should respect the existing wallet options.

Tree-SHA512: 6ef0961937091293d49be16f17e4451cff3159d901c0c7c6e508883999dfe0c20ed4d7126bf74bfea8150d4c1eef961a45f0c28ef64562e6cb817fede2319f1a
2022-09-15 08:45:08 +02:00
Andrew Chow
2e3cd26a1a
Merge bitcoin/bitcoin#26053: rpc: bugfix, 'add_inputs' default value is true unless 'inputs' are provided
b00fc44ca5 test: add coverage for 'add_inputs' dynamic default value (furszy)
ddbcfdf3d0 RPC: bugfix, 'add_inputs' default value is true unless 'inputs' are provided (furszy)

Pull request description:

  This bugfix was meant to be in #25685, but decoupled it to try to make it part of 24.0 release.
  It's a truly misleading functionality.

  This PR doesn't change behavior in any way. Just fixes two invalid RPC help messages and adds test
  coverage for the current behavior.

  #### Description
  In both RPC commands `send()` and `walletcreatefundedpsbt` the help message says
  that `add_inputs` default value is false when it's actually dynamically set by the following statement:

  ```c++
  coin_control.m_allow_other_inputs = rawTx.vin.size() == 0;
  ```

  Which means that, by default, `add_inputs` is true unless there is any pre-set input, in which
  case, the default is false.

ACKs for top commit:
  achow101:
    ACK b00fc44ca5
  S3RK:
    ACK b00fc44ca5

Tree-SHA512: 5c68a40d81c994e0ab6de0817db69c4d3dea3a9a64a60362531bf583b7a4c37d524b740905a3f3a89cdbf221913ff5b504746625adb8622788aea93a35bbcd40
2022-09-14 16:15:03 -04:00
Hennadii Stepanov
6725030e41
qt: Update translation source file for string freeze (round 2) 2022-09-14 15:03:07 +01:00
Hennadii Stepanov
f523df1ee8
Merge bitcoin-core/gui#664: Prevent wrong handling of %2 token by Transifex
8ed2b72767 qt: Prevent wrong handling of `%2` token by Transifex (Hennadii Stepanov)

Pull request description:

  On master (124e75a41e), Transifex translation check fails for 124e75a41e/src/qt/forms/intro.ui (L206) with a message:
  > The expression '%2G' is not present in the translation.

  In "Organization Settings" --> ["Translation checks"](https://www.transifex.com/bitcoin/settings/validations/) I have changed the status of the "**Variable substitution specifiers (like "%s") are preserved in the translations.**" check from "error" to "warning" temporarily. This setting should be reverted after applying this PR change.

  [Noted](https://www.transifex.com/bitcoin/bitcoin/translate/#ru/qt-translation-024x/436102928/) by Transifex user [AHOHNMYC](https://www.transifex.com/user/profile/AHOHNMYC/).

  I faced the same issue while working on Ukrainian translation.

ACKs for top commit:
  katesalazar:
    ACK 8ed2b72767
  jarolrod:
    ACK 8ed2b72767

Tree-SHA512: 304f795ac9241ac8453c614ed18d967226d9d515f9ea079b51af5bcbe2f0760ca7dcaea5efb38207720cb7a18159c2bcd337b961bc522a128715c70e0db81061
2022-09-14 14:58:59 +01:00
Hennadii Stepanov
bc29c4d4a5
Merge bitcoin-core/gui#663: Cleanup translation comment
5f28fc8160 qt: Cleanup translation comment (Hennadii Stepanov)

Pull request description:

  An unneeded character slipped in bitcoin-core/gui#629.

ACKs for top commit:
  jarolrod:
    ACK 5f28fc8160
  jonatack:
    utACK 5f28fc8160

Tree-SHA512: 210fb626e8035786cf6859160c60b2815c813e02908c75efc71a2c64d511edd6f81b2f67f1c98b29122b990260ebf663da445ea2d01b6268e3e046ada1ca5b6e
2022-09-14 14:56:26 +01:00
MacroFake
a8c3590890
Merge bitcoin/bitcoin#25831: refactor: Remove trailing semicolon from LOCK2 macro
0f0cc05e4c refactor: Remove trailing semicolon from LOCK2 (Aurèle Oulès)

Pull request description:

  Macros should not have a trailing semi-colon to avoid empty statements when using them with another semi-colon.
  Noticed this while reviewing a PR.

ACKs for top commit:
  vasild:
    ACK 0f0cc05e4c

Tree-SHA512: 97fa4d89f5131ac30e05b293f750b757d5526feed56885c6feeb403b3ac3d3d3205874bc507c3b56a8296a6e3bdc8d879b2c339784f1e6ab1963d1b8a8d7b02f
2022-09-14 13:06:25 +02:00
ishaanam
6f8e3818af sendall: check if the maxtxfee has been exceeded 2022-09-13 18:12:42 -04:00
furszy
ddbcfdf3d0
RPC: bugfix, 'add_inputs' default value is true unless 'inputs' are provided
In both RPC commands `send()` and `walletcreatefundedpsbt` the RPC help was saying
that `add_inputs` default value was false when it's actually dynamically set
by the following statement:

`coin_control.m_allow_other_inputs = rawTx.vin.size() == 0;`

Which means that, by default, `add_inputs` is true unless there
was any pre-set input, in which case, the default is false.
2022-09-13 16:13:05 -03:00
fanquake
12de8f6262
build: extract $(BOOST_CPPFLAGS) from $(BITCOIN_INCLUDES)
This leaves $(BITCOIN_INCLUDES) as internal dependencies, and gives
finer control over Boost includes.
2022-09-13 17:15:17 +01:00
Andrew Chow
c85688347e
Merge bitcoin/bitcoin#26021: wallet: bugfix, load a wallet with an unknown/corrupt descriptor causes a fatal error
e06676377d wallet: coverage for loading an unknown descriptor (furszy)
d26c3cc444 wallet: bugfix, load wallet with an unknown descriptor cause fatal error (furszy)

Pull request description:

  Fixes #26015

  If the descriptor entry is unrecognized (due a soft downgrade) or corrupt, the
  unserialization fails and `LoadWallet`, instead of stop there and return the error,
  continues reading all the db records. As other records tied to the unrecognized
  or corrupt descriptor are scanned, a fatal error is being thrown.

  This fixes it by catching the descriptor parse failure and return which wallet failed.
  Logging its name/path, so the user can remove it from the settings file, to prevent
  its load at startup.

  Note: added the test in a separate file intentionally.
  Will continue adding coverage for the wallet load process in follow-up PRs.

ACKs for top commit:
  achow101:
    ACK e06676377d
  Sjors:
    re-utACK e06676377d

Tree-SHA512: d1f1a5d7e944c89c97a33b25b4411a36a11edae172c22f8524f69c84a035f84c570b284679f901fe60f1300f781b76a6c17b015a8e7ad44ebd25a0c295ef260f
2022-09-13 11:51:51 -04:00
glozow
3a7e0a210c
Merge bitcoin/bitcoin#24513: CChainState -> Chainstate
00eeb31c76 scripted-diff: rename CChainState -> Chainstate (James O'Beirne)

Pull request description:

  Alright alright alright, I know: we hate refactors. We especially hate cosmetic refactors.

  Nobody knows better than I that changing broad swaths of code out from under our already-abused collaborators, only to send a cascade of rebase bankruptcies, is annoying at best and sadistic at worst. And for a rename! The indignation!

  But just for a second, imagine yourself. Programming `bitcoin/bitcoin`, on a sandy beach beneath a lapis lazuli sky. You go to type the name of what is probably the most commonly used data structure in the codebase, and you *only hit shift once*.

  What could you do in such a world? You could do anything. [The only limit is yourself.](https://zombo.com/)

  ---

  So maybe you like the idea of this patch but really don't want to deal with rebasing. You're in luck!

  Here're the commands that will bail you out of rebase bankruptcy:

  ```sh
  git rebase -i $(git merge-base HEAD master) \
    -x 'sed -i "s/CChainState/Chainstate/g" $(git ls-files | grep -E ".*\.(py|cpp|h)$") && git commit --amend --no-edit'
  # <commit changed?>
  git add -u && git rebase --continue
  ```

  ---

  ~~Anyway I'm not sure how serious I am about this, but I figured it was worth proposing.~~ I have decided I am very serious about this.

  Maybe we can have nice things every once in a while?

ACKs for top commit:
  MarcoFalke:
    cr ACK 00eeb31c76
  hebasto:
    ACK 00eeb31c76
  glozow:
    ACK 00eeb31c76, thanks for being the one to propose this
  w0xlt:
    ACK 00eeb31c76

Tree-SHA512: b828a99780614a9b74f7a9c347ce0687de6f8d75232840f5ffc26e02bbb25a3b1f5f9deabbe44f82ada01459586ee8452a3ee2da05d1b3c48558c8df6f49e1b1
2022-09-13 15:42:18 +01:00
MacroFake
141540a71f
Merge bitcoin/bitcoin#25222: refactor: Pass reference to LookUpStats
faa3d38ec6 refactor: Pass reference to LookUpStats (MacroFake)

Pull request description:

  I find it confusing to have an interface that accepts nullptr, but immediately crashes the program when someone does pass nullptr.

  Fix that.

  Also some include fixups.

ACKs for top commit:
  aureleoules:
    ACK faa3d38ec6

Tree-SHA512: f90b649e9991e137b83a9899258ee73605719c081a6b789ac27fe7fe73eb70fbb41d89479bcd536d5c3ad788a5795de8451bc1b94e5c9267dcf9636d9e4a1109
2022-09-13 14:18:18 +02:00
fanquake
94d17845d0
Merge bitcoin/bitcoin#24991: init: allow startup with -onlynet=onion -listenonion=1
2d0b4e4ff6 init: allow startup with -onlynet=onion -listenonion=1 (Vasil Dimov)

Pull request description:

  It does not make sense to specify `-onlynet=onion` without providing a
  Tor proxy (even if other `-onlynet=...` are given). This is checked
  during startup. However, it was forgotten that a Tor proxy can also be
  retrieved from "Tor control" to which we connect if `-listenonion=1`.

  So, the full Tor proxy retrieval logic is:
  1. get it from `-onion`
  2. get it from `-proxy`
  3. if `-listenonion=1`, then connect to "Tor control" and get the proxy
     from there (was forgotten before this change)

  Fixes https://github.com/bitcoin/bitcoin/issues/24980

ACKs for top commit:
  mzumsande:
    Tested ACK 2d0b4e4ff6
  MarcoFalke:
    ACK 2d0b4e4ff6 🕸

Tree-SHA512: d1d18e07a8a40a47b7f00c31cb291a3d3a9b24eeb28c5e4720d5df4997f488583a3a010d46902b4b600d2ed1136a368e1051c133847ae165e0748b8167603dc3
2022-09-13 12:36:29 +01:00
furszy
2870a97121
RPC: unify arg type error message
We were throwing two different errors for the same problematic:

* "Expected type {expected], got {type}" --> RPCTypeCheckArgument()
* "JSON value of type {type} is not of expected type {expected}" --> UniValue::checkType()
2022-09-12 10:04:15 -03:00
MacroFake
5558d2f549
Merge bitcoin/bitcoin#26048: mempool clean up: replace update_* structs with lambdas
1b348d2725 [mempool] replace update_descendant_state with lambda (glozow)

Pull request description:

  These were introduced in commit 5add7a74a6, when the codebase was pre-C++11. We can use lambdas now.

ACKs for top commit:
  MarcoFalke:
    review ACK 1b348d2725 👮
  w0xlt:
    ACK 1b348d2725

Tree-SHA512: b664425b395e39ecf1cfc1e731200378261cf58c3985075fdc6027731a5caf995de72ea25be99b4c0dbec2e3ee6cf940e7c577638844619c66c8494ead5da459
2022-09-12 10:10:40 +02:00
MacroFake
8ca51aa5fb
Merge bitcoin/bitcoin#26009: test: remove Boost Test from libtest_util
a7dbf74d72 test: remove Boost Test from libtest util (fanquake)

Pull request description:

  Context is the discussion here:
  https://github.com/bitcoin/bitcoin/pull/25974/files#r961541457.

  Output:
  ```bash
  [test/util/chainstate.h:38] [CreateAndActivateUTXOSnapshot] Wrote UTXO snapshot to /var/folders/sq/z88fhjzj0b19ftsd2_bjrmjm0000gn/T/test_common_Bitcoin Core/8f2783bb3dbf10c669cd892192d70efcca4bab250226856fed7ffecdb378ffc7/test_snapshot.100.dat: {"coins_written":100,"base_hash":"571d80a9967ae599cec0448b0b0ba1cfb606f584d8069bd7166b86854ba7a191","base_height":100,"path":"/var/folders/sq/z88fhjzj0b19ftsd2_bjrmjm0000gn/T/test_common_Bitcoin Core/8f2783bb3dbf10c669cd892192d70efcca4bab250226856fed7ffecdb378ffc7/test_snapshot.100.dat","txoutset_hash":"cd1ba1c3f393058ae743b7c6bdbd00c897744cdcf022c9f2f0f2b4565c08a49c","nchaintx":101}
  ```

ACKs for top commit:
  Sjors:
    tACK a7dbf74
  theuni:
    ACK a7dbf74d72

Tree-SHA512: b9511f88a1a997f44637e3f613a71780026ce519f896af4209b01639883a3b1e40543928b213935c63d3e64c1813e9960a9004e47ed7de6cb7f7e36c33199bcc
2022-09-10 08:29:48 +02:00
furszy
e06676377d
wallet: coverage for loading an unknown descriptor
Previously, this was crashing the wallet.
2022-09-09 15:35:31 -03:00
furszy
d26c3cc444
wallet: bugfix, load wallet with an unknown descriptor cause fatal error
If the descriptor entry is unrecognized/corrupt, the unserialization fails and
`LoadWallet` instead of stop there and return the error, continues reading all
the db records. As other records tied to the unrecognized/corrupted descriptor
are scanned, a fatal error is thrown.
2022-09-09 15:35:04 -03:00
James O'Beirne
00eeb31c76 scripted-diff: rename CChainState -> Chainstate
-BEGIN VERIFY SCRIPT-
sed -i 's/CChainState/Chainstate/g' $(git grep -l CChainState ':(exclude)doc/release-notes*')
-END VERIFY SCRIPT-

Co-authored-by: MacroFake <falke.marco@gmail.com>
2022-09-09 11:47:27 -04:00
MacroFake
ef5bb742f0
Merge bitcoin/bitcoin#26040: doc: comment "add only reachable addresses to addrman"
ce42570266 doc: comment "add only reachable addresses to addrman" (Kristaps Kaupe)

Pull request description:

  Proposed by Sjors during review of #25678, was likely just missed, as it also for me looks a code where comment will not hurt.

  https://github.com/bitcoin/bitcoin/pull/25678#discussion_r964482832

ACKs for top commit:
  mzumsande:
    ACK ce42570266
  vasild:
    ACK ce42570266
  Zero-1729:
    re-ACK ce42570266

Tree-SHA512: ef085d527349de07c1b43ed39e55e34b29cb0137c9509bd14a1af88206f7d4aa7dfec1dca53a9deaed67a2d0f32fa21e0b1a04d4d5d7f8a265dfab3b62bf8c54
2022-09-09 17:23:41 +02:00
glozow
1b348d2725
[mempool] replace update_descendant_state with lambda
These were introduced in commit 5add7a7, when the codebase was
pre-C++11. They are no longer necessary.
2022-09-09 11:08:02 +01:00
MacroFake
19585eeb77
Merge bitcoin/bitcoin#25853: net: update testnet torv3 hardcoded seeds for 24.x
2ef33e936e contrib: update testnet torv3 hardcoded seeds (Jon Atack)

Pull request description:

  As a follow-up to https://github.com/bitcoin/bitcoin/issues/13550 and #22060, replace the mostly unreachable testnet torv3 hardcoded seeds from v0.22 with new ones that are consistently reachable recently and that have service bit 1 set.

  This needs to be done before v24.0 to make sure onion-only testnet nodes can still connect to the network.

  Ways to test:

  - Re-generate `src/chainparamsseeds.h` with `cd contrib/seeds && python3 generate-seeds.py . > ../../src/chainparamsseeds.h`, check if git tree stays the same
  - Re-compile and create a new testnet node with `bitcoind -testnet -dnsseed=0 -onlynet=onion -proxy=127.0.0.1:9050` (or delete `~/.bitcoin/testnet3/peers.dat` and launch bitcoind with `-testnet -dnsseed=0`). Make sure there are no `addnode=` in your `bitcoin.conf`. The debug log should print "Adding fixed seeds".  Check if the node is able to connect to the network and get blocks with for ex. `watch -t ./src/bitcoin-cli -testnet -rpcwait -netinfo 4`
  - Check the addrman contains the seeds by running for ex. `bitcoin-cli -rpcwait -testnet getnodeaddresses 0 onion | jq -r '.[] | (.address + ":" + (.port|tostring) + " " + (.services|tostring))' | sort`

  - Check if the addresses are connectable, for ex. with this python script by laanwj:

  ```python3
  #!/usr/bin/env python3
  import pprint
  import subprocess
  with open('contrib/seeds/nodes_test.txt') as f:
      for line in (line for line in (line.rstrip().split('#', 1)[0] for line in f) if line):
          pprint.pprint(line)
          subprocess.call(["nc", "-v", "-x", "127.0.0.1:9050", "-z"] + line.split(':'))
  ```

  Thanks to satsie (Stacie Waleyko) for help with the list.

ACKs for top commit:
  satsie:
    ACK 2ef33e936e
  laanwj:
    ACK 2ef33e936e

Tree-SHA512: 72d27ecba243089bd49c11e921855fba626a1e09ae9b17508254a3bbec4bec341ed6c3d5a4eabc2d37f20bafb8a47ecc7d125e0dda956512a9525ad83273ffd6
2022-09-09 10:07:39 +02:00
Kristaps Kaupe
ce42570266
doc: comment "add only reachable addresses to addrman" 2022-09-09 01:39:52 +03:00
fanquake
37095c7dc4
Merge bitcoin/bitcoin#25678: p2p: skip querying dns seeds if -onlynet disables IPv4 and IPv6
385f5a4c3f p2p: Don't query DNS seeds when both IPv4 and IPv6 are unreachable (Martin Zumsande)
91f0a7fbb7 p2p: add only reachable addresses to addrman (Martin Zumsande)

Pull request description:

  Currently, `-onlynet` does not work well in connection with initial peer discovery, because DNS seeds only resolve to IPv6 and IPv4 adresses:
  With `-onlynet=i2p`, we would load clearnet addresses from DNS seeds into addrman, be content our addrman isn't empty so we don't try to query hardcoded seeds (although these exist for i2p!), and never attempt to make an automatic outbound connection.
  With `-onlynet=onion` and `-proxy` set, we wouldn't load addresses via DNS, but will make AddrFetch connections (through a tor exit node) to a random clearnet peer the DNS seed resolves to (see https://github.com/bitcoin/bitcoin/issues/6808#issuecomment-147652505), thus breaching the `-onlynet` preference of the user - this has been reported in the two issues listed below.

  This PR proposes two changes:
  1.) Don't load addresses that are unreachable (so that we wouldn't connect to them) into addrman. This is already the case for addresses received via p2p addr messages, this PR implements the same for addresses received from DNS seeds and fixed seeds. This means that in the case of `-onlynet=onion`, we wouldn't load fixed seed IPv4 addresses into addrman, only the onion ones.
  2.) Skip trying the DNS seeds if neither IPv4 nor IPv6 are reachable and move directly to adding the hardcoded seeds from networks we can connect to. This is done by soft-setting `-dnsseed` to 0 in this case, unless `-dnsseed=1` was explicitly specified, in which case we abort with an `InitError`.

  Fixes #6808
  Fixes #12344

ACKs for top commit:
  naumenkogs:
    utACK 385f5a4c3f
  vasild:
    ACK 385f5a4c3f

Tree-SHA512: 33a8c29faccb2d9b937b017dba4ef72c10e05e458ccf258f1aed3893bcc37c2e984ec8de998d2ecfa54282abbf44a132e97d98bbcc24a0dcf1871566016a9b91
2022-09-07 18:28:42 +01:00
MacroFake
fc44d1796e
Merge bitcoin/bitcoin#25983: Prevent data race for pathHandlers
4296dde287 Prevent data race for `pathHandlers` (Hennadii Stepanov)

Pull request description:

  Fixes bitcoin/bitcoin#19341.

ACKs for top commit:
  ryanofsky:
    Code review ACK 4296dde287. This should protect the vector. It also seems to make the http_request_cb callback single threaded, but that seems ok, since it is just adding work queue items not actually processing requests.

Tree-SHA512: 1c3183100bbc80d8e83543da090b8f4521921cf30d444e3e4c87102bf7a1e67ccc4dfea7e9990ac49741b2a5708f259f4eced9d4049c20ae4e531461532a6aef
2022-09-07 11:27:10 +02:00
Hennadii Stepanov
8ed2b72767
qt: Prevent wrong handling of %2 token by Transifex
Transifex must expect a `%2` token in the translated string, not a
`%2GB` one.
2022-09-07 10:53:48 +02:00
Hennadii Stepanov
5f28fc8160
qt: Cleanup translation comment 2022-09-07 10:09:57 +02:00
Andrew Chow
124e75a41e
Merge bitcoin/bitcoin#26010: RPC: fix sendall docs
5182940996 RPC: fix sendall docs (Anthony Towns)

Pull request description:

  Updates the documentation for the "inputs" entry in the "options"
  parameter of the sendall RPC to match the documentation for
  createrawtransaction.

ACKs for top commit:
  achow101:
    ACK 5182940996
  Xekyo:
    ACK 5182940996

Tree-SHA512: fe78e17b2f36190939b645d7f4653d025bbac110e4a7285b49e7f1da27adac8c4d03fd5b770e3a74351066b1ab87fde36fc796f42b03897e4e2ebef4b6b6081c
2022-09-06 18:00:57 -04:00
Martin Zumsande
385f5a4c3f p2p: Don't query DNS seeds when both IPv4 and IPv6 are unreachable
This happens, for example, if the user specified -onlynet=onion or
-onlynet=i2p. DNS seeds only resolve to IPv4 / IPv6 addresses,
making their answers useless to us, since we don't want to make
connections to these.
If, within the DNS seed thread, we'd instead do fallback AddrFetch
connections to one of the clearnet addresses the DNS seed resolves to,
we might get usable addresses from other networks
if lucky, but would be violating our -onlynet user preference
in doing so.

Therefore, in this case it is better to rely on fixed seeds for networks we
want to connect to.

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2022-09-06 15:16:35 -04:00
Martin Zumsande
91f0a7fbb7 p2p: add only reachable addresses to addrman
We will not make outgoing connection to peers that are unreachable
(e.g. because of -onlynet configuration).
Therefore, it makes no sense to add them to addrman in the first place.
While this is already the case for addresses received via p2p addr
messages, this commit does the same for addresses received
from fixed seeds.
2022-09-06 15:16:17 -04:00
MacroFake
447f50e4ae
Merge bitcoin/bitcoin#25946: Update chainparams for 24.0 release
767d825e27 Update chainparams for 24.0 release (Janna)

Pull request description:

  Update chain parameters for upcoming major release.
  See [doc/release-process.md](https://github.com/bitcoin/bitcoin/blob/master/doc/release-process.md) and #24418 for review instructions.

  fixes #25921

ACKs for top commit:
  Sjors:
    tACK 767d825e27
  achow101:
    utACK 767d825e27

Tree-SHA512: 153390203c76c981cc41629a27ec3e52fec089c7ce6edba3dd4d77c875c7d8afcae64be2bd9bc8af73f70c2dc0a08666f2986ac82c9fd536b0fded10fd8dec3d
2022-09-06 17:46:45 +02:00
Vasil Dimov
2d0b4e4ff6
init: allow startup with -onlynet=onion -listenonion=1
It does not make sense to specify `-onlynet=onion` without providing a
Tor proxy (even if other `-onlynet=...` are given). This is checked
during startup. However, it was forgotten that a Tor proxy can also be
retrieved from "Tor control" to which we connect if `-listenonion=1`.

So, the full Tor proxy retrieval logic is:
1. get it from `-onion`
2. get it from `-proxy`
3. if `-listenonion=1`, then connect to "Tor control" and get the proxy
   from there (was forgotten before this change)

Fixes https://github.com/bitcoin/bitcoin/issues/24980
2022-09-05 17:52:08 +02:00
Anthony Towns
5182940996 RPC: fix sendall docs
Updates the documentation for the "inputs" entry in the "options"
parameter of the sendall RPC to match the documentation for
createrawtransaction.
2022-09-05 23:23:23 +10:00
glozow
5291933fed
Merge bitcoin/bitcoin#25768: wallet: Properly rebroadcast unconfirmed transaction chains
3405f3eed5 test: Test that an unconfirmed not-in-mempool chain is rebroadcast (Andrew Chow)
10d91c5abe wallet: Deduplicate Resend and ReacceptWalletTransactions (Andrew Chow)

Pull request description:

  Currently `ResendWalletTransactions` (used for normal rebroadcasts) will attempt to rebroadcast all of the transactions in the wallet in the order they are stored in `mapWallet`. This ends up being random as `mapWallet` is a `std::unordered_map`. However `ReacceptWalletTransactions` (used for adding to the mempool on loading) first sorts the txs by wallet insertion order, then submits them. The result is that `ResendWalletTranactions` will fail to rebroadcast child transactions if their txids happen to be lexicographically less than their parent's txid. This PR resolves this issue by combining `ReacceptWalletTransactions` and `ResendWalletTransactions` into a new `ResubmitWalletTransactions` so that the iteration code and basic checks are shared.

  A test has also been added that checks that such transaction chains are rebroadcast correctly.

ACKs for top commit:
  naumenkogs:
    utACK 3405f3eed5
  1440000bytes:
    reACK 3405f3eed5
  furszy:
    Late code review ACK 3405f3ee
  stickies-v:
    ACK 3405f3eed5

Tree-SHA512: 1240d9690ecc2ae8d476286b79e2386f537a90c41dd2b8b8a5a9c2a917aa3af85d6aee019fbbb05e772985a2b197e2788305586d9d5dac78ccba1ee5aa31d77a
2022-09-05 13:54:36 +01:00
fanquake
a7dbf74d72
test: remove Boost Test from libtest util
Context is the discussion here:
https://github.com/bitcoin/bitcoin/pull/25974/files#r961541457.
2022-09-05 07:59:34 +01:00
Hennadii Stepanov
4296dde287
Prevent data race for pathHandlers 2022-09-02 12:50:12 +01:00
MacroFake
ea67232cdb
Merge bitcoin/bitcoin#25962: net: Add CNodeOptions and increase constness
377e9ccda4 scripted-diff: net: rename permissionFlags to permission_flags (Anthony Towns)
0a7fc42897 net: make CNode::m_prefer_evict const (Anthony Towns)
d394156b99 net: make CNode::m_permissionFlags const (Anthony Towns)
9dccc3328e net: add CNodeOptions for optional CNode constructor params (Anthony Towns)

Pull request description:

  Adds CNodeOptions to make it easier to add optional parameters to the CNode constructor, and makes prefer_evict and m_permissionFlags actually const.

ACKs for top commit:
  naumenkogs:
    ACK 377e9ccda4
  jonatack:
    ACK 377e9ccda4 per `git range-diff 52dcb1d 2f3602b 377e9cc`
  vasild:
    ACK 377e9ccda4
  ryanofsky:
    Code review ACK 377e9ccda4. Looks good and feel free to ignore suggestions!

Tree-SHA512: 06fd6748770bad75ec8c966fdb73b7534c10bd61838f6f1b36b3f3d6a438e58f6a7d0edb011977e5c118ed7ea85325fac35e10dde520fef249f7a780cf500a85
2022-09-02 09:50:46 +02:00
Andrew Chow
7281fac2e0
Merge bitcoin/bitcoin#25614: Severity-based logging, step 2
9580480570 Update debug logging section in the developer notes (Jon Atack)
1abaa31aa3 Update -debug and -debugexclude help docs for severity level logging (Jon Atack)
45f9282162 Create BCLog::Level::Trace log severity level (Jon Atack)
2a8712db4f Unit test coverage for -loglevel configuration option (klementtan)
eb7bee5f84 Create -loglevel configuration option (klementtan)
98a1f9c687 Unit test coverage for log severity levels (klementtan)
9c7507bf76 Create BCLog::Logger::LogLevelsString() helper function (klementtan)
8fe3457dbb Update LogAcceptCategory() and unit tests with log severity levels (klementtan)
c2797cfc60 Add BCLog::Logger::SetLogLevel()/SetCategoryLogLevel() for string inputs (klementtan)
f6c0cc0350 Add BCLog::Logger::m_category_log_levels data member and getter/setter (Jon Atack)
2978b387bf Add BCLog::Logger::m_log_level data member and getter/setter (Jon Atack)
f1379aeca9 Simplify BCLog::Level enum class and LogLevelToStr() function (Jon Atack)

Pull request description:

  This is an updated version of https://github.com/bitcoin/bitcoin/pull/25287 and the next steps in parent PR #25203 implementing, with Klement Tan, user-configurable, per-category severity log levels based on an idea by John Newbery and refined in GitHub discussions by Wladimir Van der Laan and Marco Falke.

  - simplify the `BCLog::Level` enum class and the `LogLevelToStr()` function and add documentation
  - update the logging logic to filter logs by log level both globally and per-category
  - add a hidden `-loglevel` help-debug config option to allow testing setting the global or per-category severity level on startup for logging categories enabled with the `-debug` configuration option or the logging RPC (Klement Tan)
  - add a `trace` log severity level selectable by the user; the plan is for the current debug messages to become trace, LogPrint ones to become debug, and LogPrintf ones to become info, warning, or error

  ```
  $ ./src/bitcoind -help-debug | grep -A10 loglevel
    -loglevel=<level>|<category>:<level>
         Set the global or per-category severity level for logging categories
         enabled with the -debug configuration option or the logging RPC:
         info, debug, trace (default=info); warning and error levels are
         always logged. If <category>:<level> is supplied, the setting
         will override the global one and may be specified multiple times
         to set multiple category-specific levels. <category> can be:
         addrman, bench, blockstorage, cmpctblock, coindb, estimatefee,
         http, i2p, ipc, leveldb, libevent, lock, mempool, mempoolrej,
         net, proxy, prune, qt, rand, reindex, rpc, selectcoins, tor,
         util, validation, walletdb, zmq.
  ```

  See the individual commit messages for details.

ACKs for top commit:
  jonatack:
    One final push per `git range-diff a5d5569 ce3c4c9 9580480` (should be trivial to re-ACK) to ensure this pull changes no default behavior in any way for users or the tests/CI in order to be completely v24 compatible, to update the unit test setup in general, and to update the debug logging section in the developer notes.
  klementtan:
    reACK 9580480570
  1440000bytes:
    reACK 9580480570
  vasild:
    ACK 9580480570
  dunxen:
    reACK 9580480
  brunoerg:
    reACK 9580480570

Tree-SHA512: 476a638e0581f40b5d058a9992691722e8b546471ec85e07cbc990798d1197fbffbd02e1b3d081b4978404e07a428378cdc8e159c0004b81f58be7fb01b7cba0
2022-09-01 15:57:56 -04:00
Andrew Chow
7921026a24
Merge bitcoin/bitcoin#19602: wallet: Migrate legacy wallets to descriptor wallets
53e7ed075c doc: Release notes and other docs for migration (Andrew Chow)
9c44bfe244 Test migratewallet (Andrew Chow)
0b26e7cdf2 descriptors: addr() and raw() should return false for ToPrivateString (Andrew Chow)
31764c3f87 Add migratewallet RPC (Andrew Chow)
0bf7b38bff Implement MigrateLegacyToDescriptor (Andrew Chow)
e7b16f925a Implement MigrateToSQLite (Andrew Chow)
5b62f095e7 wallet: Refactor SetupDescSPKMs to take CExtKey (Andrew Chow)
22401f17e0 Implement LegacyScriptPubKeyMan::DeleteRecords (Andrew Chow)
35f428fae6 Implement LegacyScriptPubKeyMan::MigrateToDescriptor (Andrew Chow)
ea1ab390e4 scriptpubkeyman: Implement GetScriptPubKeys in Legacy (Andrew Chow)
e664af2976 Apply label to all scriptPubKeys of imported combo() (Andrew Chow)

Pull request description:

  This PR adds a new `migratewallet` RPC which migrates a legacy wallet to a descriptor wallet. Migrated wallets will need a new backup. If a wallet has watchonly stuff in it, a new watchonly descriptor wallet will be created containing those watchonly things. The related transactions, labels, and descriptors for those watchonly things will be removed from the original wallet. Migrated wallets will not have any of the legacy things be available for fetching from `getnewaddress` or `getrawchangeaddress`. Wallets that have private keys enabled will have newly generated descriptors. Wallets with private keys disabled will not have any active `ScriptPubKeyMan`s.

  For the basic HD wallet case of just generated keys, in addition to the standard descriptor wallet descriptors using the master key derived from the pre-existing hd seed, the migration will also create 3 descriptors for each HD chain in: a ranged combo external, a ranged combo internal, and a single key combo for the seed (the seed is a valid key that we can receive coins at!). The migrated wallet will then have newly generated descriptors as the active `ScriptPubKeyMan`s. This is equivalent to creating a new descriptor wallet and importing the 3 descriptors for each HD chain. For wallets containing non-HD keys, each key will have its own combo descriptor.

  There are also tests.

ACKs for top commit:
  Sjors:
    tACK 53e7ed075c
  w0xlt:
    reACK 53e7ed075c

Tree-SHA512: c0c003694ca2e17064922d08e8464278d314e970efb7df874b4fe04ec5d124c7206409ca701c65c099d17779ab2136ae63f1da2a9dba39b45f6d62cf93b5c60a
2022-09-01 15:43:30 -04:00
MacroFake
36e1b52511
Merge bitcoin/bitcoin#25951: log: Move validation option logging to LoadChainstate()
fa4c59d65b Move blockstorage option logging to LoadChainstate() (MacroFake)
fa3358b668 Move validation option logging to LoadChainstate() (MacroFake)

Pull request description:

  This would allow libbitcoinkernel users to see the options logged as well. Currently they would only be logged for bitcoind. Behavior change suggested in the refactoring pull https://github.com/bitcoin/bitcoin/pull/25704#discussion_r956166460

ACKs for top commit:
  ryanofsky:
    Code review ACK fa4c59d65b. Only change since last review is moving pruning logprints out of `AppInitParameterInteraction` as suggested
  jonatack:
    Review ACK  fa4c59d65b

Tree-SHA512: f27508ca06a78ef162f002d556cf830df374fe95fd4f10bf22c24b6b48276ce49f52f82ffedc43596c872ddcf08321ca03651495fd3abde16254cb8afab39d33
2022-09-01 19:49:11 +02:00
Andrew Chow
3118425ff9
Merge bitcoin/bitcoin#25931: rpc: sort listdescriptors result
50996241f2 rpc: sort listdescriptors result (Sjors Provoost)

Pull request description:

  This puts receive and change descriptors directly below each other.

  The change would be simpler if `UniValue` arrays were sortable.

ACKs for top commit:
  achow101:
    ACK 50996241f2
  S3RK:
    reACK 50996241f2
  furszy:
    utACK 50996241
  w0xlt:
    reACK 50996241f2

Tree-SHA512: 71246a48ba6f97c3e7c76ee32ff9e958227a14ca5a6eec638215dbfee57264d4e918ea5837f4d030eddc9c797c93df1791ddd55b5a499522ce2a35bcf380670b
2022-09-01 11:50:02 -04:00
MacroFake
fa4c59d65b
Move blockstorage option logging to LoadChainstate() 2022-09-01 17:07:45 +02:00
Anthony Towns
377e9ccda4 scripted-diff: net: rename permissionFlags to permission_flags
-BEGIN VERIFY SCRIPT-
sed -i 's/permissionFlags/permission_flags/g' $(git grep -l permissionFlags)
-END VERIFY SCRIPT-
2022-09-01 20:55:22 +10:00
Anthony Towns
0a7fc42897 net: make CNode::m_prefer_evict const 2022-09-01 20:54:35 +10:00
Anthony Towns
d394156b99 net: make CNode::m_permissionFlags const 2022-09-01 20:53:57 +10:00
Anthony Towns
9dccc3328e net: add CNodeOptions for optional CNode constructor params 2022-09-01 20:52:20 +10:00
Hennadii Stepanov
b2544d1ee3
qt: Update translation source file for string freeze 2022-09-01 10:32:05 +01:00
MacroFake
fa5c224d44
Merge bitcoin/bitcoin#25887: init: avoid unsetting service bits from nLocalServices
1b5bec78e9 init: avoid unsetting service bits from `nLocalServices` (Sebastian Falbesoner)

Pull request description:

  This PR is a late follow-up to the [review club session about the PR "Default to NODE_WITNESS in nLocalServices" ](https://bitcoincore.reviews/21090#l-90) (#21090):

  ```
  17:32 <lightlike> hmm, if we are in pruned mode, we first set NODE_NETWORK and then unset it later in init.cpp. that seems a bit strange.
  ...
  17:33 <jnewbery> lightlike: ah yes, you're right. That does seem a bit messy.
  ```

  Rather than setting the service bit `NODE_NETWORK` first and then unset it (if in `fPruneMode`), start with the bare minimum flags that we always serve and only add `NODE_NETWORK` if we are running as a non-pruned node. This seems to be a more logical approach than currently on master.

ACKs for top commit:
  naumenkogs:
    ACK 1b5bec78e9
  stickies-v:
    ACK 1b5bec78e9
  LarryRuane:
    ACK 1b5bec78e9

Tree-SHA512: 2e82d66c4298ffacff41d9e0458b74b83bc156a1fa49e3f3471e942878e5dd2b253b5597ee5ec1d9c8726b432751d05e40f0c580f3976a9e00a7d1f417921ab0
2022-09-01 10:37:00 +02:00
MacroFake
ccea0e11a2
Merge bitcoin/bitcoin#25959: doc: Fix link to MurmurHash3.cpp (moved from Google Code to Github)
2c05dc7811 Fix link to MurmurHash3.cpp from Austin Appleby (dontbyte)

Pull request description:

  Google Code repo doesn't exist anymore

ACKs for top commit:
  Zero-1729:
    crACK 2c05dc7811

Tree-SHA512: 3e095255757b536f382ffb63e4292413592246c2446d486acbb71c52e4a3ece519d7cfae941685d9e25fd62de5c783510b3d076cd990a3d391496dc3076a0385
2022-09-01 09:54:00 +02:00
MacroFake
f821fc9813
Merge bitcoin/bitcoin#25967: refactor: add LIFETIMEBOUND to blockfilter where needed
89576ccc57 refactor: add LIFETIMEBOUND to blockfilter where needed (stickies-v)

Pull request description:

  Noticed from https://github.com/bitcoin/bitcoin/pull/25637#issuecomment-1231860822 that [`BlockFilter::GetFilter()`](01e1627e25/src/blockfilter.h (L132)) returns a reference to a member variable. Added LIFETIMEBOUND to all blockfilter-related code to ensure that the return values do not have a lifetime that exceeds the lifetime of what it is bound to. See https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#lifetimebound or https://github.com/bitcoin/bitcoin/pull/25060 for a similar example.

  I used `grep -E '[a-zA-Z>0-9][&*] ([a-zA-Z]*)\((.*)\)' src/**/blockfilter*` to grep all possible occurrences (not all of them require LIFETIMEBOUND)

ACKs for top commit:
  brunoerg:
    crACK 89576ccc57

Tree-SHA512: 6fe61fc0c1ed9e446edce083d1b093e1a5e2ef8c39ff74125bb12a24e514d45711845809817fbd4a04d7a9c23c8b362203771c17b6d831d2560b1af268453019
2022-09-01 09:47:18 +02:00