Commit graph

23943 commits

Author SHA1 Message Date
ismaelsadeeq
16bb9161fa
tx fees, policy: do not read estimates of old fee_estimates.dat
Old fee estimates could cause transactions to become stuck in the
mempool. This commit prevents the node from using stale estimates
from an old file.

Github-Pull: #27622
Rebased-From: 3eb241a141
2023-10-02 13:09:01 +01:00
ismaelsadeeq
c4dd5989b3
tx fees, policy: periodically flush fee estimates to fee_estimates.dat
This reduces chances of having old estimates in fee_estimates.dat.

Github-Pull: #27622
Rebased-From: 5b886f2b43
2023-10-02 13:09:01 +01:00
furszy
0d2a33e05c
wallet: disallow migration of invalid or not-watched scripts
The legacy wallet allowed to import any raw script, without checking if
it was valid or not. Appending it to the watch-only set.

This causes a crash in the migration process because we are only
expecting to find valid scripts inside the legacy spkm.

These stored scripts internally map to `ISMINE_NO` (same as if they
weren't stored at all..).

So we need to check for these special case, and take into account that
the legacy spkm could be storing invalid not watched scripts.

Which, in code words, means IsMineInner() returning IsMineResult::INVALID
for them.

Github-Pull: #28125
Rebased-From: 1de8a2372a
2023-10-02 13:09:01 +01:00
Pieter Wuille
2c51a07c08
Do not use std::vector = {} to release memory
Github-Pull: #28452
Rebased-From: 3fcd7fc7ff
2023-10-02 13:09:00 +01:00
Hennadii Stepanov
88b525f93a
qt: 25.1rc1 translations update 2023-09-28 15:50:04 +01:00
furszy
6d5a510dcd
descriptor: InferScript, do not return top-level only func as sub descriptor
e.g. sh(addr(ADDR)) or sh(raw(HEX)) are invalid descriptors.

Making sh and wsh top level functions to return addr/raw descriptors when
the subscript inference fails.

Github-Pull: #28067
Rebased-From: cc781a2180
2023-07-21 09:38:35 +01:00
furszy
4b16650c10
wallet: migration bugfix, persist empty labels
addressbook records with no associated label could be
treated as change. And we don't want that for external
addresses.

Github-Pull: #28038
Rebased-From: a277f8357a
2023-07-07 17:31:14 +01:00
furszy
59b06b696a
wallet: migration bugfix, clone 'send' record label to all wallets
Github-Pull: #28038
Rebased-From: 1b64f6498c
2023-07-07 17:30:53 +01:00
Greg Sanders
b8ad3220a9
Unconditionally return when compact block status == READ_STATUS_FAILED
Github-Pull: #27743
Rebased-From: d972695797
2023-06-16 10:17:22 +01:00
Greg Sanders
e66a5cbb56
Support up to 3 parallel compact block txn fetchings
A single outbound slot is required, so if the first two slots
are taken by inbound in-flights, the node will reject additional
unless they are coming from outbound.

This means in the case where a fast sybil peer is attempting to
stall out a node, a single high bandwidth outbound peer can
mitigate the attack.

Github-Pull: #27626
Rebased-From: 03423f8bd1
2023-06-16 10:17:22 +01:00
Greg Sanders
d1a93f5d41
Only request full blocks from the peer we thought had the block in-flight
This is a change in behavior so that if for some reason we request a block from a peer, we don't allow an unsolicited CMPCT_BLOCK announcement for that same block to cause a request for a full block from the uninvited peer (as some type of request is already outstanding from the original peer)

Github-Pull: #27626
Rebased-From: 13f9b20b4c
2023-06-16 10:17:22 +01:00
Greg Sanders
38e3af9fad
Convert mapBlocksInFlight to a multimap
Github-Pull: #27626
Rebased-From: cce96182ba
2023-06-16 10:17:22 +01:00
Greg Sanders
a45159b8e2
Remove nBlocksInFlight
Github-Pull: #27626
Rebased-From: a90595478d
2023-06-16 10:17:21 +01:00
Greg Sanders
722361e129
alias BlockDownloadMap for mapBlocksInFlight
Github-Pull: #27626
Rebased-From: 86cff8bf18
2023-06-16 10:17:21 +01:00
brunoerg
72ead8699f
rest: bugfix, fix crash error when calling /deploymentinfo
Github-Pull: #27853
Rebased-From: ce887eaf49
2023-06-15 10:38:28 +01:00
MarcoFalke
796e1145a9
rpc: Fix invalid bech32 handling
Github-Pull: #27727
Rebased-From: eeee55f928
2023-05-25 11:15:27 +01:00
Anthony Towns
7ef71e30c9
net_processing: Boost inv trickle rate
If transactions are being added to the mempool at a rate faster than 7tx/s
(INVENTORY_BROADCAST_PER_SECOND) then peers' inventory_to_send queue can
become relatively large. If this happens, increase the number of txids
we include in an INV message (normally capped at 35) by 5 for each 1000
txids in the queue.

This will tend to clear a temporary excess out reasonably quickly; an
excess of 4000 invs to send will be cleared down to 1000 in about 30
minutes, while an excess of 20000 invs would be cleared down to 1000 in
about 60 minutes.

Github-Pull: #27610
Rebased-From: 5b3406094f
2023-05-11 14:30:20 +01:00
Anthony Towns
1adbcd302f
txmempool: have CompareDepthAndScore sort missing txs first
We use CompareDepthAndScore to choose an order of txs to inv. Rather
than sorting txs that have been evicted from the mempool at the end
of the list, sort them at the beginning so they are removed from
the queue immediately.

Github-Pull: #27610
Rebased-From: 228e9201ef
2023-05-11 14:29:54 +01:00
Suhas Daftuar
9a23079df3
p2p: Avoid prematurely clearing download state for other peers
Github-Pull: #27608
Rebased-From: 52e52071e0
2023-05-10 10:14:17 +01:00
Hennadii Stepanov
20c076d056
qt: 25.0rc2 translations update 2023-05-03 21:03:14 +01:00
Jon Atack
31b1798d2c p2p: update hardcoded mainnet seeds for 25.x 2023-04-20 06:08:22 -07:00
fanquake
a2bef805c1
kernel: update m_assumed_* chain params for 25.x
Co-authored-by: johnny9 <985648+johnny9@users.noreply.github.com>
2023-04-18 11:57:29 +01:00
fanquake
4128e01dba
kernel: update chainTxData for 25.x
Co-authored-by: johnny9 <985648+johnny9@users.noreply.github.com>
2023-04-18 11:48:16 +01:00
fanquake
00b2b114b4
kernel: update nMinimumChainWork & defaultAssumeValid for 25.x
Co-authored-by: johnny9 <985648+johnny9@users.noreply.github.com>
2023-04-18 11:48:13 +01:00
fanquake
07fcc0a82c
doc: update references to kernel/chainparams.cpp 2023-04-18 11:02:05 +01:00
Andrew Chow
4ad20a2258
Merge bitcoin/bitcoin#27473: bugfix: Properly handle "unknown" Address Type
0d6383fda0 Don't return OutputType::UNKNOWN in ParseOutputType (Pttn)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/27472 by also handling at the relevant places the case where ParseOutputType returns `OutputType::UNKNOWN`, and not just when it returns `std::nullopt`.

ACKs for top commit:
  achow101:
    ACK 0d6383fda0
  MarcoFalke:
    lgtm ACK 0d6383fda0
  furszy:
    ACK 0d6383fda0

Tree-SHA512: 776793027b926283d3162e69fb9c8883c814b19bcce4574ccdf8e3140a1ec4ebc4aa8ccd1abae7ef3571f942d2e6c35305fd1244259540d90605106e01afc34c
2023-04-17 10:18:04 -04:00
fanquake
e054b7390c
Merge bitcoin/bitcoin#27468: bugfix: rest: avoid segfault for invalid URI
11422cc572 bugfix: rest: avoid segfault for invalid URI (pablomartin4btc)

Pull request description:

  Minimal fix to get it promptly into 25.0 release (suggested by  [stickies-v](https://github.com/bitcoin/bitcoin/pull/27253#pullrequestreview-1385130381) and supported by [vasild](https://github.com/bitcoin/bitcoin/pull/27253#pullrequestreview-1385842606)  )

  Please check #27253 for reviewers comments and acks regarding this PR and read the commit comment message body for more details about the fix.

ACKs for top commit:
  achow101:
    ACK 11422cc572
  stickies-v:
    re-ACK 11422cc

Tree-SHA512: 5af6b53fb266a12b463f960910556d5e97bc88b3c2a4f437ffa343886b38749e1eb058cf7bc64d62e82e1acf6232a186bddacd8f3b4500c87bf9e550a0153386
2023-04-17 15:11:15 +01:00
pablomartin4btc
11422cc572 bugfix: rest: avoid segfault for invalid URI
`evhttp_uri_parse` can return a nullptr, for example when the URI
contains invalid characters (e.g. "%").
`GetQueryParameterFromUri` passes the output of `evhttp_uri_parse`
straight into `evhttp_uri_get_query`, which means that anyone calling
a REST endpoint in which query parameters are used (e.g. `rest_headers`)
can cause a segfault.

This bugfix is designed to be minimal and without additional behaviour change.
Follow-up work should be done to resolve this in a more general and robust way,
so not every endpoint has to handle it individually.
2023-04-17 10:13:34 -03:00
Pttn
0d6383fda0 Don't return OutputType::UNKNOWN in ParseOutputType
Fixes https://github.com/bitcoin/bitcoin/issues/27472

Signed-off-by: Pttn <28868425+Pttn@users.noreply.github.com>
2023-04-16 23:48:05 +02:00
fanquake
90bfa9d2d7
Merge bitcoin/bitcoin#27308: bumpfee: avoid making bumped transactions with too low fee when replacing outputs
d52fa1b0a5 tests: Make sure that bumpfee feerate checks work when replacing outputs (Andrew Chow)
be177c15a4 bumpfee: Check the correct feerate when replacing outputs (Andrew Chow)

Pull request description:

  When replacing the outputs of a transaction during `bumpfee`, it is possible to accidentally create a transaction that will not be accepted into the mempool as it does not meet the incremental relay fee requirements. This occurs because the size estimation used for checking the provided feerate does not account for the replaced outputs; it instead uses the original outputs. When the replaced outputs is significantly different from the original, there can be a large difference in estimated transaction sizes that can make a transaction miss the absolute fee requirements for the incremental relay fee. Unfortunately we do not currently inform the user when the bumped transaction fails to relay, so they could use `bumpfee` and think the transaction has been bumped when it actually has not.

  This issue is resolved by replacing the outputs before doing the size estimation, and also updating the feerate checker to use the actual fee values when calculating the required minimum fee.

  Also added a test for this scenario.

ACKs for top commit:
  ishaanam:
    reACK d52fa1b0a5
  Xekyo:
    reACK d52fa1b0a5

Tree-SHA512: d18301b587465322dd3fb1bb86496c3675265a56072047576e2baa5cf907dd3b54778f30721f662f0c235709a5568427c18542eb7efbfb6fdd9f481fe676c66b
2023-04-15 12:55:10 +01:00
Pieter Wuille
f5fdd4e279 Update src/secp256k1 to latest upstream master (v0.3.1 + CI fix) 2023-04-14 10:35:51 -04:00
Pieter Wuille
c981671e9b Squashed 'src/secp256k1/' changes from bdf39000b9..4258c54f4e
4258c54f4e Merge bitcoin-core/secp256k1#1276: autotools: Don't regenerate Wycheproof header automatically
06c67dea9f autotools: Don't regenerate Wycheproof header automatically
3bab71cf05 Merge bitcoin-core/secp256k1#1268: release cleanup: bump version after 0.3.1
656c6ea8d8 release cleanup: bump version after 0.3.1
346a053d4c Merge bitcoin-core/secp256k1#1269: changelog: Fix link
6a37b2a5ea changelog: Fix link
ec98fcedd5 Merge bitcoin-core/secp256k1#1266: release: Prepare for 0.3.1
898e1c676e release: Prepare for 0.3.1
1d9a13fc26 changelog: Remove inconsistent newlines
0e091669a1 changelog: Catch up in preparation of 0.3.1
7b7503dac5 Merge bitcoin-core/secp256k1#1245: tests: Add Wycheproof ECDSA vectors
145078c418 Merge bitcoin-core/secp256k1#1118: Add x-only ecmult_const version with x specified as n/d
e5de454609 tests: Add Wycheproof ECDSA vectors
0f8642079b Add exhaustive tests for ecmult_const_xonly
4485926ace Add x-only ecmult_const version for x=n/d
a0f4644f7e Merge bitcoin-core/secp256k1#1252: Make position of * in pointer declarations in include/ consistent
4e682626a3 Merge bitcoin-core/secp256k1#1226: Add CMake instructions to release process
2d51a454fc Merge bitcoin-core/secp256k1#1257: ct: Use volatile "trick" in all fe/scalar cmov implementations
4a496a36fb ct: Use volatile "trick" in all fe/scalar cmov implementations
3d1f430f9f Make position of * in pointer declarations in include/ consistent
2bca0a5cbf Merge bitcoin-core/secp256k1#1241: build: Improve `SECP_TRY_APPEND_DEFAULT_CFLAGS` macro
afd8b23b27 Merge bitcoin-core/secp256k1#1244: Suppress `-Wunused-parameter` when building for coverage analysis
1d8f367515 Merge bitcoin-core/secp256k1#1250: No need to subtract 1 before doing a right shift
3e43041be6 No need to subtract 1 before doing a right shift
3addb4c1e8 build: Improve `SECP_TRY_APPEND_DEFAULT_CFLAGS` macro
0c07c82834 Add CMake instructions to release process
464a9115b4 Merge bitcoin-core/secp256k1#1242: Set ARM ASM symbol visibility to `hidden`
f16a709fd6 Merge bitcoin-core/secp256k1#1247: Apply Checks only in VERIFY mode.
70be3cade5 Merge bitcoin-core/secp256k1#1246: Typo
4ebd82852d Apply Checks only in VERIFY mode.
d1e7ca192d Typo
5bb03c2911 Replace `SECP256K1_ECMULT_TABLE_VERIFY` macro by a function
9c8c4f443c Merge bitcoin-core/secp256k1#1238: build: bump CMake minimum requirement to 3.13
0cf2fb91ef Merge bitcoin-core/secp256k1#1243: build: Ensure no optimization when building for coverage analysis
fd2a408647 Set ARM ASM symbol visibility to `hidden`
4429a8c218 Suppress `-Wunused-parameter` when building for coverage analysis
8e79c7ed11 build: Ensure no optimization when building for coverage analysis
96dd062511 build: bump CMake minimum requirement to 3.13
427bc3cdcf Merge bitcoin-core/secp256k1#1236: Update comment for secp256k1_modinv32_inv256
647f0a5cb1 Update comment for secp256k1_modinv32_inv256
5658209459 Merge bitcoin-core/secp256k1#1228: release cleanup: bump version after 0.3.0
28e63f7ea7 release cleanup: bump version after 0.3.0

git-subtree-dir: src/secp256k1
git-subtree-split: 4258c54f4ebfc09390168e8a43306c46b315134b
2023-04-14 10:35:51 -04:00
Andrew Chow
2bfe43db16
Merge bitcoin/bitcoin#27374: p2p: skip netgroup diversity of new connections for tor/i2p/cjdns
b5585ba5f9 p2p: skip netgroup diversity of new connections for tor/i2p/cjdns networks (stratospher)

Pull request description:

  Follow up for #27264.

  In order to make sure that our persistent outbound slots belong to different netgroups, distinct net groups of our peers are added to `setConnected`. We’d only open a persistent outbound connection to peers which have a different netgroup compared to those netgroups present in `setConnected`.

  Current `GetGroup()` logic assumes route-based diversification behaviour for tor/i2p/cjdns addresses (addresses are public key based and not route-based). Distinct netgroups possible (according to the current `GetGroup()` logic) for:
  1. tor => 030f, 031f, .. 03ff (16 possibilities)
  2. i2p => 040f, 041f, .. 04ff (16 possibilities)
  3. cjdns => 05fc0f, 05fc1f, ... 05fcff (16 possibilities)

  `setConnected` is used in `ThreadOpenConnections()` before making [outbound](84f4ac39fd/src/net.cpp (L1846)) and [anchor](84f4ac39fd/src/net.cpp (L1805)) connections to new peers so that they belong to distinct netgroups.

  **behaviour on master**

  - if we run a node only on tor/i2p/cjdns
  - we wouldn't be able to open more than 16 outbound connections(manual, block-relay-only anchor, outbound full relay, block-relay-only connections) because we run out of possible netgroups.
  - see https://github.com/bitcoin/bitcoin/pull/27264#issuecomment-1481322628
  - tested by changing `MAX_OUTBOUND_FULL_RELAY_CONNECTIONS` to 17 with `onlynet=onion` and observed how node wouldn't make more than 16 outbound connections.

  **behaviour on PR**

  - netgroup diversity checks are skipped for tor/i2p/cjdns addresses.
  - we don't insert tor/i2p/cjdns address in `setConnected` and `GetGroup` doesn't get called on tor/i2p/cjdns(see #27369)

ACKs for top commit:
  achow101:
    ACK b5585ba5f9
  mzumsande:
    ACK b5585ba5f9
  vasild:
    ACK b5585ba5f9

Tree-SHA512: c120b3f9ca7f0be3f29ea665cd2f7dfb40cd1d7ec7058984252fb6e0295e414f736c5b4fba03c31188188a5ae4f543fb2654f6ee9776bad745c7ca72d23d5b9b
2023-04-13 18:21:54 -04:00
Hennadii Stepanov
a45b54406d
qt: Register wallet::AddressPurpose type 2023-04-13 12:03:06 +01:00
Andrew Chow
6a167325f0
Merge bitcoin/bitcoin#27279: Add "warnings", deprecate "warning" in {create,load,unload,restore}wallet
7ccdd741fe test: fix importmulti/importdescriptors assertion (Jon Atack)
19d888ce40 rpc: move WALLET_FLAG_CAVEATS to the compilation unit of its caller (Jon Atack)
01df011ca2 doc: release note for wallet RPCs "warning" field deprecation (Jon Atack)
9ea8b3739a test: createwallet "warning" field deprecation test (Jon Atack)
645d7f75ac rpc: deprecate "warning" field in {create,load,unload,restore}wallet (Jon Atack)
2f4a926e95 test: add test coverage for "warnings" field in createwallet (Jon Atack)
4a1e479ca6 rpc: add "warnings" field to RPCs {create,load,unload,restore}wallet (Jon Atack)
079d8cdda8 rpc: extract wallet "warnings" fields to a util helper (Jon Atack)
f73782a903 doc: fix/improve warning helps in {create,load,unload,restore}wallet (Jon Atack)

Pull request description:

  Based on discussion and concept ACKed in #27138, add a `warnings` field to RPCs createwallet, loadwallet, unloadwallet, and restorewallet as a JSON array of strings to replace the `warning` string field in these 4 RPCs. The idea is to more gracefully handle multiple warning messages and for consistency with other wallet RPCs.  Then, deprecate the latter fields, which represent all the remaining RPC `warning` fields.

  The first commit f73782a903 implements https://github.com/bitcoin/bitcoin/pull/27138#issuecomment-1474789198 as an alternative to #27138. One of those two could potentially be backported to our currently supported releases.

ACKs for top commit:
  achow101:
    ACK 7ccdd741fe
  1440000bytes:
    utACK 7ccdd741fe
  vasild:
    ACK 7ccdd741fe
  pinheadmz:
    re-ACK 7ccdd741fe

Tree-SHA512: 314e0a4c41fa383d95e2817bfacf359d449e460529d235c3eb902851e2f4eacbabe646d9a5a4beabc4964cdfabf6397ed8301366a58d344a2f787f83b75e9d64
2023-04-12 13:09:23 -04:00
Andrew Chow
e83babe3b8 wallet: Replace use of purpose strings with an enum
Instead of storing and passing around fixed strings for the purpose of
an address, use an enum.

This also rationalizes the CAddressBookData struct, documenting all fields and
making them public, and simplifying the representation to avoid bugs like
https://github.com/bitcoin/bitcoin/pull/26761#discussion_r1134615114 and make
it not possible to invalid address data like change addresses with labels.

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2023-04-11 15:55:31 -04:00
Ryan Ofsky
2f80005136 wallet: add AddressPurpose enum to replace string values 2023-04-11 15:52:25 -04:00
Ryan Ofsky
8741522e6c wallet: Add wallet/types.h for simple public enum and struct types
Move isminetype and isminefilter there this commit, add WalletPurpose type next
commit.
2023-04-11 15:52:25 -04:00
Andrew Chow
27dcc07c08
Merge bitcoin/bitcoin#26699: wallet, gui: bugfix, getAvailableBalance skips selected coins
68eed5df86 test,gui: add coverage for PSBT creation on legacy watch-only wallets (furszy)
306aab5bb4 test,gui: decouple widgets and model into a MiniGui struct (furszy)
2f76ac0383 test,gui: decouple chain and wallet initialization from test case (furszy)
cd98b71739 gui: 'getAvailableBalance', include watch only balance (furszy)
74eac3a82f test: add coverage for 'useAvailableBalance' functionality (furszy)
dc1cc1c359 gui: bugfix, getAvailableBalance skips selected coins (furszy)

Pull request description:

  Fixes https://github.com/bitcoin-core/gui/issues/688 and https://github.com/bitcoin/bitcoin/issues/26687.

  First Issue Description (https://github.com/bitcoin-core/gui/issues/688):

  The previous behavior for `getAvailableBalance`, when the coin control had selected coins, was to return the sum of them. Instead, we are currently returning the wallet's available total balance minus the selected coins total amount.

  Reason:
  Missed to update the `GetAvailableBalance` function to include the coin control selected coins on #25685.

  Context:
  Since #25685 we skip the selected coins inside `AvailableCoins`, the reason is that there is no need to waste resources walking through the entire wallet's txes map just to get coins that could have gotten by just doing a simple `mapWallet.find`).

  Places Where This Generates Issues (only when the user manually select coins via coin control):
  1) The GUI balance check prior the transaction creation process.
  2) The GUI "useAvailableBalance" functionality.

  Note 1:
  As the GUI uses a balance cache since https://github.com/bitcoin-core/gui/pull/598, this issue does not affect the regular spending process. Only arises when the user manually select coins.

  Note 2:
  Added test coverage for the `useAvailableBalance` functionality.

  ----------------------------------

  Second Issue Description (https://github.com/bitcoin/bitcoin/issues/26687):

  As we are using a cached balance on `WalletModel::getAvailableBalance`,
  the function needs to include the watch-only available balance for wallets
  with private keys disabled.

ACKs for top commit:
  Sjors:
    tACK 68eed5df86
  achow101:
    ACK 68eed5df86
  theStack:
    ACK 68eed5df86

Tree-SHA512: 674f3e050024dabda2ff4a04b9ed3750cf54a040527204c920e1e38bd3d7f5fd4d096e4fd08a0fea84ee6abb5070f022b5c0d450c58fd30202ef05ebfd7af6d3
2023-04-11 14:05:55 -04:00
fanquake
c17d4d3b6b
Merge bitcoin/bitcoin#26662: fuzz: Add HeadersSyncState target
3153e7d779 [fuzz] Add HeadersSyncState target (dergoegge)
53552affca [headerssync] Make m_commit_offset protected (dergoegge)

Pull request description:

  This adds a fuzz target for the `HeadersSyncState` class.

  I am unsure how well this is able to cover the logic since it is just processing unserialized CBlockHeaders straight from the fuzz input (headers are sometimes made continuous). However, it does manage to get to the redownload phase so i thought it is better then not having fuzzing at all.

  It would also be nice to fuzz the p2p logic that is using `HeadersSyncState` (e.g. `TryLowWorkHeadersSync`, `IsContinuationOfLowWorkHeadersSync`) but that likely requires some more work (refactoring👻).

ACKs for top commit:
  mzumsande:
    ACK 3153e7d779

Tree-SHA512: 8a4630ceeeb30e4eeabaa8eb5491d98f0bf900efe7cda07384eaac9f2afaccfbcaa979cc1cc7f0b6ca297a8f5c17a7759f94809dd87eb87d35348d847c83e8ab
2023-04-11 16:17:04 +01:00
fanquake
53eb4b7a21
Merge bitcoin/bitcoin#27270: refactor, net processing: Avoid CNode::m_relays_txs usage
55c4795c57 [net processing] Use TxRelay::m_relay_txs over CNode::m_relays_txs (dergoegge)

Pull request description:

  `CNode::m_relays_txs` is meant to only be used for the eviction logic in `net`. `TxRelay::m_relay_txs` will hold the same value and is meant to be used on the application layer to determine if we will/should relay transactions to a peer.

  (Shameless plug: we should really better specify the interface for updating eviction data to avoid refactors like this in the future -> #25572)

ACKs for top commit:
  MarcoFalke:
    lgtm ACK 55c4795c57

Tree-SHA512: 59cfd23e32568fd96cda5570790e518242a6c76d4edf5b7d1a2a7f9724d590d2a38395504e05be0af4e98dd5c0056fc0be6568eab2818934692483a186e5181d
2023-04-11 11:43:21 +01:00
Jon Atack
19d888ce40 rpc: move WALLET_FLAG_CAVEATS to the compilation unit of its caller
and add the walletutil.h include header for WALLET_FLAG_AVOID_REUSE that was
already missing before this change.

WALLET_FLAG_CAVEATS is only used in one RPC, so no need to encumber wallet.h and
wallet.cpp with it, along with all of the files that include wallet.h during
their compilation. Also apply clang-format per:

git diff -U0 HEAD~1.. | ./contrib/devtools/clang-format-diff.py -p1 -i -v
2023-04-10 10:41:56 -07:00
Jon Atack
645d7f75ac rpc: deprecate "warning" field in {create,load,unload,restore}wallet
This string field has been replaced in these four RPCs by a "warnings" field
returning a JSON array of strings.
2023-04-10 10:41:56 -07:00
Jon Atack
4a1e479ca6 rpc: add "warnings" field to RPCs {create,load,unload,restore}wallet
This new "warnings" field is a JSON array of strings intended to replace the
"warning" string field in these four RPCs, to better handle returning multiple
warning messages and for consistency with other wallet RPCs.
2023-04-10 10:41:35 -07:00
Jon Atack
079d8cdda8 rpc: extract wallet "warnings" fields to a util helper 2023-04-10 10:41:35 -07:00
Jon Atack
f73782a903 doc: fix/improve warning helps in {create,load,unload,restore}wallet
- clarify that there can be multiple warning messages
- specify the correct wallet action
- describe the use of newlines as delimiters
2023-04-10 10:41:06 -07:00
Andrew Chow
be177c15a4 bumpfee: Check the correct feerate when replacing outputs
When doing the feerate check for bumped transactions that replace the
outputs, we need to consider that the size of the new outputs may be
different from the old outputs and calculate the minimum feerate accordingly.
2023-04-10 09:56:25 -04:00
stratospher
b5585ba5f9 p2p: skip netgroup diversity of new connections for tor/i2p/cjdns networks
Co-authored-by: Suhas Daftuar <sdaftuar@gmail.com>
2023-04-07 00:13:15 +05:30
fanquake
04595484d9
Merge bitcoin/bitcoin#27404: ci: use clang-16 in tidy task
a56c96507a ci: use clang-16 in tidy task (fanquake)

Pull request description:

  Follow up to https://github.com/bitcoin/bitcoin/pull/27311#issuecomment-1481020371, as IWYU now has a [clang_16 branch](https://github.com/include-what-you-use/include-what-you-use/tree/clang_16).

  This also removes some workarounds for (now fixed) clang-tidy issues, and simplifies the IWYU install steps.

ACKs for top commit:
  MarcoFalke:
    lgtm ACK a56c96507a
  josibake:
    ACK a56c96507a
  hebasto:
    ACK a56c96507a

Tree-SHA512: 5bbec6cc196c3305302895c77986f3695fc6f4024363ee57503654d54e0ebf108719a7a1d7908817f84115dcaa13377493eb764b00bdf574f1290c73251426fa
2023-04-05 14:03:01 +01:00
fanquake
27ad26de2f
Merge bitcoin/bitcoin#27317: log: Check that the timestamp string is non-empty to avoid undefined behavior
73f4eb511c Check that the Timestamp String is valid (John Moffett)

Pull request description:

  Follow-up to https://github.com/bitcoin/bitcoin/pull/27233

  The current `FormatISO8601DateTime` function will return an empty string if it encounters an error when converting the `int64_t` seconds-since-epoch to a formatted date time. In the unlikely case that happens, here `strStamped.pop_back()` would be undefined behavior.

ACKs for top commit:
  MarcoFalke:
    lgtm ACK 73f4eb511c
  stickies-v:
    ACK 73f4eb511c

Tree-SHA512: 089ed639c193deb98870a8385039b31b4baed821ea907937bfc6f65a5b0981bbf8284b2afec81b2d0a922e2340716b48cf55349640eb6b8c311ef7af25abc361
2023-04-05 11:50:27 +01:00