Commit graph

22484 commits

Author SHA1 Message Date
dergoegge
0101d2bc3c [net] Move eviction logic to its own file 2022-07-06 18:13:54 +02:00
Cory Fields
c741d748d4 [net] Move ConnectionType to its own file 2022-07-06 18:13:53 +02:00
Andrew Chow
aeab1b42e6
Merge bitcoin/bitcoin#25507: wallet: don't add change fee to target if subtracting fees from output
140d942634 wallet: don't add change fee to target if subtracting fees from output (S3RK)

Pull request description:

  Change fee is payed by the recipient, so we don't need to add it to our target for coin selection.

ACKs for top commit:
  achow101:
    ACK 140d942634
  ishaanam:
    ACK 140d942634
  furszy:
    Code review ACK 140d9426

Tree-SHA512: b5efd0264c47ecee9204a3fd039bad24c69f9e614c6e1d9bb240ee5be6356b175aa074f3be123e6cfb8becd4d7bd1028eebe18801662cc69d19413d8d5a9dd5c
2022-07-06 11:01:07 -04:00
chinggg
6eb0909cb7 fuzz: add low-level target for txorphanage 2022-07-06 22:13:54 +08:00
Antoine Poinsot
757216e31c
wallet: don't iter twice when getting the cached debit/credit amount
Instead of calling GetCachableAmount twice, which will result in
iterating through all the transaction txins/txouts and calling
GetDebit/GetCredit (which lock cs_wallet), just merge the filters and do
it once.
2022-07-05 15:43:09 +02:00
furszy
bf310b0e8c
wallet: clean InputIsMine code, use GetWalletTx 2022-07-05 10:10:33 -03:00
furszy
0cb177263c
wallet: unify CachedTxGetImmatureCredit and CachedTxGetImmatureWatchOnlyCredit 2022-07-05 10:10:27 -03:00
furszy
04c6423f7b
wallet: remove always true 'fUseCache' arg from CachedTxGetAvailableCredit 2022-07-05 10:10:27 -03:00
furszy
4f0ca9bff6
wallet: remove always false 'recalculate' arg from GetCachableAmount 2022-07-05 10:10:27 -03:00
furszy
47b1012677
wallet: remove always true 'fUseCache' from CachedTxGetImmatureWatchOnlyCredit 2022-07-05 10:10:27 -03:00
furszy
da8f62de2c
wallet: remove always true 'fUseCache' from CachedTxGetImmatureCredit 2022-07-05 10:10:26 -03:00
fanquake
87d012324a
Merge bitcoin/bitcoin#25454: p2p: Avoid multiple getheaders messages in flight to the same peer
99f4785cad Replace GetTime() with NodeClock in MaybeSendGetHeaders() (Suhas Daftuar)
abf5d16c24 Don't send getheaders message when another request is outstanding (Suhas Daftuar)
ffe87db247 Cleanup received_new_header calculation to use WITH_LOCK (Suhas Daftuar)
6d95cd3e74 Move peer state updates from headers message into separate function (Suhas Daftuar)
2b341db731 Move headers direct fetch to end of ProcessHeadersMessage (Suhas Daftuar)
29c4518522 Move headers-direct-fetch logic into own function (Suhas Daftuar)
bf8ea6df75 Move additional headers fetching to own function (Suhas Daftuar)
9492e93bf9 Add helper function for checking header continuity (Suhas Daftuar)
7f2450871b Move handling of unconnecting headers into own function (Suhas Daftuar)

Pull request description:

  Change `getheaders` messages so that we wait up to 2 minutes for a response to a prior `getheaders` message before issuing a new one.

  Also change the handling of the `getheaders` message sent in response to a block INV, so that we no longer use the hashstop variable (including the hash stop will just mean that if our peer's headers chain is longer, then we won't learn
  it, so there's no benefit to using hashstop).

  Also, now respond to a `getheaders` during IBD with an empty headers message (rather than nothing) -- this better conforms to the intent of the new logic that it's better to not ignore a peer's `getheaders` message, even if you have nothing to give. This also avoids a lot of functional tests breaking.

  This PR also reworks the headers processing logic to make it more readable.

ACKs for top commit:
  ajtowns:
    ACK 99f4785cad ; code review, check over new logic of when to send getheaders messages
  dergoegge:
    Code review ACK  99f4785cad
  mzumsande:
    Code Review ACK 99f4785cad
  sipa:
    utACK 99f4785cad
  w0xlt:
    tACK 99f4785cad Good improvement in the code.

Tree-SHA512: b8a63f6f71ac83e292edc0200def7835ad8b06b2955dd34e3ea6fac85980fa6962efd31d689ef5ea121ff5477ec14aafa4bbe2d0db134c05f4a31a57a8ced365
2022-07-04 21:28:21 +01:00
dergoegge
a3c2707039 [net] Add connection type to NodeEvictionCandidate 2022-07-04 14:58:43 +02:00
dergoegge
42aa5d5b62 [net] Add NoBan status to NodeEvictionCandidate 2022-07-04 14:57:49 +02:00
Fabian Jahr
833ce76df7
rpc, wallet: Document mempool rescan after importdescriptor, importwallet 2022-07-03 21:06:49 +02:00
Fabian Jahr
0e396d1ba7
rpc, wallet: Document mempool scan after importmulti 2022-07-03 21:06:49 +02:00
Fabian Jahr
e6d3ef8586
rpc, wallet: Document mempool scan after importpubkey 2022-07-03 21:06:49 +02:00
João Barbosa
6d3db52e66
rpc, wallet: Document and test mempool scan after importprivkey
co-authored-by: Fabian Jahr <fjahr@protonmail.com>
2022-07-03 21:06:49 +02:00
João Barbosa
3abdbbb90a
rpc, wallet: Document and test mempool scan after importaddress
co-authored-by: Fabian Jahr <fjahr@protonmail.com>
2022-07-03 21:06:49 +02:00
Fabian Jahr
236239bd40
wallet: Rescan mempool for transactions as well 2022-07-03 21:06:47 +02:00
MacroFake
4129c13754
Merge bitcoin/bitcoin#25521: build: Remove outdated libbitcoinkernel comment
18f5355f3a Remove outdated comment (Igor Bubelov)

Pull request description:

  Looks like this comment is no longer relevant, the last files which matched `index/*.cpp` pattern were removed in f100687566

ACKs for top commit:
  dongcarl:
    ACK 18f5355f3a
  shaavan:
    ACK 18f5355f3a

Tree-SHA512: d3fcc2db0940f81ce521fddff836f271709ea327c357942383f8aff6c7089e74490fa720e7a2916900215c733d2b64960c1aa185f0c9b1567fce90a249d405e0
2022-07-01 21:50:50 +02:00
MacroFake
53b1a2426c
Merge bitcoin/bitcoin#25471: rpc: Disallow gettxoutsetinfo queries for a specific block with use_index=false
27c8056885 rpc: Disallow gettxoutsetinfo queries for a specific block with use_index=false (Martin Zumsande)

Pull request description:

  In the `gettxoutsetinfo` RPC, if we set `use_index` to false but specify `hash_or_height`, we currently hit a nonfatal error, e.g. `gettxoutsetinfo "muhash" "1" "false"` results in:
  ```
  Internal bug detected: "!pindex || pindex->GetBlockHash() == view->GetBestBlock()"
  rpc/blockchain.cpp:836 (GetUTXOStats)
  ```
  The failing check was added in [#24410](664a14ba7c), but the previous behavior, returning the specified height together with data corresponding to the tip's height, was very confusing too in my opinion.
  Fix this by disallowing the interaction  of `use_index=false` and `hash_or_height` and add a RPC help example with `-named` because users might ask themselves how to use the `use_index` flag witout hitting an error.

  An alternative way would be to allow the interaction if the specified `hash_or_height` happens to correspond to the tip (which should then also be applied to the `HASH_SERIALIZED` check before). If reviewers would prefer that, please say so.

ACKs for top commit:
  fjahr:
    utACK 27c8056885
  shaavan:
    ACK 27c8056885

Tree-SHA512: 1d81c34eaa48c86134a2cf7193246d5de6bfd819d413c3b3fae9cb9290e0297a336111eeaecede2f0f020b0f9a181d240de0da4493e1b387fe63b8189154442b
2022-07-01 14:56:23 +02:00
Suhas Daftuar
99f4785cad Replace GetTime() with NodeClock in MaybeSendGetHeaders() 2022-07-01 08:29:14 -04:00
Igor Bubelov
18f5355f3a Remove outdated comment 2022-07-01 14:34:25 +07:00
MacroFake
c892cb7d8d
Merge bitcoin/bitcoin#25383: wallet: don't read db every time that a new 'WalletBatch' is created
c318211ddd walletdb: fix last client version update (furszy)
bda8ebe608 wallet: don't read db every time that a new WalletBatch is created (furszy)

Pull request description:

  Found it while was working on #25297.

  We are performing a db read operation every time that a new `WalletBatch` is created, inside the constructor, just to check if the client version field is inside the db or not.

  As the client version field does not change in the entire db lifecycle, this operation can be done only once: The first time that the db is accessed/opened and the client version value can be cached.

ACKs for top commit:
  achow101:
    ACK c318211ddd
  w0xlt:
    reACK c318211ddd

Tree-SHA512: 7fb780c656e169e8eb21e7212242494a647f6506d6da2cca828703713d440d29c82bec9e7d2c410f37b49361226ccd80846d3eeb8168383d0c2a11d85d73bee2
2022-06-30 18:38:20 +02:00
Andrew Chow
76fb300b63 psbt: Check Taproot tree depth and leaf versions
Since TaprootBuilder has assertions for the depth and leaf versions, the
PSBT decoder should check these values before calling
TaprootBuilder::Add so that the assertions are not triggered on
malformed taproot trees.
2022-06-30 11:08:44 -04:00
fanquake
6adae27f8c
Merge bitcoin/bitcoin#24836: add RPC (-regtest only) for testing package policy
e866f0d066 [functional test] submitrawpackage RPC (glozow)
fa076515b0 [rpc] add new submitpackage RPC (glozow)

Pull request description:

  It would be nice for LN/wallet/app devs to test out package policy, package RBF, etc., but the only interface to do so right now is through unit tests. This PR adds a `-regtest` only RPC interface so people can test by submitting raw transaction data. It is regtest-only, as it would be unsafe/confusing to create an actual mainnet interface while package relay doesn't exist.

  Note that the functional tests are there to ensure the RPC interface is working properly; they aren't for testing policy itself. See src/test/txpackage_tests.cpp.

ACKs for top commit:
  t-bast:
    Tested ACK against eclair e866f0d066
  ariard:
    Code Review ACK e866f0d0
  instagibbs:
    code review ACK e866f0d066

Tree-SHA512: 824a26b10d2240e0fd85e5dd25bf499ee3dd9ba8ef4f522533998fcf767ddded9f001f7a005fe3ab07ec95e696448484e26599803e6034ed2733125c8c376c84
2022-06-30 15:43:50 +01:00
/dev/fd0
748a10e896 rephrase error for invalid timeout 2022-06-30 14:16:04 +05:30
S3RK
140d942634 wallet: don't add change fee to target if subtracting fees from output 2022-06-30 08:55:48 +02:00
Jarol Rodriguez
d5c141f221 qt: apply translator comments to reset options confirmation dialog
Follow-up to #617. This applies translator strings to the
reset options confirmation dialog and also refactors the way we pass the
strings to the dialog in order to allow the comments to be applied.
Because the strings were being concatenated, we can not apply translator
comments to all of the relevant strings. What we want to do instead is
have a variable in which the translatable strings are appended to using
the QString append function. This satisfies the Qt translator engine and
the comments are then properly applied within the `extracomment` field
in the translation file.
2022-06-29 20:02:02 -04:00
Andrew Chow
5bc10b39ab
Merge bitcoin/bitcoin#25502: upstream: update minisketch subtree
28a28a0c5b Squashed 'src/minisketch/' changes from 7eeb778fef..47f0a2d26f (fanquake)

Pull request description:

  Contains:
  * https://github.com/sipa/minisketch/pull/65
  * https://github.com/sipa/minisketch/pull/66

  Required for #25493.

ACKs for top commit:
  achow101:
    ACK dc375e5cce
  hebasto:
    ACK dc375e5cce, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: fbcd6cdc551770ff67d1df65ab171ce43c9eb7e7668da76da5c5b06865ed550527abcff661741a86c1535018a85a165619ff94ae3e6c7a695374b6c4f843c5ca
2022-06-29 13:17:28 -04:00
Andrew Chow
749b80b29e
Merge bitcoin/bitcoin#25497: wallet: more accurate target for large transactions
25e4762ae7 wallet: more accurate tx_noinputs_size (S3RK)

Pull request description:

  Rationale: more accurate non-input fee estimation for txs with >=253 inputs

ACKs for top commit:
  laanwj:
    Concept and code review ACK 25e4762ae7
  achow101:
    ACK 25e4762ae7
  furszy:
    Code review ACK 25e4762a. left a small nit.

Tree-SHA512: bda8fad725d32ad3e13c007fa56ddb6679ac1a32098ddb08d9a114054acfa681cb66cd703ac675297f731cb381b09067a99a4efa31320140bbdd03f0cfdc81af
2022-06-29 11:48:19 -04:00
fanquake
dc375e5cce
Update minisketch subtree to latest master 2022-06-29 16:35:02 +01:00
fanquake
cc22bd7f70
Merge bitcoin/bitcoin#25495: Revert "bnb: exit selection when best_waste is 0"
af56d63eca Revert "bnb: exit selection when best_waste is 0" (Murch)

Pull request description:

  This reverts commit 9b5950db86.

  Waste can be negative. At feerates lower than long_term_feerate this
  means that a waste of 0 may be a suboptimal solution and this causes the
  search to exit prematurely.
  Only when the feerate is equal to the long_term_feerate would achieving
  a waste of 0 indicate that we have achieved an optimal solution,
  because it would mean that the excess is 0. It seems unlikely
  that this would ever occur outside of test cases, and even then we
  should prefer solutions with more inputs over solutions with fewer
  according to previous decisions—but solutions with more inputs are found
  later in the branch exploration.

  The "optimization" described in #18257 and implemented in #18262 is
  therefore a premature exit on a suboptimal solution and should be reverted.

ACKs for top commit:
  sipa:
    utACK af56d63eca
  S3RK:
    utACK af56d63eca
  achow101:
    ACK af56d63eca
  glozow:
    utACK af56d63eca, agree it is incorrect to stop here unless we could rule out the possibility of a better solution with negative waste. `SelectCoinsBnB` doesn't know what long term feerate and effective feerate are (and probably shouldn't) so it's better to have no exit early condition at all.

Tree-SHA512: 470f1a49041a0042cb69d239fccac7512ace79871d43508b6e7f7a2f3aca3523930b16e00c5513b816d5fe078d9ab53e42b0a80fd3c3d48e6434f24c2b009077
2022-06-29 15:56:12 +01:00
fanquake
d8f8f7812c
util: remove MSVC warning pragmas
4786 - I don't think this exists any more?
4805 - Is already defined (globally) in the MSVC project.

Dropped 4717 and 4804, as it seems they are no-longer supressing
anything.

See:
https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-c4000-c5999
2022-06-29 11:09:18 +01:00
MacroFake
facc2fa7b8
Use AutoFile where possible 2022-06-29 10:33:13 +02:00
MacroFake
6666803c89
streams: Add AutoFile without ser-type and ser-version
The moved parts can be reviewed with "--color-moved=dimmed-zebra".
The one-char changes can be reviewed with "--word-diff-regex=.".
2022-06-29 10:31:53 +02:00
MacroFake
e4e201dfd9
Merge bitcoin/bitcoin#25290: [kernel 3a/n] Decouple CTxMemPool from ArgsManager
d1684beabe fees: Pass in a filepath instead of referencing gArgs (Carl Dong)
9a3d825c30 init: Remove redundant -*mempool*, -limit* queries (Carl Dong)
6c5c60c412 mempool: Use m_limit for UpdateTransactionsFromBlock (Carl Dong)
9e93b10301 node/ifaces: Use existing MemPoolLimits (Carl Dong)
38af2bcf35 mempoolaccept: Use limits from mempool in constructor (Carl Dong)
9333427014 mempool: Introduce (still-unused) MemPoolLimits (Carl Dong)
716bb5fbd3 scripted-diff: Rename anc/desc size limit vars to indicate SI unit (Carl Dong)
1ecc77321d scripted-diff: Rename DEFAULT_MEMPOOL_EXPIRY to indicate time unit (Carl Dong)
aa9141cd81 mempool: Pass in -mempoolexpiry instead of referencing gArgs (Carl Dong)
51c7a41a5e init: Only determine maxmempool once (Carl Dong)
386c9472c8 mempool: Make GetMinFee() with custom size protected (Carl Dong)
82f00de7a6 mempool: Pass in -maxmempool instead of referencing gArgs (Carl Dong)
f1941e8bfd pool: Add and use MemPoolOptions, ApplyArgsManOptions (Carl Dong)
0199bd35bb fuzz/rbf: Add missing TestingSetup (Carl Dong)
ccbaf546a6 scripted-diff: Rename DEFAULT_MAX_MEMPOOL_SIZE to indicate SI unit (Carl Dong)
fc02f77ca6 ArgsMan: Add Get*Arg functions returning optional (Carl Dong)

Pull request description:

  This is part of the `libbitcoinkernel` project: #24303, https://github.com/bitcoin/bitcoin/projects/18

  -----

  As mentioned in the Stage 1 Step 2 description of [the `libbitcoinkernel` project](https://github.com/bitcoin/bitcoin/issues/24303), `ArgsManager` will not be part of `libbitcoinkernel`. Therefore, it is important that we remove any dependence on `ArgsManager` by code that will be part of `libbitcoinkernel`. This is the first in a series of PRs aiming to achieve this.

  This PR removes `CTxMemPool+MempoolAccept`'s dependency on `ArgsManager` by introducing a `CTxMemPool::Options` struct, which is used to specify `CTxMemPool`'s various options at construction time.

  These options are:
  - `-maxmempool` -> `CTxMemPool::Options::max_size`
  - `-mempoolexpiry` -> `CTxMemPool::Options::expiry`
  - `-limitancestorcount` -> `CTxMemPool::Options::limits::ancestor_count`
  - `-limitancestorsize` -> `CTxMemPool::Options::limits::ancestor_size`
  - `-limitdescendantcount` -> `CTxMemPool::Options::limits::descendant_count`
  - `-limitdescendantsize` -> `CTxMemPool::Options::limits::descendant_size`

  More context can be gleaned from the commit messages. The important commits are:

  - 56eb479ded8bfb2ef635bb6f3b484f9d5952c70d "pool: Add and use MemPoolOptions, ApplyArgsManOptions"
  - a1e08b70f3068f4e8def1c630d8f50cd54da7832 "mempool: Pass in -maxmempool instead of referencing gArgs"
  - 6f4bf3ede5812b374828f08fc728ceded2f10024 "mempool: Pass in -mempoolexpiry instead of referencing gArgs"
  - 5958a7fe4806599fc620ee8c1a881ca10fa2dd16 "mempool: Introduce (still-unused) MemPoolLimits"

  Reviewers: Help needed in the following commits (see commit messages):
  - a1e08b70f3068f4e8def1c630d8f50cd54da7832 "mempool: Pass in -maxmempool instead of referencing gArgs"
  - 0695081a797e9a5d7787b78b0f8289dafcc6bff7 "node/ifaces: Use existing MemPoolLimits"

  Note to Reviewers: There are perhaps an infinite number of ways to architect `CTxMemPool::Options`, the current one tries to keep it simple, usable, and flexible. I hope we don't spend too much time arguing over the design here since that's not the point. In the case that you're 100% certain that a different design is strictly better than this one in every regard, please show us a fully-implemented branch.

  -----

  TODO:
  - [x] Use the more ergonomic `CTxMemPool::Options` where appropriate
  - [x] Doxygen comments for `ApplyArgsManOptions`, `MemPoolOptions`

  -----

  Questions for Reviewers:
  1. Should we use `std::chrono::seconds` for `CTxMemPool::Options::expiry` and `CTxMemPool::m_expiry` instead of an `int64_t`? Something else? (`std::chrono::hours`?)
  2. Should I merge `CTxMemPool::Limits` inside `CTxMemPool::Options`?

ACKs for top commit:
  MarcoFalke:
    ACK d1684beabe 🍜
  ryanofsky:
    Code review ACK d1684beabe. Just minor cleanups since last review, mostly switching to brace initialization

Tree-SHA512: 2c138e52d69f61c263f1c3648f01c801338a8f576762c815f478ef5148b8b2f51e91ded5c1be915e678c0b14f6cfba894b82afec58d999d39a7bb7c914736e0b
2022-06-29 09:13:31 +02:00
S3RK
25e4762ae7 wallet: more accurate tx_noinputs_size 2022-06-29 09:02:20 +02:00
Hennadii Stepanov
1b4d660a34
Merge bitcoin-core/gui#617: Reset options, notify user about backup creation
ac4fb3bbbe gui: reset options, notify user about the backup creation (furszy)

Pull request description:

  Quick follow-up to first point of https://github.com/bitcoin-core/gui/pull/602#pullrequestreview-1002780997

ACKs for top commit:
  ryanofsky:
    Code review ACK ac4fb3bbbe, just fixing displayed backup directory since last review
  jarolrod:
    tACK ac4fb3bbbe

Tree-SHA512: cfeca5cd6d6d3d69bbd81211cf1bfd490de13ac96bf53be081a5ceb88611afa57dff2be35f8e0a41b1088b7b892f75a21a9abf47f2e1d77e9e316467eb7c12be
2022-06-29 00:35:06 +02:00
Martin Zumsande
27c8056885 rpc: Disallow gettxoutsetinfo queries for a specific block with use_index=false
by returning an RPC error where previously a NonFatalError
would be thrown.
2022-06-28 18:32:08 -04:00
Murch
af56d63eca Revert "bnb: exit selection when best_waste is 0"
This reverts commit 9b5950db86.

Waste can be negative. At feerates lower than long_term_feerate this
means that a waste of 0 may be a suboptimal solution and this causes the
search to exit prematurely.
Only when the feerate is equal to the long_term_feerate would achieving
a waste of 0 indicate that we have achieved an optimal solution,
because it would mean that the excess is 0. It seems unlikely
that this would ever occur outside of test cases, and even then we
should prefer solutions with more inputs over solutions with fewer
according to previous decisions—but solutions with more inputs are found
later in the branch exploration.

The "optimization" described in #18257 and implemented in #18262 is
therefore a premature exit on a suboptimal solution and should be reverted.
2022-06-28 17:27:06 -04:00
Carl Dong
d1684beabe fees: Pass in a filepath instead of referencing gArgs 2022-06-28 16:08:34 -04:00
Carl Dong
9a3d825c30 init: Remove redundant -*mempool*, -limit* queries
Now that MemPoolOptions has correctly-determined max_size and limits
members, perform sanity checks on that instead of re-determining the
options.
2022-06-28 15:53:45 -04:00
Suhas Daftuar
abf5d16c24 Don't send getheaders message when another request is outstanding
Change getheaders messages so that we wait up to 2 minutes for a response to a
prior getheaders message before issuing a new one.

Also change the handling of the getheaders message sent in response to a block
INV, so that we no longer use the hashstop variable (including the hash stop
will just mean that if our peer's headers chain is longer, then we won't learn
it, so there's no benefit to using hashstop).

Also, now respond to a getheaders during IBD with an empty headers message
(rather than nothing) -- this better conforms to the intent of the new logic
that it's better to not ignore a peer's getheaders message, even if you have
nothing to give. This also avoids a lot of functional tests breaking.

p2p_segwit.py is modified to use this same strategy, as the test logic (of
expecting a getheaders after a block inv) would otherwise be broken.
2022-06-28 15:53:25 -04:00
Suhas Daftuar
ffe87db247 Cleanup received_new_header calculation to use WITH_LOCK 2022-06-28 15:53:25 -04:00
Suhas Daftuar
6d95cd3e74 Move peer state updates from headers message into separate function 2022-06-28 15:53:25 -04:00
Suhas Daftuar
2b341db731 Move headers direct fetch to end of ProcessHeadersMessage 2022-06-28 15:53:25 -04:00
Suhas Daftuar
29c4518522 Move headers-direct-fetch logic into own function 2022-06-28 15:53:25 -04:00
Suhas Daftuar
bf8ea6df75 Move additional headers fetching to own function
Also moves the call to happen directly after validation of a headers message
(rather than mixed in with other state updates for the peer), and removes an
incorrect comment in favor of one that explains why headers sync must continue
from the last header a peer has sent.
2022-06-28 15:53:25 -04:00
Suhas Daftuar
9492e93bf9 Add helper function for checking header continuity 2022-06-28 15:53:25 -04:00
Suhas Daftuar
7f2450871b Move handling of unconnecting headers into own function 2022-06-28 15:53:25 -04:00
Carl Dong
6c5c60c412 mempool: Use m_limit for UpdateTransactionsFromBlock
Since:

- UpdateTransactionsFromBlock is only called by
  MaybeUpdateMempoolForReorg, which calls it with the gArgs-determined
  ancestor limits
- UpdateForDescendants is only called by UpdateTransactionsFromBlock
  with the ancestor limits unchanged

We can remove the requirement to specify the ancestor limits for both
UpdateTransactionsFromBlock and UpdateForDescendants and just use the
values in the m_limits member.

Also move some removed comments to MemPoolLimits struct members.

The uint64_t cast in UpdateForDescendants is not new behavior,
see the diff in CChainState::MaybeUpdateMempoolForReorg for where they
were previously.
2022-06-28 15:49:15 -04:00
Carl Dong
9e93b10301 node/ifaces: Use existing MemPoolLimits 2022-06-28 15:46:20 -04:00
Carl Dong
38af2bcf35 mempoolaccept: Use limits from mempool in constructor 2022-06-28 15:46:20 -04:00
Carl Dong
9333427014 mempool: Introduce (still-unused) MemPoolLimits
They live as a CTxMemPool member.

[META] These limits will be used in subsequent commits to replace calls
       to gArgs.
2022-06-28 15:46:10 -04:00
Carl Dong
716bb5fbd3 scripted-diff: Rename anc/desc size limit vars to indicate SI unit
Better to be explicit when it comes to sizes to avoid unintentional
bugs. We use MB and KB all over the place.

-BEGIN VERIFY SCRIPT-
find_regex="DEFAULT_(ANCESTOR|DESCENDANT)_SIZE_LIMIT" \
    && git grep -l -E "$find_regex" \
        | xargs sed -i -E "s@$find_regex@\0_KVB@g"
-END VERIFY SCRIPT-
2022-06-28 15:42:40 -04:00
Carl Dong
1ecc77321d scripted-diff: Rename DEFAULT_MEMPOOL_EXPIRY to indicate time unit
Better to be explicit when it comes to time to avoid unintentional bugs.

-BEGIN VERIFY SCRIPT-
find_regex="DEFAULT_MEMPOOL_EXPIRY" \
    && git grep -l -E "$find_regex" \
        | xargs sed -i -E "s@$find_regex@\0_HOURS@g"
-END VERIFY SCRIPT-
2022-06-28 15:42:40 -04:00
Carl Dong
aa9141cd81 mempool: Pass in -mempoolexpiry instead of referencing gArgs
- Store the mempool expiry (-mempoolexpiry) in CTxMemPool as a
  std::chrono::seconds member.

- Remove the requirement to explicitly specify a mempool expiry for
  LimitMempoolSize(...), just use the newly-introduced member.

- Remove all now-unnecessary instances of:
    std::chrono::hours{gArgs.GetIntArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY)}
2022-06-28 15:42:23 -04:00
Carl Dong
51c7a41a5e init: Only determine maxmempool once
Now that MemPoolOptions has a correctly-determined max_size member, use
that instead of redetermining it to print the log line.
2022-06-28 15:39:31 -04:00
Carl Dong
386c9472c8 mempool: Make GetMinFee() with custom size protected
The version of GetMinFee() with a custom size specification is and
should only be used by tests. Mark it as protected and use a derived
class exposing GetMinFee() as public in tests.
2022-06-28 15:36:36 -04:00
Carl Dong
82f00de7a6 mempool: Pass in -maxmempool instead of referencing gArgs
- Store the mempool size limit (-maxmempool) in CTxMemPool as a member.

- Remove the requirement to explicitly specify a mempool size limit for
  CTxMemPool::GetMinFee(...) and LimitMempoolSize(...), just use the
  stored mempool size limit where possible.

- Remove all now-unnecessary instances of:
    gArgs.GetIntArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE_MB) * 1000000

The code change in CChainState::GetCoinsCacheSizeState() is correct
since the coinscache should not repurpose "extra" mempool memory
headroom for itself if the mempool doesn't even exist.
2022-06-28 15:36:18 -04:00
Carl Dong
f1941e8bfd pool: Add and use MemPoolOptions, ApplyArgsManOptions
Reviewers: Note that CTxMemPool now requires a non-defaulted
CTxMemPool::Options for its constructor. Meaning that there's no need to
worry about a stray CTxMemPool constructor somewhere defaulting to
something incorrect. All instances of CTxMemPool construction are
addressed here in this commit.

We set options for CTxMemPool and construct it in many different ways. A
good example can be seen in how we determine CTxMemPool's check_ratio in
AppInitMain(...).

1. We first set the default based on chainparams's
   DefaultConsistencyChecks()
2. Then, we apply the ArgsManager option on top of that default
3. Finally, we clamp the result of that between 0 and 1 Million

With this patch, most CTxMemPool construction are along the lines of:

    MemPoolOptions mempool_opts{...default overrides...};
    ApplyArgsManOptions(argsman, mempool_opts);
    ...hard overrides...
    CTxMemPool pool{mempool_opts};

This "compositional" style of building options means that we can omit
unnecessary/irrelevant steps wherever we want but also maintain full
customizability.

For example:

- For users of libbitcoinkernel, where we eventually want to remove
  ArgsManager, they simply won't call (or even know about)
  ApplyArgsManOptions.

- See src/init.cpp to see how the check_ratio CTxMemPool option works
  after this change.

A MemPoolOptionsForTest helper was also added and used by tests/fuzz
tests where a local CTxMemPool needed to be created.

The change in src/test/fuzz/tx_pool.cpp seemingly changes behaviour by
applying ArgsManager options on top of the CTxMemPool::Options defaults.
However, in future commits where we introduce flags like -maxmempool,
the call to ApplyArgsManOptions is actually what preserves the existing
behaviour. Previously, although it wasn't obvious, our CTxMemPool would
consult gArgs for flags like -maxmempool when it needed it, so it
already relied on ArgsManager information. This patchset just laid bare
the obfuscatory perils of globals.

[META] As this patchset progresses, we will move more and more
       CTxMemPool-relevant options into MemPoolOptions and add their
       ArgsMan-related logic to ApplyArgsManOptions.
2022-06-28 15:30:05 -04:00
fanquake
480d8069d7
Merge bitcoin/bitcoin#24924: bench: Make WalletLoading benchmark run faster
e673d8b475 bench: Enable loading benchmarks depending on what's compiled (Andrew Chow)
4af3547eba bench: Use mock wallet database for wallet loading benchmark (Andrew Chow)
49910f255f sqlite: Use in-memory db instead of temp for mockdb (Andrew Chow)
a1080802f8 walletdb: Create a mock database of specific type (Andrew Chow)
7c0d34476d bench: reduce the number of txs in wallet for wallet loading bench (Andrew Chow)
f85b54ed27 bench: Add transactions directly instead of mining blocks (Andrew Chow)
d94244c4bf bench: reduce number of epochs for wallet loading benchmark (Andrew Chow)
817c051364 bench: use unsafesqlitesync in wallet loading benchmark (Andrew Chow)
9e404a9831 bench: Remove minEpochIterations from wallet loading benchmark (Andrew Chow)

Pull request description:

  `minEpochIterations` is probably unnecessary to set, so removing it makes the runtime much faster.

ACKs for top commit:
  Rspigler:
    tACK e673d8b475
  furszy:
    Code review ACK e673d8b4, nice PR.
  glozow:
    Concept ACK e673d8b475. For each commit, verified that there was a performance improvement without negating the purpose of the bench, and made some effort to verify that the code is correct.

Tree-SHA512: 9337352ef846cf18642d5c14546c5abc1674b4975adb5dc961a1a276ca91f046b83b7a5e27ea6cd26264b96ae71151e14055579baf36afae7692ef4029800877
2022-06-28 18:34:10 +01:00
fanquake
2364d17a31
Merge bitcoin/bitcoin#25480: Replace CountSecondsDouble with Ticks<SecondsDouble>
fa956e7508 Replace CountSecondsDouble with Ticks<SecondsDouble> (MacroFake)

Pull request description:

  Seems odd to have two ways to say exactly the same thing when one is sufficient.

ACKs for top commit:
  fanquake:
    ACK fa956e7508
  shaavan:
    ACK fa956e7508
  w0xlt:
    ACK fa956e7508

Tree-SHA512: b599470e19b693da1ed1102d1e86b08cb03adaddf2048752b6d050fdf86055be117ff0ae10b6953d03e00eaaf7b0cfa350137968b67d6c5b3ca68c5aa50ca6aa
2022-06-28 18:18:19 +01:00
fanquake
bace615ba3
Merge bitcoin/bitcoin#24565: Remove LOCKTIME_MEDIAN_TIME_PAST constant
fa1fe2e500 Remove LOCKTIME_MEDIAN_TIME_PAST constant (MarcoFalke)

Pull request description:

  The constant is exposed in policy code, which doesn't make sense:
  * Wallet and mempool need to assume the flag to be always active to function properly.
  * Setting (or unsetting) the flag has no effect on policy code.

  The constant is only used in `ContextualCheckBlock` (consensus code) to set a flag and then read the flag again. I think this can be better achieved by using a `bool`. If there is a need to use a flag in the future, it will be trivial to do so then.

  (The previous use for the constant was removed in df562d698a)

ACKs for top commit:
  Sjors:
    utACK fa1fe2e500
  glozow:
    code review ACK fa1fe2e500, AFAICT this is safe and makes sense as `SequenceLocks` doesn't use it, wallet/ATMP no longer need it since #24080, and `ContextualCheckBlock` effectively uses it as a roundabout boolean.
  instagibbs:
    utACK fa1fe2e500

Tree-SHA512: de1972498c545d608a09630d77d8c7e38ed50a6ec40d6c0d720310a1647ed5b48b4ace0078c80db10e7f97aacc552fffae251fe3256e9a19a908b933ba2dc552
2022-06-28 18:16:53 +01:00
laanwj
5bf65ec66e
Merge bitcoin/bitcoin#22558: psbt: Taproot fields for PSBT
b80de4c505 test: Test signing psbts without explicitly having scripts (Andrew Chow)
a73b56888a wallet: also search taproot pubkeys in FillPSBT (Andrew Chow)
6cff82722f sign: Use sigdata taproot spenddata when signing (Andrew Chow)
5f12fe3f36 psbt: Implement merge for Taproot fields (Andrew Chow)
1ece9a3715 psbt, test: Check for taproot fields in taproot psbt test (Andrew Chow)
496a1bbe5e taproot: Use pre-existing signatures if available (Andrew Chow)
0ad21e7c55 tests: Test taproot fields for PSBT (Andrew Chow)
103c6fd279 psbt: Remove non_witness_utxo for segwit v1+ (Andrew Chow)
7dccdd3157 Implement decodepsbt for Taproot fields (Andrew Chow)
ac7747585f Fill PSBT Taproot output data to/from SignatureData (Andrew Chow)
25b6ae46e7 Assert that TaprootBuilder is Finalized during GetSpendData (Andrew Chow)
3ae5b6af21 Store TaprootBuilder in SigningProviders instead of TaprootSpendData (Andrew Chow)
4d1223e512 Fetch key origins for Taproot keys (Andrew Chow)
52e3f2f88e Fill PSBT Taproot input data to/from SignatureData (Andrew Chow)
05e2cc9a30 Implement de/ser of PSBT's Taproot fields (Andrew Chow)
d557eff2ad Add serialization methods to XOnlyPubKey (Andrew Chow)
d43923c381 Add TaprootBuilder::GetTreeTuples (Andrew Chow)
ce911204e4 Move individual KeyOriginInfo de/ser to separate function (Andrew Chow)

Pull request description:

  Implements the Taproot fields for PSBT described in [BIP 371](https://github.com/bitcoin/bips/blob/master/bip-0371.mediawiki).

ACKs for top commit:
  laanwj:
    Code review ACK b80de4c505

Tree-SHA512: 50b79bb44f353c9ec2ef4c98aac08a81eba560987e5264a5684caa370e9c4e7a8255c06747fc47749511be45b32d01492e015f92b82be8d22bc8bf192073bd26
2022-06-28 16:44:03 +02:00
furszy
ac4fb3bbbe
gui: reset options, notify user about the backup creation 2022-06-28 10:29:08 -03:00
laanwj
55c9e2d790
Merge bitcoin/bitcoin#24378: refactor: make bind() and listen() mockable/testable
b2733ab6a8 net: add new method Sock::Listen() that wraps listen() (Vasil Dimov)
3ad7de225e net: add new method Sock::Bind() that wraps bind() (Vasil Dimov)

Pull request description:

  _This is a piece of #21878, chopped off to ease review._

  Add new methods `Sock::Bind()` and `Sock::Listen()` that wrap `bind()` and `listen()`.
  This will help to increase `Sock` usage and make more code mockable.

ACKs for top commit:
  pk-b2:
    ACK b2733ab6a8
  laanwj:
    Code review ACK b2733ab6a8

Tree-SHA512: c6e737606703e2106fe60cc000cfbbae3a7f43deadb25f70531e2cac0457e0b0581440279d14c76c492eb85c12af4adde52c30baf74542c41597e419817488e8
2022-06-28 15:10:00 +02:00
laanwj
ba29911e21
Merge bitcoin/bitcoin#25426: net: add new method Sock::GetSockName() that wraps getsockname() and use it in GetBindAddress()
a8d6abba5e net: change GetBindAddress() to take Sock argument (Vasil Dimov)
748dbcd9f2 net: add new method Sock::GetSockName() that wraps getsockname() (Vasil Dimov)

Pull request description:

  _This is a piece of #21878, chopped off to ease review._

  Wrap the syscall `getsockname()` in `Sock::GetSockName()` and change `GetBindAddress()` to take a `Sock` argument so that it can use the wrapper.

  This further encapsulates syscalls inside the `Sock` class and makes the callers mockable.

ACKs for top commit:
  laanwj:
    Code review ACK a8d6abba5e

Tree-SHA512: 3a73463258c0057487fb3fd67215816b03a1c5160f45e45930eaeef86bb3611ec385794cdb08339aa074feba8ad67cd2bfd3836f6cbd40834e15d933214a05dc
2022-06-28 13:40:05 +02:00
S3RK
d54c5c8b1b wallet: use CCoinControl to estimate signature size 2022-06-28 08:54:39 +02:00
S3RK
a94659c84e wallet: replace GetTxSpendSize with CalculateMaximumSignedInputSize 2022-06-28 08:33:40 +02:00
MacroFake
ee3ba5a76f
Merge bitcoin/bitcoin#25485: rpc: Use enum instead of string for filtertype_name
baf4efe02f rpc: use enum instead of string for filter type (w0xlt)

Pull request description:

  This PR changes the `getblockfilter` RPC to use `BlockFilterType` enum instead of a repeated string for `filtertype_name`.

ACKs for top commit:
  furszy:
    ACK baf4efe0
  brunoerg:
    ACK baf4efe02f

Tree-SHA512: 31c79c0a5f0b17fd69b399bb026f523003b656733d6b7d5ffe665921a8cc0f1e0334d2e465145cd89fbd85e196059cf56f4f11563bbc92948b0606080ca76524
2022-06-28 08:17:32 +02:00
Andrew Chow
a73b56888a wallet: also search taproot pubkeys in FillPSBT
When filling a PSBT, we search the listed pubkeys in order to determine
whether the current DescriptorScriptPubKeyMan could sign the transaction
even if it is not watching the scripts. With Taproot, the taproot
pubkeys need to be searched as well.
2022-06-27 16:47:48 -04:00
Andrew Chow
6cff82722f sign: Use sigdata taproot spenddata when signing
The taproot spenddata stored in a sigdata is the combination of data
existing previously (e.g. in a PSBT) and the data stored in a
SigningProvider. In order to use the external data when signing, we need
to be using the sigdata's spenddata.
2022-06-27 16:47:48 -04:00
Andrew Chow
5f12fe3f36 psbt: Implement merge for Taproot fields 2022-06-27 16:47:48 -04:00
Andrew Chow
496a1bbe5e taproot: Use pre-existing signatures if available
Actually use pre-existing signatures in CreateTaprootScriptSig if a
signature is found for the given key and leaf hash.
2022-06-27 16:47:48 -04:00
Andrew Chow
103c6fd279 psbt: Remove non_witness_utxo for segwit v1+
If all inputs are segwit v1+, the non_witness_utxos can be removed.
2022-06-27 16:47:48 -04:00
Andrew Chow
7dccdd3157 Implement decodepsbt for Taproot fields 2022-06-27 16:47:48 -04:00
Andrew Chow
ac7747585f Fill PSBT Taproot output data to/from SignatureData 2022-06-27 16:47:48 -04:00
Andrew Chow
25b6ae46e7 Assert that TaprootBuilder is Finalized during GetSpendData
GetSpendData needs to be finalized in order to be used. To avoid future
bugs, assert `!m_output_key.IsNull()` as m_output_key is only set during
Finalize.
2022-06-27 16:47:48 -04:00
Andrew Chow
3ae5b6af21 Store TaprootBuilder in SigningProviders instead of TaprootSpendData
TaprootSpendData can be gotten from TaprootBuilder, however for PSBT, we
also need TaprootBuilders directly (for the outputs). So we store the
TaprootBuilder in the FlatSigningProvider and when the TaprootSpendData
is needed, we generate it on the fly using the stored builder.
2022-06-27 16:47:48 -04:00
Andrew Chow
4d1223e512 Fetch key origins for Taproot keys 2022-06-27 16:47:48 -04:00
Andrew Chow
52e3f2f88e Fill PSBT Taproot input data to/from SignatureData 2022-06-27 16:47:48 -04:00
Andrew Chow
05e2cc9a30 Implement de/ser of PSBT's Taproot fields 2022-06-27 16:47:48 -04:00
Andrew Chow
d557eff2ad Add serialization methods to XOnlyPubKey
It is useful to have serialzation methods for XOnlyPubKey. These will
serialize the internal uint256, so it is not prefixed with the length as
CPubKey does.
2022-06-27 16:47:48 -04:00
Andrew Chow
d43923c381 Add TaprootBuilder::GetTreeTuples
GetTreeTuples returns the leaves in DFS order as tuples of depth, leaf
version, and script. This is a representation of the tree that can be
serialized.
2022-06-27 16:47:48 -04:00
Andrew Chow
ce911204e4 Move individual KeyOriginInfo de/ser to separate function
To make it easier to de/serialize individual KeyOriginInfo for PSBTs,
separate the actual de/serialization of KeyOriginInfo to its own
function.

This is an additional separation where any length prefix is processed by
the caller.
2022-06-27 16:47:48 -04:00
Carl Dong
0199bd35bb fuzz/rbf: Add missing TestingSetup
MarcoFalke mentioned that this is likely a bug since "any log messages
should be muted, not accumulated and turned into an OOM when fuzzing for
a long time".
2022-06-27 14:06:47 -04:00
w0xlt
baf4efe02f rpc: use enum instead of string for filter type 2022-06-27 14:33:10 -03:00
fanquake
2fe27029f5
Merge bitcoin/bitcoin#25404: p2p, doc: Use MAX_BLOCKS_TO_ANNOUNCE consistently
e357c89538 p2p, doc: Use MAX_BLOCKS_TO_ANNOUNCE consistently (Martin Zumsande)

Pull request description:

  Block announcements via headers may have up to `MAX_BLOCKS_TO_ANNOUNCE = 8` entries according to the definition of this constant.
  However, there are a few spots saying they should have a size _less than_ `MAX_BLOCKS_TO_ANNOUNCE`. Fix these.
  I don't think that this is critical (this only changes behavior when we get a headers announcement with exactly `MAX_BLOCKS_TO_ANNOUNCE` blocks which we can't connect), but it would be nice to handle this limit consistently.

ACKs for top commit:
  dergoegge:
    utACK e357c89538 - This PR makes the usage and docs of `MAX_BLOCKS_TO_ANNOUNCE` consistent with its description.

Tree-SHA512: f3772026ab0f402e3a551127ef6e4a98fa9e7af250715fe317c05988b5b33f2f3e098a00e03960d4d28c8bd2b7a97231f7f99f22f1c152c000b2e27b658cf8f2
2022-06-27 14:21:49 +01:00
w0xlt
e7a3f698b5 gui: Add Wallet Restore in the GUI
Co-authored-by: Shashwat Vangani <85434418+shaavan@users.noreply.github.com>
Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
2022-06-27 10:00:18 -03:00
Jon Atack
2ef5294a5b rpc: add RPCTypeCheck for getblockfrompeer inputs 2022-06-27 13:03:24 +02:00
MacroFake
50a3921c96
Merge bitcoin/bitcoin#25144: refactor: Pass Peer& to Misbehaving()
fa8aa0aa81 Pass Peer& to Misbehaving() (MacroFake)

Pull request description:

  `Misbehaving` has several coding related issues (ignoring the conceptual issues here for now):
  * It is public, but it is not supposed to be called from outside of net_processing. Fix that by making it private and creating a public `UnitTestMisbehaving` method for unit testing only.
  * It doesn't do anything if a `nullptr` is passed. It would be less confusing to just skip the call instead. Fix that by passing `Peer&` to `Misbehaving()`.
  * It calls `GetPeerRef`, causing `!m_peer_mutex` lock annotations to be propagated. This is harmless, but verbose. Fix it by removing the no longer needed call to `GetPeerRef` and the no longer needed lock annotations.

ACKs for top commit:
  vasild:
    ACK fa8aa0aa81
  w0xlt:
    Code Review ACK fa8aa0aa81

Tree-SHA512: e60a6b317f2b826f9e0724285d00b632d3e2a91ded9fa5ba01c80766c5d39270b719be234c01302d46eaba600910032693836aa116ff05ee1b590c7530881cd3
2022-06-27 11:21:08 +02:00
MacroFake
fa956e7508
Replace CountSecondsDouble with Ticks<SecondsDouble> 2022-06-27 09:34:09 +02:00
MacroFake
dde7205c57
Merge bitcoin/bitcoin#23418: Fix signed integer overflow in prioritisetransaction RPC
fa07f84e31 Fix signed integer overflow in prioritisetransaction RPC (MarcoFalke)
fa52cf8e11 refactor: Replace feeDelta by m_modified_fee (MarcoFalke)

Pull request description:

  Signed integer overflow is UB in theory, but not in practice. Still,
  it would be nice to avoid this UB to allow Bitcoin Core to be
  compiled with sanitizers such as `-ftrapv` or ubsan.

  It is impossible to predict when and if an overflow occurs, since
  the overflow caused by a prioritisetransaction RPC might only be
  later hit when descendant txs are added to the mempool.
  Since it is impossible to predict reliably, leave it up to the user
  to use the RPC endpoint responsibly, considering their mempool
  limits and usage patterns.

  Fixes: #20626
  Fixes: #20383
  Fixes: #19278
  Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34146 / https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47132

  ## Steps to reproduce

  Build the code without the changes in this pull.

  Make sure to pass the sanitizer flag:

  ```
  ./autogen.sh && ./configure --with-sanitizers=signed-integer-overflow && make clean && make -j $(nproc)
  ```

  ### Reproduce on RPC

  ```
  ./src/bitcoind -chain=regtest -noprinttoconsole &
  ./src/bitcoin-cli -chain=regtest prioritisetransaction 00000000deadbeef00000000deadbeef00000000deadbeef00000000deadbeef 0 9123456789123456789
  ./src/bitcoin-cli -chain=regtest prioritisetransaction 00000000deadbeef00000000deadbeef00000000deadbeef00000000deadbeef 0 9123456789123456789
  |> txmempool.cpp:920:15: runtime error: signed integer overflow: 9123456789123456789 + 9123456789123456789 cannot be represented in type 'long int'

  ./src/bitcoin-cli -chain=regtest stop
  ```

  ### By fuzzing

  ```
  wget https://github.com/bitcoin/bitcoin/files/8921302/clusterfuzz-testcase-minimized-validation_load_mempool-5599531390074880.bin.txt
  FUZZ=validation_load_mempool ./src/test/fuzz/fuzz ./clusterfuzz-testcase-minimized-validation_load_mempool-5599531390074880.bin.txt
  |> txmempool.cpp:920:15: runtime error: signed integer overflow: 7214801925397553184 + 2314885530818453536 cannot be represented in type 'long int'
  |> validation_load_mempool: succeeded against 1 files in 0s.

ACKs for top commit:
  vasild:
    ACK fa07f84e31
  dunxen:
    ACK fa07f84
  LarryRuane:
    ACK fa07f84e31

Tree-SHA512: 4a357950af55a49c9113da0a50c2e743c5b752f0514dd8d16cd92bfde2f77dd0ef56aa98452626df6f7f7a5b51d1227021f6bc94091201a179f0d488ee32a0df
2022-06-27 08:25:19 +02:00
MacroFake
f52d074363
Merge bitcoin/bitcoin#25439: rpc: Return incrementalrelayfee in getmempoolinfo
fafee78188 rpc: Return incrementalrelayfee in getmempoolinfo (MacroFake)

Pull request description:

  Seems odd to return other policy info, but not the incremental relay fee

ACKs for top commit:
  1440000bytes:
    ACK fafee78188
  w0xlt:
    Code Review ACK fafee78188
  jarolrod:
    tACK fafee78188

Tree-SHA512: faad0af6c039b8257acbeac913bc5dcdb2ea2db304c95e52601536c8de60eb1186e9fbb4a64a68adf476605f18022aeda16a5644a0d7912592b0977e4c029638
2022-06-27 08:19:14 +02:00
MacroFake
1da1c0dd66
Merge bitcoin/bitcoin#25456: rpc: Use steady_clock for getrpcinfo durations
fabae3541a rpc: Use steady_clock for getrpcinfo durations (MacroFake)

Pull request description:

  Currently it uses `GetTimeMicros`, which is the system time. Using steady time instead, makes the code type safe and avoids spurious offsets when the system time adjusts.

ACKs for top commit:
  laanwj:
    Code review ACK fabae3541a
  w0xlt:
    Code Review ACK fabae3541a
  shaavan:
    Code Review ACK fabae3541a

Tree-SHA512: eb25fe3e69bf42ec8a2d4aaa69b435de7654b0d07218ce3e0c03ebaef6eb7f713128779057d012621773a34675a81f5757e7b2502c13b82adaf6e2df970d8c66
2022-06-24 17:27:25 +02:00
MacroFake
fa8a1c0696
rpc: Fix Univalue push_backV OOM in listtransactions 2022-06-24 08:45:44 +02:00
MacroFake
f697c068eb
Merge bitcoin/bitcoin#25438: refactor: remove unused methods in classes CDBIterator,CDBWrapper,CCoinsViewDBCursor
e4b4db5610 refactor: remove unused method `CDBWrapper::CompactRange` (Sebastian Falbesoner)
fb38c6e21f refactor: remove unused methods `{CDBIterator,CCoinsViewDBCursor}::GetValueSize()` (Sebastian Falbesoner)

Pull request description:

  The `GetValueSize` methods haven't been used since the chainstate db cache has been switched from per-tx to per-txout model years ago (PR #10195, commit d342424301). The `CompactRange` is unused since the txindex migration code was removed (PR https://github.com/bitcoin/bitcoin/pull/22626, commit fa20f815a9).

ACKs for top commit:
  fanquake:
    ACK e4b4db5610
  furszy:
    re-ACK e4b4db56
  laanwj:
    Code review ACK e4b4db5610

Tree-SHA512: 77da445fb70c744046263c6f2ddb05782b68e3d4b2ea604dd7c7dc73ce7c1f2d2b48ec68db4dcb03e35fc27488b99b0a420f6fa3d5b83d325c1708ed68e99e0a
2022-06-24 08:09:50 +02:00
Ryan Ofsky
230a2f4cc3 wallet test: Add unit test for wallet scan save_progress option 2022-06-23 17:13:40 -03:00
w0xlt
a89ddfbe22 wallet: Save wallet scan progress
Currently, the wallet scan progress is not saved.
If it is interrupted,  it will be necessary to start from
scratch on the next load.
With this change, progress is saved every 60 seconds.

Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
Co-authored-by: Jon Atack <jon@atack.com>
Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2022-06-23 17:13:40 -03:00
laanwj
2598720d6c
Merge bitcoin/bitcoin#25457: Use more specific path when including memenv.h header
f3b5c1e452 Use more specific path when including `memenv.h` header (Hennadii Stepanov)

Pull request description:

  This PR makes our code base compatible with `leveldb`'s own CMake [project](https://github.com/bitcoin/bitcoin/blob/master/src/leveldb/CMakeLists.txt).

  Required for https://github.com/hebasto/bitcoin/pull/3.

  As a justification, please note that internally `leveldb` uses `#include "helpers/memenv/memenv.h"` rather `#include "memenv.h"`.

  #### Guix builds on `arm64`:
  ```
  # find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
  0e069318a681f9f848e803e5df8b25426b47ddc8994a21e0b83f0f86e7db7ae0  guix-build-f3b5c1e4522f/output/arm-linux-gnueabihf/SHA256SUMS.part
  e68e1b65514d42f1e33b2754356b68d3ddea1fe9df89d02df51375792867dd8c  guix-build-f3b5c1e4522f/output/arm-linux-gnueabihf/bitcoin-f3b5c1e4522f-arm-linux-gnueabihf-debug.tar.gz
  6b1b5c1f9525e8e467d038751bfc070ed6cbfbd42b17add2faac76fee421343e  guix-build-f3b5c1e4522f/output/arm-linux-gnueabihf/bitcoin-f3b5c1e4522f-arm-linux-gnueabihf.tar.gz
  9f8e941f37aa243fd36c1eaade9b88081b2a27562bfe7d8208d3c6021ecb6f03  guix-build-f3b5c1e4522f/output/arm64-apple-darwin/SHA256SUMS.part
  88cf46d00e67f3493e6ecbb85002ca0ff93dd47af3e93e51d95f92ed3218752f  guix-build-f3b5c1e4522f/output/arm64-apple-darwin/bitcoin-f3b5c1e4522f-arm64-apple-darwin-unsigned.dmg
  5afa9ae6943386ae600d612f1ed4831c0e92011f87284ae25465c2ffc6b8bb2b  guix-build-f3b5c1e4522f/output/arm64-apple-darwin/bitcoin-f3b5c1e4522f-arm64-apple-darwin-unsigned.tar.gz
  0b72a400f842ff31233ced2aadf0b8309ba6695b075b9f4345708dca235f6368  guix-build-f3b5c1e4522f/output/arm64-apple-darwin/bitcoin-f3b5c1e4522f-arm64-apple-darwin.tar.gz
  7912417348175c293002ccd3413ecb53c5a1d29a234959a94bdbd6481bd58d08  guix-build-f3b5c1e4522f/output/dist-archive/bitcoin-f3b5c1e4522f.tar.gz
  f8d28c57dc97fd1e6844fcb2679f2a44fc360ef37aad3fc4185fa1d091baf4b1  guix-build-f3b5c1e4522f/output/powerpc64-linux-gnu/SHA256SUMS.part
  c219a024c95bcdfe28961c18b8118152becf201b00f9e0e28ff35a7a2646fc9b  guix-build-f3b5c1e4522f/output/powerpc64-linux-gnu/bitcoin-f3b5c1e4522f-powerpc64-linux-gnu-debug.tar.gz
  2790ff48593be1699e4175cc31a6cc11fd2e758cdc99220c5a87ddb658d8a794  guix-build-f3b5c1e4522f/output/powerpc64-linux-gnu/bitcoin-f3b5c1e4522f-powerpc64-linux-gnu.tar.gz
  8d13f9f6141776263faceb396cbe3089e5c165523a5da160ba9ec6814744f7d4  guix-build-f3b5c1e4522f/output/powerpc64le-linux-gnu/SHA256SUMS.part
  72c1e8d7a9f2f0ff76c1dd84b4614202ce6734cb8ff29b2cf2cfc20a218d3aa5  guix-build-f3b5c1e4522f/output/powerpc64le-linux-gnu/bitcoin-f3b5c1e4522f-powerpc64le-linux-gnu-debug.tar.gz
  ed0494b336a1ae00050137ed0d18130d5c1213e6d45fada439de4e799ebfb720  guix-build-f3b5c1e4522f/output/powerpc64le-linux-gnu/bitcoin-f3b5c1e4522f-powerpc64le-linux-gnu.tar.gz
  a2a11b57a4a93b0b079c87c303e4c5250b16994d20f87ae362850efc1c181e57  guix-build-f3b5c1e4522f/output/riscv64-linux-gnu/SHA256SUMS.part
  ff63220629ef4b318cc9c2b858204961bc29fd0e901817a39e50e6893925f153  guix-build-f3b5c1e4522f/output/riscv64-linux-gnu/bitcoin-f3b5c1e4522f-riscv64-linux-gnu-debug.tar.gz
  eb0c0b3709a2d4fe9a6c18ad7a14b90a32fe8a5a7d72f75400ae014f2c847264  guix-build-f3b5c1e4522f/output/riscv64-linux-gnu/bitcoin-f3b5c1e4522f-riscv64-linux-gnu.tar.gz
  a82bb28e2a8c6523854f4f9d6ff89d6ba096fff526f17bf6182fd6b2ebf96395  guix-build-f3b5c1e4522f/output/x86_64-apple-darwin/SHA256SUMS.part
  91d2eea67bfde7a363c6ede8c358fb3de842b55cfe428abafa7b5985d619c62c  guix-build-f3b5c1e4522f/output/x86_64-apple-darwin/bitcoin-f3b5c1e4522f-x86_64-apple-darwin-unsigned.dmg
  f3cbc79b8fac7e8a8c9ba63b774cadb5a09cd64cc942e7b68cd1fc566b371021  guix-build-f3b5c1e4522f/output/x86_64-apple-darwin/bitcoin-f3b5c1e4522f-x86_64-apple-darwin-unsigned.tar.gz
  91fb98ed086613bb85959e9fc060ef0f816d5b4d52087b003c6a72ecf1c1309b  guix-build-f3b5c1e4522f/output/x86_64-apple-darwin/bitcoin-f3b5c1e4522f-x86_64-apple-darwin.tar.gz
  62309af3fc8316abd4c8f8285c666c568c140b9312f252a47ca6611fb51fef5e  guix-build-f3b5c1e4522f/output/x86_64-linux-gnu/SHA256SUMS.part
  deb27b75f52fb40cd13bfc6d594ed5ff0d82d1c211e2a6a91b9ca06ee3b8335b  guix-build-f3b5c1e4522f/output/x86_64-linux-gnu/bitcoin-f3b5c1e4522f-x86_64-linux-gnu-debug.tar.gz
  89faeb1f32f0447d26a73253a9f581b40b01982862351a7dd0cee05c8dbf29cc  guix-build-f3b5c1e4522f/output/x86_64-linux-gnu/bitcoin-f3b5c1e4522f-x86_64-linux-gnu.tar.gz
  5de46eec42bcd1e2e0fd3c9c6978a8a945b95411a9051fac9bb8a65d6b4875a5  guix-build-f3b5c1e4522f/output/x86_64-w64-mingw32/SHA256SUMS.part
  3271137a901889a38214173f01f96ae98385ea607e9573eaa2966e68c68401e1  guix-build-f3b5c1e4522f/output/x86_64-w64-mingw32/bitcoin-f3b5c1e4522f-win64-debug.zip
  7a74bf455bffa0d2abb99ce31ea1ef8088928f54c1f3c6e27044392f27e3e752  guix-build-f3b5c1e4522f/output/x86_64-w64-mingw32/bitcoin-f3b5c1e4522f-win64-setup-unsigned.exe
  73a23fd9846e615afcd569adc79fafdcf55b0efa9c383d2d0c9579fb0f79b91a  guix-build-f3b5c1e4522f/output/x86_64-w64-mingw32/bitcoin-f3b5c1e4522f-win64-unsigned.tar.gz
  ee5f3f9eb65f0ac1c0879d0aaa88cf20d8ca9329ba505f77580a0c9b57cd3244  guix-build-f3b5c1e4522f/output/x86_64-w64-mingw32/bitcoin-f3b5c1e4522f-win64.zip
  ```

ACKs for top commit:
  laanwj:
    Code review ACK f3b5c1e452
  fanquake:
    ACK f3b5c1e452

Tree-SHA512: 62e7cf49bc4ce08c8373a0fcfaf4ca10a83d18d0d00bdb21983c25b4b9192ace74acf64362b47faa429d13dbaf63be953fd3aa3b92366603866a472f95ef09a1
2022-06-23 19:32:10 +02:00
fanquake
e05564d706
Merge bitcoin/bitcoin#25446: p2p: Set CNode::m_relays_txs=true when receiving BIP37 filters
e7a9133766 [net processing] Set CNode::m_relays_txs=true when receiving BIP37 filters (dergoegge)

Pull request description:

  This line was accidentally removed in https://github.com/bitcoin/bitcoin/pull/22778.

  Receiving a `filterload` message implies that we should relay txs to the sender (`CNode::m_relays_txs = true`). `CNode::m_relays_txs` is only used for the inbound eviction logic, so removing the line might have slightly changed the eviction behaviour but nothing else.

ACKs for top commit:
  laanwj:
    Code review ACK e7a9133766
  vasild:
    ACK e7a9133766

Tree-SHA512: 19c5df0f579f707c6c7900d12a6b71ac69e802be64f7d2fdcc40ac714c918dc4c17def164592f8836cc105a03daefefca3ca5e10423145eca8db4348c27c9cfc
2022-06-23 16:18:07 +01:00
glozow
fa076515b0 [rpc] add new submitpackage RPC
It could be unsafe/confusing to create an actual mainnet interface while
package relay doesn't exist. However, a regtest-only interface allows
wallet/application devs to test current package policies.
2022-06-23 14:35:04 +01:00
Hennadii Stepanov
f3b5c1e452
Use more specific path when including memenv.h header 2022-06-23 15:33:01 +02:00
MacroFake
fabae3541a
rpc: Use steady_clock for getrpcinfo durations 2022-06-23 15:32:17 +02:00
Sebastian Falbesoner
e4b4db5610 refactor: remove unused method CDBWrapper::CompactRange
This method hasn't been used since the txindex migration code has been
removed (PR #22626, commit fa20f815a9).

Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
2022-06-23 13:59:25 +02:00
laanwj
bc83710fdc
Merge bitcoin-core/gui#623: Getting ready to Qt 6 (9/n). Apply Qt 6 specific changes
d8d99d041a qt6: Do not use deprecated high DPI attributes in Qt 6 (Hennadii Stepanov)
8927bb8f06 refactor: Fix style in `initTranslations()` function (Hennadii Stepanov)
ad73447dc2 qt6: Do not use deprecated `QLibraryInfo::path` in Qt 6 (Hennadii Stepanov)
3f51d0b8b2 qt6: Fix type registration (Hennadii Stepanov)

Pull request description:

  One more step in migration to Qt 6.

  Could be tested with hebasto/bitcoin#3 or bitcoin/bitcoin#24798.

  No behavior change when compiling with Qt 5.

ACKs for top commit:
  laanwj:
    Code review ACK d8d99d041a
  jarolrod:
    ACK d8d99d041a

Tree-SHA512: e5f92a80f8622e5f95dd98a90783956a26d3c8382b9ca8e479fb6c152cfdc85a2f6084e78d463ceea1e0f0b3ac72d2b086c8ca24967b2b6070553317e9e3252e
2022-06-23 11:47:51 +02:00
Carl Dong
ccbaf546a6 scripted-diff: Rename DEFAULT_MAX_MEMPOOL_SIZE to indicate SI unit
Better to be explicit when it comes to sizes to avoid unintentional
bugs. We use MB and KB all over the place.

-BEGIN VERIFY SCRIPT-
find_regex="DEFAULT_MAX_MEMPOOL_SIZE" \
    && git grep -l -E "$find_regex" \
        | xargs sed -i -E "s@$find_regex@\0_MB@g"
-END VERIFY SCRIPT-
2022-06-22 18:18:56 -04:00
Carl Dong
fc02f77ca6 ArgsMan: Add Get*Arg functions returning optional
This allows the caller to not provide a default at all and just check
inside the optional to see if the arg was set or not.
2022-06-22 18:18:52 -04:00
furszy
324f00a642
refactor: 'ListReceived' use optional for filtered address
Plus remove open bracket jump line
2022-06-22 12:51:30 -03:00
furszy
b459fc122f
refactor: RPC 'ListReceived', encapsulate m_address_book access 2022-06-22 12:51:30 -03:00
furszy
fa9f2ab8fd
refactor: RPC 'listlabels', encapsulate 'CWallet::ListAddrBookLabels' functionality
Mainly to not access 'm_address_book' externally.
2022-06-22 12:51:30 -03:00
laanwj
a085a55491
Merge bitcoin/bitcoin#25428: Remove Sock::Release() and CloseSocket()
a724c39606 net: rename Sock::Reset() to Sock::Close() and make it private (Vasil Dimov)
e8ff3f0c52 net: remove CloseSocket() (Vasil Dimov)
175fb2670a net: remove now unused Sock::Release() (Vasil Dimov)

Pull request description:

  _This is a piece of #21878, chopped off to ease review._

  * `Sock::Release()` is unused, thus remove it
  * `CloseSocket()` is only called from `Sock::Reset()`, so move the body of `CloseSocket()` inside `Sock::Reset()` and remove `CloseSocket()` - this helps to hide low level file descriptor sockets inside the `Sock` class.
  * Rename `Sock::Reset()` to `Sock::Close()` and make it `private` - to be used only in the destructor and in the `Sock` assignment operator. This simplifies the public API by removing one method from it.

ACKs for top commit:
  laanwj:
    Code review ACK a724c39606

Tree-SHA512: 4b12586642b3d049092fadcb1877132e285ec66a80af92563a7703c6970e278e0f2064fba45c7eaa78eb65db94b3641fd5e5264f7b4f61116d1a6f3333868639
2022-06-22 11:07:17 +02:00
dergoegge
e7a9133766 [net processing] Set CNode::m_relays_txs=true when receiving BIP37 filters
This line was accidentally removed in #22778.
2022-06-22 11:03:35 +02:00
MarcoFalke
fa1fe2e500
Remove LOCKTIME_MEDIAN_TIME_PAST constant 2022-06-22 09:54:15 +02:00
MarcoFalke
fa07f84e31
Fix signed integer overflow in prioritisetransaction RPC 2022-06-22 09:32:09 +02:00
MarcoFalke
fa52cf8e11
refactor: Replace feeDelta by m_modified_fee
* feeDelta tracked the delta (to be applied on top of the actual fee)
* m_modified_fee tracks the actual fee with the delta included
* Instead of passing in the new total delta to the Updater, pass in by
  how much the total delta should be modified.

This is needed for the next commit, but makes sense on its own because
the same is done by UpdateDescendantState and UpdateAncestorState.
2022-06-22 09:32:07 +02:00
Vasil Dimov
a724c39606
net: rename Sock::Reset() to Sock::Close() and make it private
Outside of `Sock`, `Sock::Reset()` was used in just one place (in
`i2p.cpp`) which can use the assignment operator instead.

This simplifies the public `Sock` API by having one method less.
2022-06-22 09:19:43 +02:00
MarcoFalke
fa7cbc6e5c
build: Remove negated --enable-fuzz checks from build system 2022-06-22 08:12:23 +02:00
MacroFake
e3b06e8dd8
Merge bitcoin/bitcoin#25440: log: Use consistent wording in random.cpp log
c01ae8f5ea Use consistent wording in log (Igor Bubelov)

Pull request description:

  It's a trivial change, but it bothers me a bit that two log lines in a row aren't grammatically identical while following exactly the same pattern. I've read `contributing.md` and I'm aware that changes like this are usually being ignored and dropped, but I decided to leave it here anyway in case someone feels the same way about inconsistent log messages or grammar =)

ACKs for top commit:
  laanwj:
    Code review ACK c01ae8f5ea

Tree-SHA512: d5b3849b3a6e3de7ea9b468c05f17cacd1dbd1aca2f3401b5138383dc8d385cea9e221db558ab472c1c4c7f6921d57dcc7af89a54776c5765fa00e429694b4e7
2022-06-22 07:49:22 +02:00
laanwj
a4e066af85
Merge bitcoin/bitcoin#24352: Add doc/design/libraries.md
dc1e7ad7a5 Add doc/design/libraries.md (Ryan Ofsky)

Pull request description:

  Prompted by the [libbitcoinkernel issue #24303](https://github.com/bitcoin/bitcoin/issues/24303) and PRs, I started looking at  existing libraries and what their dependencies are and wrote this document to describe them and where `libbitcoinkernel` fits in.

  Readable link is:  https://github.com/ryanofsky/bitcoin/blob/pr/libs/doc/design/libraries.md

  Feedback is welcome

ACKs for top commit:
  laanwj:
    ACK dc1e7ad7a5
  hebasto:
    Approach ACK dc1e7ad7a5, using this doc as a guide in https://github.com/hebasto/bitcoin/pull/3 :)

Tree-SHA512: 7687b1847797c50de1f5ea721bd201cc8304690064743fbe6d69e2198cc239084e9da7d158be65bea948a6ec3d71d74c84122c0e523c390b389b49ea8d2cddc9
2022-06-22 07:13:17 +02:00
laanwj
58b9d6cf9e
Merge bitcoin-core/gui#620: Replace QRegExp with QRegularExpression
67364ebe4c test, qt: Add tests for `GUIUtil::extractFirstSuffixFromFilter` (w0xlt)
ace9af5688 qt: Replace `QRegExp` with `QRegularExpression` (w0xlt)
c378535e28 qt: Add a function that extracts the suffix from a filter (w0xlt)

Pull request description:

  Picking up https://github.com/bitcoin-core/gui/pull/606 (labeled "Up for grabs") and applying https://github.com/bitcoin-core/gui/pull/606#pullrequestreview-984607067 and https://github.com/bitcoin-core/gui/pull/606#issuecomment-1137149907.

  Replaces occurrences of `QRegExp` usage with `QRegularExpression` as part of the roadmap for Qt6 integration.

  Fixes https://github.com/bitcoin-core/gui/issues/578

ACKs for top commit:
  laanwj:
    Code review and lightly tested ACK 67364ebe4c
  hebasto:
    ACK 67364ebe4c

Tree-SHA512: 4a17d83e557bc635cbd1a15776856e9edb7162b23a369ccbd2ac59c68b8a1ea663baaa7d5ad98e419dc03b91ef3315c768eeadc01c0b29162de109493161e814
2022-06-22 07:12:10 +02:00
Andrew Chow
174b821e64
Merge bitcoin/bitcoin#25427: wallet: remove extra wtx lookup in AddToSpends
32e5edc0f4 wallet: avoid extra wtx lookup in AddToSpends (furszy)

Pull request description:

  As `AddToSpends` is only called from `AddToWallet` and `LoadToWallet`, places where we insert the wtx into the wallet map, we can directly feed `AddToSpends` with the `wtx` and remove another extra lookup.

ACKs for top commit:
  laanwj:
    Code review ACK 32e5edc0f4
  achow101:
    ACK 32e5edc0f4
  theStack:
    Code-review ACK 32e5edc0f4
  w0xlt:
    Code Review ACK 32e5edc0f4
  brunoerg:
    crACK 32e5edc0f4

Tree-SHA512: e9fb8df44c3e3fa26c107d261bf78e45014b4755890a64817f2be62ee6b7751f5dd2813a18dcb103a21ddba1422f9d2d59c4bf186f08314e634365d36b01be8f
2022-06-21 20:56:24 -04:00
w0xlt
67364ebe4c test, qt: Add tests for GUIUtil::extractFirstSuffixFromFilter 2022-06-21 19:19:31 -03:00
w0xlt
ace9af5688 qt: Replace QRegExp with QRegularExpression
Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
Co-authored-by: Jarol Rodriguez <jarolrod@tutanota.com>
2022-06-21 19:19:18 -03:00
w0xlt
c378535e28 qt: Add a function that extracts the suffix from a filter
Extract the 'Extract first suffix from filter pattern...'
functionality into a testable utility function
2022-06-21 19:16:39 -03:00
laanwj
c3a41ad980
Merge bitcoin/bitcoin#25314: p2p: always set nTime for self-advertisements
99b9e5f3a9 p2p: always set nTime for self-advertisements (Martin Zumsande)

Pull request description:

  This logic was recently changed in 0cfc0cd322 to overwrite `addrLocal` with the address they gave us when self-advertising to an inbound peer. But if we don't also change `nTime` again from the default `TIME_INIT`, our peer will not relay our advertised address any further.

ACKs for top commit:
  naumenkogs:
    ACK 99b9e5f3a9
  laanwj:
    Code review ACK 99b9e5f3a9
  vasild:
    ACK 99b9e5f3a9

Tree-SHA512: 4c7ea51cc77ddaa4b3537962ad2ad085f7ef5322982d3b1f5baecb852719eb99dd578436ca63432cb6b0a4fbd8b59fca793caf326c4663a4d6f34301e8146aa2
2022-06-22 00:00:43 +02:00
MacroFake
fafee78188
rpc: Return incrementalrelayfee in getmempoolinfo 2022-06-21 18:03:29 +02:00
Igor Bubelov
c01ae8f5ea Use consistent wording in log 2022-06-21 22:54:55 +07:00
Sebastian Falbesoner
fb38c6e21f refactor: remove unused methods {CDBIterator,CCoinsViewDBCursor}::GetValueSize()
These methods haven't been used since the chainstate db cache has been
switched from per-tx to per-txout model years ago (PR #10195, commit
d342424301).
2022-06-21 16:19:10 +02:00
furszy
83e42c4b94
refactor: use 'ForEachAddrBookEntry' in RPC 'getaddressesbylabel' 2022-06-21 10:23:20 -03:00
furszy
2b48642499
refactor: use ForEachAddrBookEntry in interfaces::getAddresses 2022-06-21 10:23:20 -03:00
furszy
032842ae41
wallet: implement ForEachAddrBookEntry method 2022-06-21 10:23:20 -03:00
furszy
09649bc95d
refactor: implement general 'ListAddrBookAddresses' for addressbook destinations lookup 2022-06-21 10:23:20 -03:00
Hennadii Stepanov
d8d99d041a
qt6: Do not use deprecated high DPI attributes in Qt 6
In Qt 6, high DPI pixmaps and scaling are always enabled.

https://doc.qt.io/qt-6/highdpi.html
2022-06-21 13:50:48 +02:00
Hennadii Stepanov
8927bb8f06
refactor: Fix style in initTranslations() function 2022-06-21 13:40:45 +02:00
Hennadii Stepanov
ad73447dc2
qt6: Do not use deprecated QLibraryInfo::path in Qt 6
See https://doc.qt.io/qt-6/qtcore-changes-qt6.html#other-classes
2022-06-21 13:39:26 +02:00
Hennadii Stepanov
3f51d0b8b2
qt6: Fix type registration
In Qt 6, registration of `QDataStream` streaming operators is done
automatically. Consequently, `qRegisterMetaTypeStreamOperators()` does
no longer exist. Calls to this method have to be removed when porting
to Qt 6.

See https://doc.qt.io/qt-6/qtcore-changes-qt6.html#the-qmetatype-class
2022-06-21 13:14:21 +02:00
laanwj
5884a47c36
Merge bitcoin/bitcoin#25422: build: globally define NOMINMAX when building with mingw-w64
58a9601dff build: globally define NOMINMAX (fanquake)

Pull request description:

  Define (and document) `NOMINMAX` once, rather than across multiple
  source files.

  Defining this prevents the definition of min/max macros when using
  mingw-w64, which may conflict with unprefixed std::min/max usage. While
  that might not be the case for us, we'd always prefer to use the standard
  library in any case.

  For example:
  73cadc06c6/mingw-w64-headers/include/ntdef.h (L289-L300)

  Note that we already define NOMINMAX globally when building with MSVC.

  Guix Build (arm64):
  ```bash
  d3a3b7045dc1677f6a0a2a73a484f156c81ae764058003d9e870b346912b744a  guix-build-58a9601dffa6/output/arm-linux-gnueabihf/SHA256SUMS.part
  3e66540a3f8c8a10864ab2fed69581241fa41af86bbb028e5f7c3dd4ba859c64  guix-build-58a9601dffa6/output/arm-linux-gnueabihf/bitcoin-58a9601dffa6-arm-linux-gnueabihf-debug.tar.gz
  78756e20d45e327cfd7f9e65858bf6d3814bcbe08f9f825fd6dfc9dff999ea6d  guix-build-58a9601dffa6/output/arm-linux-gnueabihf/bitcoin-58a9601dffa6-arm-linux-gnueabihf.tar.gz
  11073e88d4fd0411c5119a3dca3a90788693fa9aa5134339c84be98ae893cd77  guix-build-58a9601dffa6/output/arm64-apple-darwin/SHA256SUMS.part
  deffd5f8c6286be34bc35e71ec70300bacb37e1b1a83e67c0833cb57d7a45529  guix-build-58a9601dffa6/output/arm64-apple-darwin/bitcoin-58a9601dffa6-arm64-apple-darwin-unsigned.dmg
  acee7e98c5ec41f67e86c78dc5b45fa8bc82de86a04b8c43dbf9c59e7aff36a9  guix-build-58a9601dffa6/output/arm64-apple-darwin/bitcoin-58a9601dffa6-arm64-apple-darwin-unsigned.tar.gz
  83f7cbaf6680fe8981db9260b97ca87d609a76c0857a744c7d406645d2484e1b  guix-build-58a9601dffa6/output/arm64-apple-darwin/bitcoin-58a9601dffa6-arm64-apple-darwin.tar.gz
  b8c73b40a5e307e9e7e482ce92164990d442f3f105a5240ec6eb96a775cb35d5  guix-build-58a9601dffa6/output/dist-archive/bitcoin-58a9601dffa6.tar.gz
  cc435cd925771af7e261d0121047339ea8fddb0d1548b699c12108a62988cd32  guix-build-58a9601dffa6/output/powerpc64-linux-gnu/SHA256SUMS.part
  7a68bd3181a054056b0a5eb6e830b90ac4ba8435114127d5f1720643011aa78f  guix-build-58a9601dffa6/output/powerpc64-linux-gnu/bitcoin-58a9601dffa6-powerpc64-linux-gnu-debug.tar.gz
  bc55b95e263c455a964d9463a3ee60dabee1d10cefc6641ed29a3b1b317d61e0  guix-build-58a9601dffa6/output/powerpc64-linux-gnu/bitcoin-58a9601dffa6-powerpc64-linux-gnu.tar.gz
  49df78009d80af02262806c6c395e2c884a979b1ea13d01aa27d8188403e29d1  guix-build-58a9601dffa6/output/powerpc64le-linux-gnu/SHA256SUMS.part
  29dc7a0e10707b3511fa2afb6977df7ebbb67f796d8be5a042abc14eba764aef  guix-build-58a9601dffa6/output/powerpc64le-linux-gnu/bitcoin-58a9601dffa6-powerpc64le-linux-gnu-debug.tar.gz
  51b7f8e1bccff1e2ce1860bbc382eefe648b90cc3374cdfa3a95a7454386e77d  guix-build-58a9601dffa6/output/powerpc64le-linux-gnu/bitcoin-58a9601dffa6-powerpc64le-linux-gnu.tar.gz
  e62e46d8cebbbfc0f587e930acb648fcae99cfe8b2f63aeba98e46e3338fe1e3  guix-build-58a9601dffa6/output/riscv64-linux-gnu/SHA256SUMS.part
  fa5d0a074ca586583bf08dbf748909b3ff5e0a54a2e5aaa88abec666e17b4e72  guix-build-58a9601dffa6/output/riscv64-linux-gnu/bitcoin-58a9601dffa6-riscv64-linux-gnu-debug.tar.gz
  684b2917fd27a41f884bb6870f7fac847d52b6f8b40df5779d1c674409f7cd14  guix-build-58a9601dffa6/output/riscv64-linux-gnu/bitcoin-58a9601dffa6-riscv64-linux-gnu.tar.gz
  7d7cfd0212b49eec48c7f8dc0d97add53096685dfd646feac466c27a45d20c97  guix-build-58a9601dffa6/output/x86_64-apple-darwin/SHA256SUMS.part
  d70ae6d060b7832f8741dc5d1958cc0d32702605c863254303107246deec0aa6  guix-build-58a9601dffa6/output/x86_64-apple-darwin/bitcoin-58a9601dffa6-x86_64-apple-darwin-unsigned.dmg
  930f3ec43896404208ebdb582c9175e3a5a2470d778722e0001addde84dad99a  guix-build-58a9601dffa6/output/x86_64-apple-darwin/bitcoin-58a9601dffa6-x86_64-apple-darwin-unsigned.tar.gz
  2d8a9d12aadcf60634db953fcb8bd496a002608e9a64eb7d60bb7ffe1f94489f  guix-build-58a9601dffa6/output/x86_64-apple-darwin/bitcoin-58a9601dffa6-x86_64-apple-darwin.tar.gz
  10363729ece6e1c2cbdf435483006191bf17d1def2d318ff8357197d91c06ded  guix-build-58a9601dffa6/output/x86_64-linux-gnu/SHA256SUMS.part
  d50ec8e4f72e8b064b196eb0ece212f7b0b126f4b8b644c4451084cbf0416072  guix-build-58a9601dffa6/output/x86_64-linux-gnu/bitcoin-58a9601dffa6-x86_64-linux-gnu-debug.tar.gz
  471e12b8715ecff4d99121c4bb3288ef4b005ca468810a714c67ea3e7c6669e9  guix-build-58a9601dffa6/output/x86_64-linux-gnu/bitcoin-58a9601dffa6-x86_64-linux-gnu.tar.gz
  d63946401952d131fdf5df9442c52151d86e53f019234b5ad16fdef0d2976356  guix-build-58a9601dffa6/output/x86_64-w64-mingw32/SHA256SUMS.part
  5359782e1eb6f449338f18e053ad82f25382d968690208ae5739d9338eb7bdc7  guix-build-58a9601dffa6/output/x86_64-w64-mingw32/bitcoin-58a9601dffa6-win64-debug.zip
  0d387d5a4cb1d712556a3fe5b4bd1e928bb5fbbe57a85ee06c746f132a6b1ec5  guix-build-58a9601dffa6/output/x86_64-w64-mingw32/bitcoin-58a9601dffa6-win64-setup-unsigned.exe
  dbfd7419d1d764e853a9dc041e276669b488aea4a80e21e4a175b6c3e512e70c  guix-build-58a9601dffa6/output/x86_64-w64-mingw32/bitcoin-58a9601dffa6-win64-unsigned.tar.gz
  0ba07504d9d5a12af9144e8b386b2640b48dba067d47c694a44ecffe56b0c0fc  guix-build-58a9601dffa6/output/x86_64-w64-mingw32/bitcoin-58a9601dffa6-win64.zip
  ```

ACKs for top commit:
  laanwj:
    Code review ACK 58a9601dff

Tree-SHA512: d1c22b3d0d21ef8f9f605ef6ca06353e3f48536d84f3531f93d613a6ccbbe62f12fae0ed09e8b9a8940b0ef33f9d41d9991eb56fbe7c4ab48f0ce7fcf44e08b1
2022-06-21 12:42:05 +02:00
Hennadii Stepanov
18d9189cc9
Merge bitcoin-core/gui#612: refactor: Drop unused QFrames in SendCoinsEntry
7ab72b9d2a qt: Fix `BitcoinAmountField`'s base widget (Hennadii Stepanov)
3262542104 qt, refactor: Fix `sendcoinsentry.ui` indentation (Hennadii Stepanov)
f3c7603329 qt, refactor: Convert `SendCoinsEntry` to a sub-`QWidget` (Hennadii Stepanov)
6420fb2005 qt, refactor: Drop unused `QFrame`s in `SendCoinsEntry` (Hennadii Stepanov)

Pull request description:

  The `SendCoins_UnauthenticatedPaymentRequest` and `SendCoins_AuthenticatedPaymentRequest` sub-`QFrame`'s of the `SendCoinsEntry` widget have been unused since bitcoin/bitcoin#17165.

  Removed all dead code. The resulted `SendCoinsEntry` widget has been simplified.

ACKs for top commit:
  w0xlt:
    Tested ACK 7ab72b9d2a
  shaavan:
    reACK 7ab72b9d2a

Tree-SHA512: a46db90d60fae584b52cc7edae910c295351cb3627e04d225708c50c04f7fdd81d2755e055115612a12a3c841e78c31bdcd57bed9feb1d3909f7a2f6e76bd356
2022-06-21 12:17:30 +02:00
Hennadii Stepanov
09a76e43fd
Merge bitcoin-core/gui#615: If -prune=0 is set, Uncheck Prune on Intro page
40566e21c0 If -prune=0 is set, Uncheck Prune on Intro page (Jadi)

Pull request description:

  If the bitcoin-qt is started with -prune=0 arg, On the Intro page,
  the Prune Checkbox will be unchecked too, to prevent confusions.

  refs: https://github.com/bitcoin/bitcoin/issues/25052

ACKs for top commit:
  hebasto:
    re-ACK 40566e21c0

Tree-SHA512: d5e0b76a7d20ae806e61a416fd907650f15a744a5823d0f8b57a634cb099bb135199e69a787bd54ecde2cf84e95633f40ff407a722350f337b27de395a6e0f78
2022-06-21 01:22:33 +02:00
laanwj
bc28ca3afb
Merge bitcoin/bitcoin#25118: wallet: unify “allow/block other inputs“ concept
d338712886 scripted-diff: rename fAllowOtherInputs -> m_allow_other_inputs (furszy)
8dea74a8ff refactor: use GetWalletTx in SelectCoins instead of access mapWallet (furszy)
b4e2d4d4ee wallet: move "use-only coinControl inputs" below the selected inputs lookup (furszy)
25749f1df7 wallet: unify “allow/block other inputs“ concept (furszy)

Pull request description:

  Seeking to make the `CoinControl` options less confusing/redundant.
  It should have no functional changes.

  The too long to read technical description; remove `m_add_inputs`, we can use the already existent `fAllowOtherInputs` flag.

  In #16377 the `CoinControl` flag ‘m_add_inputs’ was added to tell the coin filtering and selection process two things:
  - Coin Filtering: Only use the provided inputs. Skip the Rest.
  - Coin Selection: Search the wtxs-outputs and append all the `CoinControl` internal and external selected outpoints to the selection result (skipping all the available output checks). Nothing else.

  Meanwhile, in `CoinControl` we already have a flag ‘fAllowOtherInputs’ which is already saying:
  - Coin Filtering: Only use the provided inputs. Skip the Rest.
  - Coin Selection: If false, no selection process -> append all the `CoinControl` selected outpoints to the selection result (while they passed all the `AvailableCoins` checks and are available in the 'vCoins' vector).

  ### Changes

  As can notice, the first point in the coin filtering process is duplicated in the two option flags. And the second one, is slightly different merely because it takes into account whether the coin is on the `AvailableCoins` vector or not.
  So it makes sense to merge ‘m_add_inputs’ and ‘fAllowOtherInputs’ into a single field for the coin filtering process while introduce other changes to add the missing/skipped internal and external coins into 'vCoins' vector if they were manually selected by the user.

  ——————————————————————————————————

  Just as an extra note:
  On top of this, I’m working on unifying/untangling further the coin filtering and selection processes so we have less duplicate functionality in both processes.

ACKs for top commit:
  laanwj:
    Code review ACK d338712886

Tree-SHA512: 98920b80dd787cfe737dacd4c59575dfa8393c799b55f2aaef9aed2b15c61470715a88663557b49c7400938220f99af7690be01980a8684f4f71947407f21750
2022-06-20 21:37:55 +02:00
furszy
32e5edc0f4
wallet: avoid extra wtx lookup in AddToSpends
This method is only called from AddToWallet and LoadToWallet,
places where we already have the wtx.
2022-06-20 14:21:57 -03:00
Vasil Dimov
e8ff3f0c52
net: remove CloseSocket()
Do the closing in `Sock::Reset()` and remove the standalone
`CloseSocket()`.

This reduces the exposure of low-level sockets (i.e. integer file
descriptors) outside of the `Sock` class.
2022-06-20 16:38:31 +02:00
Vasil Dimov
175fb2670a
net: remove now unused Sock::Release() 2022-06-20 15:01:28 +02:00
Vasil Dimov
a8d6abba5e
net: change GetBindAddress() to take Sock argument
This avoids the direct call to `getsockname()` and allows mocking.
2022-06-20 14:51:48 +02:00
Vasil Dimov
748dbcd9f2
net: add new method Sock::GetSockName() that wraps getsockname()
This will help to increase `Sock` usage and make more code mockable.
2022-06-20 14:51:18 +02:00
fanquake
58a9601dff
build: globally define NOMINMAX
Define (and document) `NOMINMAX` once, rather than across multiple
source files.

Defining this prevents the definition of min/max macros when using
mingw-w64, which may conflict with unprefixed std::min/max usage. While
that might not be the case for us, we'd always prefer to use the standard
library in any case.

For example:
73cadc06c6/mingw-w64-headers/include/ntdef.h (L289-L300)
2022-06-20 12:22:05 +01:00
fanquake
0d8e68d705
refactor: move DEFAULT_*_LIMIT assertions from validation to policy 2022-06-20 10:24:15 +01:00
fanquake
9c94f3b3a7
refactor: move EXTRA_DESCENDANT_TX_SIZE_LIMIT to policy/policy.h 2022-06-20 10:02:59 +01:00
fanquake
39c6036253
refactor: use braced initialization in policy/policy.h 2022-06-20 10:02:59 +01:00
fanquake
01ccfbe3aa
scripted-diff: use static constexpr in policy/policy.h
-BEGIN VERIFY SCRIPT-

sed -i -e "s/static const /static constexpr /" src/policy/policy.h

-END VERIFY SCRIPT-
2022-06-20 10:02:59 +01:00
fanquake
62d56bb714
refactor: Move DEFAULT_DESCENDANT_SIZE_LIMIT to policy/policy.h 2022-06-20 10:02:58 +01:00
fanquake
a34aa4c187
refactor: Move DEFAULT_DESCENDANT_LIMIT to policy/policy.h 2022-06-20 10:02:58 +01:00
fanquake
05fc5fdc13
refactor: Move DEFAULT_ANCESTOR_SIZE_LIMIT to policy/policy.h 2022-06-20 10:02:58 +01:00
CAnon
da8d304960
refactor: Move DEFAULT_ANCESTOR_LIMIT to policy/policy.h 2022-06-20 10:02:58 +01:00
furszy
d338712886
scripted-diff: rename fAllowOtherInputs -> m_allow_other_inputs
-BEGIN VERIFY SCRIPT-
sed -i 's/fAllowOtherInputs/m_allow_other_inputs/g' -- $(git grep --files-with-matches 'fAllowOtherInputs')
-END VERIFY SCRIPT-
2022-06-19 20:32:51 -03:00
furszy
8dea74a8ff
refactor: use GetWalletTx in SelectCoins instead of access mapWallet 2022-06-19 20:32:51 -03:00
furszy
b4e2d4d4ee
wallet: move "use-only coinControl inputs" below the selected inputs lookup
Otherwise, RPC commands such as `walletcreatefundedpsbt` will not support the manual selection of locked, spent and externally added coins.

Full explanation is inside #25118 comments but brief summary is:

`vCoins` at `SelectCoins` time could not be containing the manually selected input because, even when they were selected by the user, the current `AvailableCoins` flow skips locked and spent coins.

Extra note: this is an intermediate step to unify the `fAllowOtherInputs`/`m_add_inputs` concepts. It will not be a problem anymore in the future when we finally decouple the wtx-outputs lookup process from `SelectCoins` and don't skip the user's manually selected coins in `AvailableCoins`.
2022-06-19 20:32:51 -03:00
furszy
25749f1df7
wallet: unify “allow/block other inputs“ concept
Seeking to make the `CoinControl` option less confusing/redundant.

In #16377 the `CoinControl` flag ‘m_add_inputs’ was added to tell the coin filtering and selection process two things:
	- Coin Filtering: Only use the provided inputs. Skip the Rest.
	- Coin Selection: Search the wtxs-outputs and append all the `CoinControl` selected outpoints to the selection result (skipping all the available output checks). Nothing else.

Meanwhile, in `CoinControl` we already have a flag ‘fAllowOtherInputs’ which is already saying:
	- Coin Filtering: Only use the provided inputs. Skip the Rest.
	- Coin Selection: If false, no selection process -> append all the `CoinControl` selected outpoints to the selection result (while they passed all the `AvailableCoins` checks and are available in the 'vCoins' vector).

As can notice, the first point in the coin filtering process is duplicated in the two option flags. And the second one, is slightly different merely because it takes into account whether the coin is on the `AvailableCoins` vector or not.
So it makes sense to merge ‘m_add_inputs’ and ‘fAllowOtherInputs’ into a single field for the coin filtering process while introduce other changes to add the missing/skipped coins into 'vCoins' vector if they were manually selected by the user (follow-up commits).
2022-06-19 20:02:35 -03:00
furszy
7ca8726f63
wallet: fix warning: "argument name 'feerate' in comment does not match parameter name"
Happened because the "feerate=" comment was after the comma.
2022-06-18 12:45:27 -03:00
Andrew Chow
8be652e439
Merge bitcoin/bitcoin#25005: wallet: remove extra wtx lookup in 'AvailableCoins' + several code cleanups.
fd5c996d16 wallet: GetAvailableBalance, remove double walk-through every available coin (furszy)
162d4ad10f wallet: add 'only_spendable' filter to AvailableCoins (furszy)
cdf185ccfb wallet: remove unused IsSpentKey(hash, index) method (furszy)
4b83bf8dbc wallet: avoid extra IsSpentKey -> GetWalletTx lookups (furszy)
3d8a282257 wallet: decouple IsSpentKey(scriptPubKey) from IsSpentKey(hash, n) (furszy)
a06fa94ff8 wallet: IsSpent, 'COutPoint' arg instead of (hash, index) (furszy)
91902b7720 wallet: IsLockedCoin, 'COutPoint' arg instead of (hash, index) (furszy)
9472ca0a65 wallet: AvailableCoins, don't call 'wtx.tx->vout[i]' multiple times (furszy)
4ce235ef8f wallet: return 'CoinsResult' struct in `AvailableCoins` (furszy)

Pull request description:

  This started in #24845 but grew out of scope of it.

  So, points tackled:

  1) Avoid extra `GetWalletTx` lookups inside `AvailableCoins -> IsSpentKey`.
      `IsSpentKey` was receiving the tx hash and index to internally lookup the tx inside the wallet's map. As all the `IsSpentKey` function callers already have the wtx available, them can provide the `scriptPubKey` directly.

  2) Most of the time, we call `Wallet::AvailableCoins`, and later on the process, skip the non-spendable coins from the result in subsequent for-loops. So to speedup the process: introduced the ability to filter by "only_spendable" coins inside `Wallet::AvailableCoins` directly.
  (the non-spendable coins skip examples are inside `AttemptSelection->GroupOutputs` and `GetAvailableBalance`).

  4) Refactored `AvailableCoins` in several ways:

     a) Now it will return a new struct `CoinsResult` instead of receiving the vCoins vector reference (which was being cleared at the beginning of the method anyway). --> this is coming from #24845 but cherry-picked it here too to make the following commits look nicer.

     b) Unified all the 'wtx.tx->vout[I]' calls into a single call (coming from this comment https://github.com/bitcoin/bitcoin/pull/24699#discussion_r854163032).

  5) The wallet `IsLockedCoin` and `IsSpent` methods now accept an `OutPoint` instead of a hash:index. Which let me cleanup a bunch of extra code.

  6) Speeded up the wallet 'GetAvailableBalance': filtering `AvailableCoins` by spendable outputs only and using the 'AvailableCoins' retrieved `total_amount` instead of looping over all the retrieved coins once more.

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

  Side topic, all this process will look even nicer with #25218

ACKs for top commit:
  achow101:
    ACK fd5c996d16
  brunoerg:
    crACK fd5c996d16
  w0xlt:
    Code Review ACK fd5c996d16

Tree-SHA512: 376a85476f907f4f7d1fc3de74b3dbe159b8cc24687374d8739711ad202ea07a33e86f4e66dece836da3ae6985147119fe584f6e672f11d0450ba6bd165b3220
2022-06-17 18:02:33 -04:00
Martin Zumsande
e357c89538 p2p, doc: Use MAX_BLOCKS_TO_ANNOUNCE consistently
It is an inclusive upper bound according to its definition.
2022-06-17 16:16:31 -04:00
laanwj
1b0469199b
Merge bitcoin/bitcoin#25281: build: Remove unused LIBBITCOIN_KERNEL variable
ce1c8104aa build: Remove unused `LIBBITCOIN_KERNEL` variable (Hennadii Stepanov)

Pull request description:

  Noticed that while working on moving the build system to CMake. But I [am not the first](https://github.com/bitcoin/bitcoin/pull/24322/files#r860472867) one :)

ACKs for top commit:
  laanwj:
    ACK ce1c8104aa

Tree-SHA512: 877b9f0d64c4c72f403335d7a8462e551f6f8cd5648a211f980d6da5ed7683521d6549f6acf15ac8e55f67915c556201a1980228c975a22135507746e2f392ce
2022-06-17 22:04:38 +02:00
laanwj
015717e2b8
Merge bitcoin/bitcoin#25299: doc: Correct comments re. units of constants
241c4d047e doc: Correct comment describing value of MAX_FILE_SIZE_PSBT as in MiB (Ben Woosley)
64f81a38b9 doc: Correct nPruneTarget misidentifying units of variable (darosior)

Pull request description:

  In https://github.com/bitcoin/bitcoin/pull/15848, darosior fixed up a comment which mis-identified the units of a constant.

  Another comment misidentified a value as in MiB rather than MB.

ACKs for top commit:
  laanwj:
    Code review ACK 241c4d047e
  darosior:
    ACK 241c4d047e, with or without https://github.com/bitcoin/bitcoin/pull/25299#discussion_r892705277

Tree-SHA512: 96c03a35140e5c53759f387bd292a8f8f621ba74c3cf6621939fad40f48892d23141c747ad3ab4fd71108e3b737670175abc2eb3990a1bd1660366c55d61ddf8
2022-06-17 21:47:33 +02:00
furszy
c318211ddd
walletdb: fix last client version update
The value was only being updated launching releases with higher version numbers
and not if the user launched a previous release.

Co-authored-by: MacroFake <falke.marco@gmail.com>
2022-06-16 15:33:30 -03:00
Andrew Chow
b0c8306349
Merge bitcoin/bitcoin#24649: wallet: do not count wallet utxos as external
7832e9438f test: fundrawtransaction preset input weight calculation (S3RK)
c3981e379f wallet: do not count wallet utxos as external (S3RK)

Pull request description:

  Correctly differentiating between external vs non-external utxos in coin control produces more accurate weight and fee estimations.

  Weight for external utxos is estimated based on the maximum signature size, while for the wallet utxos we expect minimal signature due to signature grinding.

ACKs for top commit:
  achow101:
    re-ACK 7832e9438f
  Xekyo:
    re-ACK 7832e9438f
  furszy:
    ACK 7832e943

Tree-SHA512: bb5635b0bd85fa9a76922a53ad3fa062286424c06a695a0e87407c665713e80a33555b644fbb13bcc1ab503dcd7f53aacbdc368d69ac0ecff8005603623ac94f
2022-06-16 14:11:19 -04:00
laanwj
0ea92cad52
Merge bitcoin/bitcoin#24356: refactor: replace CConnman::SocketEvents() with mockable Sock::WaitMany()
6e68ccbefe net: use Sock::WaitMany() instead of CConnman::SocketEvents() (Vasil Dimov)
ae263460ba net: introduce Sock::WaitMany() (Vasil Dimov)
cc74459768 net: also wait for exceptional events in Sock::Wait() (Vasil Dimov)

Pull request description:

  _This is a piece of #21878, chopped off to ease review._

  `Sock::Wait()` waits for IO events on one socket. Introduce a similar `virtual` method `WaitMany()` that waits simultaneously for IO events on more than one socket.

  Use `WaitMany()` instead of `CConnman::SocketEvents()` (and ditch the latter). Given that the former is a `virtual` method, it can be mocked by unit and fuzz tests. This will help to make bigger parts of `CConnman` testable (unit and fuzz).

ACKs for top commit:
  laanwj:
    Code review ACK 6e68ccbefe
  jonatack:
    re-ACK 6e68ccbefe per `git range-diff e18fd47 6747729 6e68ccb`, and verified rebase to master and debug build

Tree-SHA512: 917fb6ad880d64d3af1ebb301c06fbd01afd8ff043f49e4055a088ebed6affb7ffe1dcf59292d822f10de5f323b6d52d557cb081dd7434634995f9148efcf08f
2022-06-16 20:05:03 +02:00
laanwj
489b587669
Merge bitcoin/bitcoin#25215: [kernel 2d/n] Reduce CTxMemPool constructor call sites
d273e53b6e bench/rpc_mempool: Create ChainTestingSetup, use its CTxMemPool (Carl Dong)
020caba3df bench: Use existing CTxMemPool in TestingSetup (Carl Dong)
86e732def3 scripted-diff: test: Use CTxMemPool in TestingSetup (Carl Dong)
213457e170 test/policyestimator: Use ChainTestingSetup's CTxMemPool (Carl Dong)
319f0ceeeb rest/getutxos: Don't construct empty mempool (Carl Dong)
03574b956a tree-wide: clang-format CTxMemPool references (Carl Dong)

Pull request description:

  This is part of the `libbitcoinkernel` project: #24303, https://github.com/bitcoin/bitcoin/projects/18

  This PR reduces the number of call sites where we explicitly construct CTxMemPool. This is done in preparation for later PRs which decouple the mempool module from `ArgsManager`, eventually all of libbitcoinkernel will be decoupled from `ArgsManager`.

  The changes in this PR:

  - Allows us to have less code churn as we modify `CTxMemPool`'s constructor in later PRs
  - In many cases, we can make use of existing `CTxMemPool` instances, getting rid of extraneous constructions
  - In other cases, we construct a `ChainTestingSetup` and use the `CTxMemPool` there, so that we can rely on the logic in `setup_common` to set things up correctly

  ## Notes for Reviewers

  ### A note on using existing mempools

  When evaluating whether or not it's appropriate to use an existing mempool in a `*TestingSetup` struct, the key is to make sure that the mempool has the same lifetime as the `*TestingSetup` struct.

  Example 1: In [`src/fuzz/tx_pool.cpp`](b4f686952a/src/test/fuzz/tx_pool.cpp), the `TestingSetup` is initialized in `initialize_tx_pool` and lives as a static global, while the `CTxMemPool` is in the `tx_pool_standard` fuzz target, meaning that each time the `tx_pool_standard` fuzz target gets run, a new `CTxMemPool` is created. If we were to use the static global `TestingSetup`'s CTxMemPool we might run into problems since its `CTxMemPool` will carry state between subsequent runs. This is why we don't modify `src/fuzz/tx_pool.cpp` in this PR.

  Example 2: In [`src/bench/mempool_eviction.cpp`](b4f686952a/src/bench/mempool_eviction.cpp), we see that the `TestingSetup` is in the same scope as the constructed `CTxMemPool`, so it is safe to use its `CTxMemPool`.

  ### A note on checking `CTxMemPool` ctor call sites

  After the "tree-wide: clang-format CTxMemPool references" commit, you can find all `CTxMemPool` ctor call sites with the following command:

  ```sh
  git grep -E -e 'make_unique<CTxMemPool>' \
              -e '\bCTxMemPool\s+[^({;]+[({]' \
              -e '\bCTxMemPool\s+[^;]+;' \
              -e '\bnew\s+CTxMemPool\b'
  ```

  At the end of the PR, you will find that there are still quite a few call sites that we can seemingly get rid of:

  ```sh
  $ git grep -E -e 'make_unique<CTxMemPool>' -e '\bCTxMemPool\s+[^({;]+[({]' -e '\bCTxMemPool\s+[^;]+;' -e '\bnew\s+CTxMemPool\b'
  # rearranged for easier explication
  src/init.cpp:        node.mempool = std::make_unique<CTxMemPool>(node.fee_estimator.get(), mempool_check_ratio);
  src/test/util/setup_common.cpp:    m_node.mempool = std::make_unique<CTxMemPool>(m_node.fee_estimator.get(), 1);
  src/rpc/mining.cpp:        CTxMemPool empty_mempool;
  src/test/util/setup_common.cpp:    CTxMemPool empty_pool;
  src/bench/mempool_stress.cpp:    CTxMemPool pool;
  src/bench/mempool_stress.cpp:    CTxMemPool pool;
  src/test/fuzz/rbf.cpp:    CTxMemPool pool;
  src/test/fuzz/tx_pool.cpp:    CTxMemPool tx_pool_{/*estimator=*/nullptr, /*check_ratio=*/1};
  src/test/fuzz/tx_pool.cpp:    CTxMemPool tx_pool_{/*estimator=*/nullptr, /*check_ratio=*/1};
  src/test/fuzz/validation_load_mempool.cpp:    CTxMemPool pool{};
  src/txmempool.h:    /** Create a new CTxMemPool.
  ```
  Let's break them down one by one:

  ```
  src/init.cpp:        node.mempool = std::make_unique<CTxMemPool>(node.fee_estimator.get(), mempool_check_ratio);
  src/test/util/setup_common.cpp:    m_node.mempool = std::make_unique<CTxMemPool>(m_node.fee_estimator.get(), 1);
  ```

  Necessary

  -----

  ```
  src/rpc/mining.cpp:        CTxMemPool empty_mempool;
  src/test/util/setup_common.cpp:    CTxMemPool empty_pool;
  ```

  These are fixed in #25223 where we stop requiring the `BlockAssembler` to have a `CTxMemPool` if it's not going to consult it anyway (as is the case in these two call sites)

  -----

  ```
  src/bench/mempool_stress.cpp:    CTxMemPool pool;
  src/bench/mempool_stress.cpp:    CTxMemPool pool;
  ```

  Fixed in #24927.

  -----

  ```
  src/test/fuzz/rbf.cpp:    CTxMemPool pool;
  src/test/fuzz/tx_pool.cpp:    CTxMemPool tx_pool_{/*estimator=*/nullptr, /*check_ratio=*/1};
  src/test/fuzz/tx_pool.cpp:    CTxMemPool tx_pool_{/*estimator=*/nullptr, /*check_ratio=*/1};
  src/test/fuzz/validation_load_mempool.cpp:    CTxMemPool pool{};
  ```

  These are all cases where we don't want the `CTxMemPool` state to persist between runs, see the previous section "A note on using existing mempools"

  -----

  ```
  src/txmempool.h:    /** Create a new CTxMemPool.
  ```

  It's a comment (someone link me to a grep that understands syntax plz thx)

ACKs for top commit:
  laanwj:
    Code review ACK d273e53b6e

Tree-SHA512: c4ff3d23217a7cc4a7145defc7b901725073ef73bcac3a252ed75f672c87e98ca0368d1d8c3f606b5b49f641e7d8387d26ef802141b650b215876f191fb6d5f9
2022-06-16 19:49:34 +02:00
furszy
bda8ebe608
wallet: don't read db every time that a new WalletBatch is created
Better to perform the action only one time (during 'LoadWallet').
Where the value is being used.
2022-06-16 12:18:58 -03:00
MacroFake
8035b5c80d
Merge bitcoin/bitcoin#25369: Unsubtree Univalue
d873ff96e5 refactor: cleanups post unsubtree'ing univalue (fanquake)
e2aa7047f9 refactor: un-subtree univalue (fanquake)

Pull request description:

  At this point, maintaining Univalue as a subtree doesn’t serve much purpose, other than being an inconvenience for making changes to the code (along with polluting our repo with a number of files we don’t use). Our [Univalue fork](https://github.com/bitcoin-core/univalue-subtree) currently deviates from the [upstream API](https://github.com/jgarzik/univalue), and for some time has been marked as not-maintained for use by other projects (I'm not aware of any that use it). The upstream Univalue is not maintained, and has not been for some time. There are no new releases, bugs remain unfixed, and PR's we've upstreamed, https://github.com/jgarzik/univalue/pulls, are not being commented on/merged.

  Another substantial benefit of no-longer maintaining a subtree is removing the rather awkward work-flow currently required to make changes to the Univalue code, particularly breaking changes / introducing new features, e.g. https://github.com/bitcoin-core/univalue-subtree/pull/27. We need to dance around and merge changes to our fork, with a flag, then pull them down here, then switch to using the new code, then go back to our Univalue repo, and remove the old code / flag, then pull the repo down here again, and remove our usage of the flag. Quite the overcomplicated mess.

  With this PR I'm proposing we stop treating Univalue like a subtree, or upstream project/fork, and going forward, treat it as part of this codebase, which we can refactor directly (with pulls to this repo. Ideally, after this is merged, our univalue subtree repo could be marked as "archived". In this repo, I think there is a good chance that the Univalue code will ultimately be refactored away into "modern" C++, i.e using `std::variant` (at least one person has played around with doing this).

  Univalue history:
  - Subtree first introduced: https://github.com/bitcoin/bitcoin/pull/6637
  - `--system-univalue` option introduced: https://github.com/bitcoin/bitcoin/pull/7349
    Suggestion was to use system Univalue by default.
    This was pushed back on by contributors, as well as the [upstream Univalue](https://github.com/jgarzik/univalue) maintainer (jgarzik).
  - Our fork's README was updated to say `It is not maintained for usage by other projects. Notably, the API may break in non-backward-compatible ways.` : https://github.com/bitcoin-core/univalue-subtree/pull/17
  - Our fork README additionally updated to say `the API is broken in non-backward-compatible ways.` : https://github.com/bitcoin-core/univalue-subtree/pull/30
  - `--system-univalue` option removed: https://github.com/bitcoin/bitcoin/pull/22646
  - Univalue "subtree" removed: This PR.

  Guix Build (x86_64):
  ```bash
  06748985a9a386457d10a411b5afe1d59536e5653ec9c5bc8ac8410cd715d073  guix-build-d873ff96e51a/output/aarch64-linux-gnu/SHA256SUMS.part
  57d81891f6d4ae417dd3bcbfc90839600e103da9c7d7b09dbebb82f0119241f3  guix-build-d873ff96e51a/output/aarch64-linux-gnu/bitcoin-d873ff96e51a-aarch64-linux-gnu-debug.tar.gz
  7bb70d3b67253f5e8e5af8158bbf1b4b3e25e782f951d3defb7976534ae67d62  guix-build-d873ff96e51a/output/aarch64-linux-gnu/bitcoin-d873ff96e51a-aarch64-linux-gnu.tar.gz
  b1acb90877d6e3b8d4bd2d57103889e0474263e4153f302eba8cb304fd1aecd7  guix-build-d873ff96e51a/output/arm-linux-gnueabihf/SHA256SUMS.part
  91f9f65aebc131522cae5b523359c62e402a2c929670e1cca19d6a2760d29e04  guix-build-d873ff96e51a/output/arm-linux-gnueabihf/bitcoin-d873ff96e51a-arm-linux-gnueabihf-debug.tar.gz
  1fc3ed39bfc95592503b8dd11f468240deca4fb757f9adb08a0f07f5c0690837  guix-build-d873ff96e51a/output/arm-linux-gnueabihf/bitcoin-d873ff96e51a-arm-linux-gnueabihf.tar.gz
  a5cf5bd0ee0de92fb03f6bca91cfa6667ed77885112e71dd92a82bbd8670141e  guix-build-d873ff96e51a/output/arm64-apple-darwin/SHA256SUMS.part
  f6715399cebb5ac0a09f190fe805146c13d1e8eba57401541d0628da3badc588  guix-build-d873ff96e51a/output/arm64-apple-darwin/bitcoin-d873ff96e51a-arm64-apple-darwin-unsigned.dmg
  07cf82cab4e459ed4e862fc3a2903e49ac750adc6b6fe0534ec165f00e666230  guix-build-d873ff96e51a/output/arm64-apple-darwin/bitcoin-d873ff96e51a-arm64-apple-darwin-unsigned.tar.gz
  81bc076aa415183109e2848fa3cc0265b34f6af3e75b76bcbc6cff524db76a0f  guix-build-d873ff96e51a/output/arm64-apple-darwin/bitcoin-d873ff96e51a-arm64-apple-darwin.tar.gz
  8751b05a3395d668e31217c92cbce9c131aa3566b3784a7e3544adf34fc89fe8  guix-build-d873ff96e51a/output/dist-archive/bitcoin-d873ff96e51a.tar.gz
  526b7780a16a3de3c6006606d3d7a8c2ca565ef28669e2f6f303349a252e4977  guix-build-d873ff96e51a/output/powerpc64-linux-gnu/SHA256SUMS.part
  ff917a50d2b20d41a5954e1ba1e8fb39498a9c8867828483af3f501573148ede  guix-build-d873ff96e51a/output/powerpc64-linux-gnu/bitcoin-d873ff96e51a-powerpc64-linux-gnu-debug.tar.gz
  0311455c821ad392013fc3999a2b2d027fdb5c28e7eb6c3fea9cec29f3730d2d  guix-build-d873ff96e51a/output/powerpc64-linux-gnu/bitcoin-d873ff96e51a-powerpc64-linux-gnu.tar.gz
  983c2553990eb7cebb26e1a0a3e5a9308259dea60d0b64ab6782892d02a7abc1  guix-build-d873ff96e51a/output/powerpc64le-linux-gnu/SHA256SUMS.part
  aba604827d969348671ec3f36dbf37469292715d3f756a7f44a0a5243dbe02f3  guix-build-d873ff96e51a/output/powerpc64le-linux-gnu/bitcoin-d873ff96e51a-powerpc64le-linux-gnu-debug.tar.gz
  e450bd82020d5086f3bb0a23181263315cc05eaf6e5809d0a2115bff4e7ddb2e  guix-build-d873ff96e51a/output/powerpc64le-linux-gnu/bitcoin-d873ff96e51a-powerpc64le-linux-gnu.tar.gz
  476e8e2c80498b241af154abd9112bd2767110c0d6d7e9fa11761de716cb760f  guix-build-d873ff96e51a/output/riscv64-linux-gnu/SHA256SUMS.part
  a76435b3492efcd9af47ad652170605fad50691fd5aff2b46bce0bd08014879e  guix-build-d873ff96e51a/output/riscv64-linux-gnu/bitcoin-d873ff96e51a-riscv64-linux-gnu-debug.tar.gz
  83985d409cd90bf7120cf7902ee442595d28a1469b7c600b666ef901981e5190  guix-build-d873ff96e51a/output/riscv64-linux-gnu/bitcoin-d873ff96e51a-riscv64-linux-gnu.tar.gz
  61c89850244ddf5813ff80c242eff89925d30bccadfa5cb63e968c3af49eb964  guix-build-d873ff96e51a/output/x86_64-apple-darwin/SHA256SUMS.part
  cd219fab8918b061a342357d298aca0c044feb34c6d50a7851d5d3bf18cec267  guix-build-d873ff96e51a/output/x86_64-apple-darwin/bitcoin-d873ff96e51a-x86_64-apple-darwin-unsigned.dmg
  1170d3fdb199fbfca2c20b2a77cc81a6fe24b7e4973543a4461e887f14ac68e9  guix-build-d873ff96e51a/output/x86_64-apple-darwin/bitcoin-d873ff96e51a-x86_64-apple-darwin-unsigned.tar.gz
  71e93297ed8c581a7ed32a6948ef7b1ea2e7c43cb054181de3b5f604f7a2c28b  guix-build-d873ff96e51a/output/x86_64-apple-darwin/bitcoin-d873ff96e51a-x86_64-apple-darwin.tar.gz
  fc8b7b670de9d175775e73df47dc855581c873a9be4adf1d81a4dbb2831d5348  guix-build-d873ff96e51a/output/x86_64-linux-gnu/SHA256SUMS.part
  5703b02c2647f9997aa5ca12514d6a54b1eb2e29046223ca062383326b95894f  guix-build-d873ff96e51a/output/x86_64-linux-gnu/bitcoin-d873ff96e51a-x86_64-linux-gnu-debug.tar.gz
  bab4b932b83476cf6fc2e0b5bf0d2203287f7fd0d1a968e325f2edd5b1d8415b  guix-build-d873ff96e51a/output/x86_64-linux-gnu/bitcoin-d873ff96e51a-x86_64-linux-gnu.tar.gz
  5d180b0415fa8e825d46928c168cb1ae6e27016841b2ff8e190bf13879a5545c  guix-build-d873ff96e51a/output/x86_64-w64-mingw32/SHA256SUMS.part
  d469695a32f6414b25fef7b5fdfda4d854071450ba25148a1dce468114fa9057  guix-build-d873ff96e51a/output/x86_64-w64-mingw32/bitcoin-d873ff96e51a-win64-debug.zip
  2e7d4e533a5998863c115c586c61b75b4039cd329e12ed24cff78b7f16b6ea57  guix-build-d873ff96e51a/output/x86_64-w64-mingw32/bitcoin-d873ff96e51a-win64-setup-unsigned.exe
  3dabbd627b532beef57c3d4b5bd30c93c5ea74c492918484cf24685aca8d7bc4  guix-build-d873ff96e51a/output/x86_64-w64-mingw32/bitcoin-d873ff96e51a-win64-unsigned.tar.gz
  3a40660fba08f7632efd1f73c198f8298db33eab6ef5eaca88b997d95fc31f29  guix-build-d873ff96e51a/output/x86_64-w64-mingw32/bitcoin-d873ff96e51a-win64.zip
  ```

  Guix Build (arm64):
  ```bash
  0e764679199358fc321dcfcb58c6302e6518f55b3fd27bdd47f2da2a826ba16a  guix-build-d873ff96e51a/output/arm-linux-gnueabihf/SHA256SUMS.part
  5955d28e6d56e5a3297dab723b8478f1b0bb7f5b86476c581339122f34cc7f14  guix-build-d873ff96e51a/output/arm-linux-gnueabihf/bitcoin-d873ff96e51a-arm-linux-gnueabihf-debug.tar.gz
  49c68bc0066f709be68f1e5731425d51fb3cb8062a24aa9fa599987165759cad  guix-build-d873ff96e51a/output/arm-linux-gnueabihf/bitcoin-d873ff96e51a-arm-linux-gnueabihf.tar.gz
  ca678d4eb27c9fa3c527211c0ccb145322a15f327545b5c82f1d1b8d3c310e5a  guix-build-d873ff96e51a/output/arm64-apple-darwin/SHA256SUMS.part
  38366d7fbd769b426f1097e966abe39f01a7ce743f6af1cd0f228b1801d3c87f  guix-build-d873ff96e51a/output/arm64-apple-darwin/bitcoin-d873ff96e51a-arm64-apple-darwin-unsigned.dmg
  0c05dc9c17f5d8237b3e003c2e4c715455c3868bd4cd014e2a15ceb152b27b9c  guix-build-d873ff96e51a/output/arm64-apple-darwin/bitcoin-d873ff96e51a-arm64-apple-darwin-unsigned.tar.gz
  32676e1f9f07f3f77143f8b6038c943da6ba93b081232ec52c2ff940f9f7cc88  guix-build-d873ff96e51a/output/arm64-apple-darwin/bitcoin-d873ff96e51a-arm64-apple-darwin.tar.gz
  8751b05a3395d668e31217c92cbce9c131aa3566b3784a7e3544adf34fc89fe8  guix-build-d873ff96e51a/output/dist-archive/bitcoin-d873ff96e51a.tar.gz
  bdae66515060cab0b362784f0b2019b77da0435f1732d3c91fabcfb5e8c675f6  guix-build-d873ff96e51a/output/powerpc64-linux-gnu/SHA256SUMS.part
  8d837391310b4cdec2296a6e78a9f9b3ea2b3da7870881a5cedf86a3429c08c6  guix-build-d873ff96e51a/output/powerpc64-linux-gnu/bitcoin-d873ff96e51a-powerpc64-linux-gnu-debug.tar.gz
  efe825d6f36338bd4c0b427901b72d666f819858fb241a4211f03bbb738f6961  guix-build-d873ff96e51a/output/powerpc64-linux-gnu/bitcoin-d873ff96e51a-powerpc64-linux-gnu.tar.gz
  7494cf8c5f384ca3205b3ed44dd4c0edebcb9e0a6bf9c8e649fc6d99cc5a10b2  guix-build-d873ff96e51a/output/powerpc64le-linux-gnu/SHA256SUMS.part
  8ceeb21d7fce9e164dbb47b35d0551b59819075fc44dcea39603132340f80c41  guix-build-d873ff96e51a/output/powerpc64le-linux-gnu/bitcoin-d873ff96e51a-powerpc64le-linux-gnu-debug.tar.gz
  bfbbb20dc4e7b30444a52f5f57b5789b5d1edee80abdc8066129b48c59ee65c9  guix-build-d873ff96e51a/output/powerpc64le-linux-gnu/bitcoin-d873ff96e51a-powerpc64le-linux-gnu.tar.gz
  65d578b81b00a1032039362dc6be1a71368f390188e0f948829afd03b8858ed2  guix-build-d873ff96e51a/output/riscv64-linux-gnu/SHA256SUMS.part
  e5233d7e7a8832893ff414c78eb3d4bca3ae30d1a1f789a23419c6739b203022  guix-build-d873ff96e51a/output/riscv64-linux-gnu/bitcoin-d873ff96e51a-riscv64-linux-gnu-debug.tar.gz
  fb6d9f5a063dc7752fcc2acc95a0052322d7c8c86d2c6373e0ceb949dcf22f49  guix-build-d873ff96e51a/output/riscv64-linux-gnu/bitcoin-d873ff96e51a-riscv64-linux-gnu.tar.gz
  61c89850244ddf5813ff80c242eff89925d30bccadfa5cb63e968c3af49eb964  guix-build-d873ff96e51a/output/x86_64-apple-darwin/SHA256SUMS.part
  cd219fab8918b061a342357d298aca0c044feb34c6d50a7851d5d3bf18cec267  guix-build-d873ff96e51a/output/x86_64-apple-darwin/bitcoin-d873ff96e51a-x86_64-apple-darwin-unsigned.dmg
  1170d3fdb199fbfca2c20b2a77cc81a6fe24b7e4973543a4461e887f14ac68e9  guix-build-d873ff96e51a/output/x86_64-apple-darwin/bitcoin-d873ff96e51a-x86_64-apple-darwin-unsigned.tar.gz
  71e93297ed8c581a7ed32a6948ef7b1ea2e7c43cb054181de3b5f604f7a2c28b  guix-build-d873ff96e51a/output/x86_64-apple-darwin/bitcoin-d873ff96e51a-x86_64-apple-darwin.tar.gz
  46e9b067ec385ee14642aebc5ec09d7d2382e0204eeb17dc64587013eddd5dff  guix-build-d873ff96e51a/output/x86_64-linux-gnu/SHA256SUMS.part
  23278b19daac51e7df65b817b79fc93562d0f4eb193ef87472456f4bed1464d7  guix-build-d873ff96e51a/output/x86_64-linux-gnu/bitcoin-d873ff96e51a-x86_64-linux-gnu-debug.tar.gz
  4d5e5e23f089a59185f62faf367d8ca86476e406e6b7bbc9e8950cd89d94534d  guix-build-d873ff96e51a/output/x86_64-linux-gnu/bitcoin-d873ff96e51a-x86_64-linux-gnu.tar.gz
  eec8ab97ee9aceef8cb4e7cb5026225ffc5c7b8e8a6d376e8348020000e5af88  guix-build-d873ff96e51a/output/x86_64-w64-mingw32/SHA256SUMS.part
  a31819e67c373f30eafce8dbcb3d6d0c61d1dcf59c51023aa79321934f8a7d2a  guix-build-d873ff96e51a/output/x86_64-w64-mingw32/bitcoin-d873ff96e51a-win64-debug.zip
  2e7d4e533a5998863c115c586c61b75b4039cd329e12ed24cff78b7f16b6ea57  guix-build-d873ff96e51a/output/x86_64-w64-mingw32/bitcoin-d873ff96e51a-win64-setup-unsigned.exe
  3dabbd627b532beef57c3d4b5bd30c93c5ea74c492918484cf24685aca8d7bc4  guix-build-d873ff96e51a/output/x86_64-w64-mingw32/bitcoin-d873ff96e51a-win64-unsigned.tar.gz
  ec438531b4694913dbbf7c91920dcbd957354b164f807867c16a001898edf669  guix-build-d873ff96e51a/output/x86_64-w64-mingw32/bitcoin-d873ff96e51a-win64.zip
  ```

ACKs for top commit:
  laanwj:
    Code review ACK d873ff96e5
  MarcoFalke:
    re-ACK d873ff96e5 only changes: 📼

Tree-SHA512: fc7d781e8cc0fc0a0080eb4b5019e91c55275e087149ed3b5abc6b691170b0ab76f1dd3ce9bb8846eef023897a89123e14751ce8facf2a170829858199904bff
2022-06-16 13:47:01 +02:00
Carl Dong
d273e53b6e bench/rpc_mempool: Create ChainTestingSetup, use its CTxMemPool
This is correct because:

- The ChainTestingSetup is constructed before the call to bench.run(...)
- All the runs are performed on the same mempool
2022-06-15 17:28:55 -04:00
Carl Dong
020caba3df bench: Use existing CTxMemPool in TestingSetup 2022-06-15 17:28:55 -04:00
Carl Dong
86e732def3 scripted-diff: test: Use CTxMemPool in TestingSetup
After this commit, there should be no explicit instantiation of
CTxMemPool in src/test other than those in fuzz/ and setup_common

-BEGIN VERIFY SCRIPT-
find_regex="CTxMemPool\s+([^;({]+)(|\(\)|\{\});" \
    && git grep -l -E "$find_regex" -- src/test \
        | grep -v -e "^src/test/util/setup_common.cpp$" \
                  -e "^src/test/fuzz/" \
        | xargs sed -i -E "s@$find_regex@CTxMemPool\& \1 = *Assert(m_node.mempool);@g"
-END VERIFY SCRIPT-
2022-06-15 17:28:55 -04:00
Carl Dong
213457e170 test/policyestimator: Use ChainTestingSetup's CTxMemPool 2022-06-15 17:28:55 -04:00
Carl Dong
319f0ceeeb rest/getutxos: Don't construct empty mempool
...just don't try to consult it at all when fCheckMemPool is false
2022-06-15 17:28:55 -04:00
Andrew Chow
51eebe082d
Merge bitcoin/bitcoin#25368: doc: Update importaddress mention incompatibility with descriptor wallet
e3609cdc01 doc: Update importaddress mention incompatibility with descriptor wallet (BrokenProgrammer)

Pull request description:

  This is related to #25363 and offers a small update to the error messages from `EnsureLegacyScriptPubKeyMan` and `EnsureConstLegacyScriptPubKeyMan` to mention that they only are compatible with legacy wallets.

  The RPC documentation for `importaddress` is also updated to mention this as well as guide the user to the alternative `importdescriptors` for cases when using descriptor wallets.

  I'm thinking that we can introduce a "porting guide" document mentioned in #25363 in a separate PR since I would have to make myself more familiar with the subject before being able to tackle that.

ACKs for top commit:
  laanwj:
    Code review ACK e3609cdc01
  achow101:
    ACK e3609cdc01

Tree-SHA512: c7a924a7283fe59dc4e04c8c8fa034c15601f0b25eff09d975e98e2e8db5268ff470336b2d978d6916af9f782f9257b840d64bd15485b1742b4a8b8bfd0bb50f
2022-06-15 13:40:32 -04:00
Jadi
40566e21c0 If -prune=0 is set, Uncheck Prune on Intro page
If the bitcoin-qt is started with -prune=0 arg, On the Intro page,
the Prune Checkbox will be unchecked too, to prevent confusions.

refs: https://github.com/bitcoin/bitcoin/issues/25052

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2022-06-15 12:24:08 -04:00
Hennadii Stepanov
26ec2f2d6b
Merge bitcoin-core/gui#618: refactor: Add transactionoverviewwidget.cpp source file
a50e0b1bcb qt, refactor: Add `transactionoverviewwidget.cpp` source file (Hennadii Stepanov)

Pull request description:

  The `TransactionOverviewWidget` class was added in bitcoin-core/gui#176 as a header-only one.

  Apparently, in upcoming [CMake project](https://github.com/hebasto/bitcoin/pull/3), CMake [AUTOMOC](https://cmake.org/cmake/help/latest/prop_tgt/AUTOMOC.html) could be integrated better/simpler, if `QObject`-derived class implementation been placed into a source file.

  From our [Developer Notes](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#source-code-organization):
  > Implementation code should go into the `.cpp` file and not the `.h`, unless necessary due to template usage or when performance due to inlining is critical.

ACKs for top commit:
  Sjors:
    tACK a50e0b1bcb
  shaavan:
    ACK a50e0b1bcb

Tree-SHA512: 4707b6be1c5e794c4014475f826ac45ec833e472db11f12d29995f9c5a599ee98622ad54f0af72734b192144b626411c69acdafa0e6d1a390bdebfd7e570f377
2022-06-15 18:08:51 +02:00
fanquake
a7a36590f5
Merge bitcoin/bitcoin#25223: [kernel 2e/n] miner: Make mempool optional, stop constructing temporary empty mempools
0f1a259657 miner: Make mempool optional for BlockAssembler (Carl Dong)
cc5739b27d miner: Make UpdatePackagesForAdded static (Carl Dong)
f024578b3a miner: Absorb SkipMapTxEntry into addPackageTxs (Carl Dong)

Pull request description:

  This is part of the libbitcoinkernel project: #24303, https://github.com/bitcoin/bitcoin/projects/18

  This is **_NOT_** dependent on, but is a "companion-PR" to #25215.

  ### Abstract

  This PR removes the need to construct `BlockAssembler` with temporary, empty mempools in cases where we don't want to source transactions from the mempool (e.g. in `TestChain100Setup::CreateBlock` and `generateblock`). After this PR, `BlockAssembler` will accept a `CTxMemPool` pointer and handle the `nullptr` case instead of requiring a `CTxMemPool` reference.

  An overview of the changes is best seen in the changes in the header file:

  ```diff
  diff --git a/src/node/miner.h b/src/node/miner.h
  index 7cf8e3fb9e..7e9f503602 100644
  --- a/src/node/miner.h
  +++ b/src/node/miner.h
  @@ -147,7 +147,7 @@ private:
       int64_t m_lock_time_cutoff;

       const CChainParams& chainparams;
  -    const CTxMemPool& m_mempool;
  +    const CTxMemPool* m_mempool;
       CChainState& m_chainstate;

   public:
  @@ -157,8 +157,8 @@ public:
           CFeeRate blockMinFeeRate;
       };

  -    explicit BlockAssembler(CChainState& chainstate, const CTxMemPool& mempool);
  -    explicit BlockAssembler(CChainState& chainstate, const CTxMemPool& mempool, const Options& options);
  +    explicit BlockAssembler(CChainState& chainstate, const CTxMemPool* mempool);
  +    explicit BlockAssembler(CChainState& chainstate, const CTxMemPool* mempool, const Options& options);

       /** Construct a new block template with coinbase to scriptPubKeyIn */
       std::unique_ptr<CBlockTemplate> CreateNewBlock(const CScript& scriptPubKeyIn);
  @@ -177,7 +177,7 @@ private:
       /** Add transactions based on feerate including unconfirmed ancestors
         * Increments nPackagesSelected / nDescendantsUpdated with corresponding
         * statistics from the package selection (for logging statistics). */
  -    void addPackageTxs(int& nPackagesSelected, int& nDescendantsUpdated) EXCLUSIVE_LOCKS_REQUIRED(m_mempool.cs);
  +    void addPackageTxs(const CTxMemPool& mempool, int& nPackagesSelected, int& nDescendantsUpdated) EXCLUSIVE_LOCKS_REQUIRED(mempool.cs);

       // helper functions for addPackageTxs()
       /** Remove confirmed (inBlock) entries from given set */
  @@ -189,15 +189,8 @@ private:
         * These checks should always succeed, and they're here
         * only as an extra check in case of suboptimal node configuration */
       bool TestPackageTransactions(const CTxMemPool::setEntries& package) const;
  -    /** Return true if given transaction from mapTx has already been evaluated,
  -      * or if the transaction's cached data in mapTx is incorrect. */
  -    bool SkipMapTxEntry(CTxMemPool::txiter it, indexed_modified_transaction_set& mapModifiedTx, CTxMemPool::setEntries& failedTx) EXCLUSIVE_LOCKS_REQUIRED(m_mempool.cs);
       /** Sort the package in an order that is valid to appear in a block */
       void SortForBlock(const CTxMemPool::setEntries& package, std::vector<CTxMemPool::txiter>& sortedEntries);
  -    /** Add descendants of given transactions to mapModifiedTx with ancestor
  -      * state updated assuming given transactions are inBlock. Returns number
  -      * of updated descendants. */
  -    int UpdatePackagesForAdded(const CTxMemPool::setEntries& alreadyAdded, indexed_modified_transaction_set& mapModifiedTx) EXCLUSIVE_LOCKS_REQUIRED(m_mempool.cs);
   };

   int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev);
  ```

  ### Alternatives

  Aside from approach in this current PR, we can also take the approach of moving the `CTxMemPool*` argument from the `BlockAssembler` constructor to `BlockAssembler::CreateNewBlock`, since that's where it's needed anyway. I did not push this approach because it requires quite a lot of call sites to be changed. However, I do have it coded up and can do that if people express a strong preference. This would look something like:

  ```
  BlockAssembler::BlockAssembler(CChainState& chainstate, const Options& options);
  BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, const CTxMemPool* maybe_mempool);
  ```

  ### Future work

  Although wholly out of scope for this PR, we could potentially refine the `BlockAssembler` interface further, so that we have:

  ```
  BlockAssembler::BlockAssembler(CChainState& chainstate, const Options& options);
  BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, std::vector<CTransaction>& txs);
  BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, const CTxMemPool& mempool);
  ```

  Whereby `TestChain100Setup::CreateBlock` and `generateblock` would call the `BlockAssembler::CreateNewBlock` that takes in `CTransaction`s and we can potentially remove `RegenerateCommitments` altogether. All other callers can use the `CTxMemPool` version.

ACKs for top commit:
  glozow:
    ACK 0f1a259657
  laanwj:
    Code review ACK 0f1a259657
  MarcoFalke:
    ACK 0f1a259657 🐊

Tree-SHA512: 2b4b1dbb43d85719f241ad1f19ceb7fc50cf764721da425a3d1ff71bd16328c4f86acff22e565bc9abee770d3ac8827a6676b66daa93dbf42dd817ad929e9448
2022-06-15 16:40:48 +01:00
fanquake
d873ff96e5
refactor: cleanups post unsubtree'ing univalue
Mostly changes to remove src/univalue exceptions from the various linters,
and the required code changes to make them happy. As well as minor doc
changes.
2022-06-15 12:56:44 +01:00
fanquake
e2aa7047f9
refactor: un-subtree univalue
Remove all the files we don't use.
This should not change behavior, or anything at all, as none of these
files are currently used in our build system.
2022-06-15 09:32:41 +01:00
MacroFake
fa07ee165e
Merge bitcoin/bitcoin#25339: RPC/blockchain: Elaborate on scantxoutset documentation
7862c4ac4e RPC/blockchain: Reorder result documentation for scantxoutset (Luke Dashjr)
98718d03be scripted-diff: RPC/blockchain: Lowercase "when" in scantxoutset documentation (Luke Dashjr)
b283e4d823 RPC/blockchain: Elaborate on scantxoutset documentation (Luke Dashjr)

Pull request description:

  Minor doc improvements

ACKs for top commit:
  achow101:
    ACK 7862c4ac4e

Tree-SHA512: a8b16a9b77c3ca216ce2556c26d6a049b12f73500bdb35c172432409b3b9321cc24a08daca1210926e0f75674b2e680e850637700c516c195fb75ce6555c17c4
2022-06-15 08:58:58 +02:00
MacroFake
ede9089096
Merge bitcoin/bitcoin#25156: refactor: Introduce PeerManagerImpl::RejectIncomingTxs
fafddafc2c refactor: Introduce PeerManagerImpl::RejectIncomingTxs (MacroFake)

Pull request description:

  Currently there are some confusions in net_processing:

  * There is confusion between `-blocksonly mode` and `block-relay-only`, so adjust all comments to use the same nomenclature.
  * Whether to disconnect peers for providing invs/txs is implemented differently. For example, it seems a bit confusing to disconnect `block-relay-only` peers with `relay` permission when they send a tx message, but not when they send an inv message. Also, keeping track of their inv announcements seems both wasteful and confusing, as it does nothing. This isn't possible in practice, as outbound connections do not have permissions assigned, but sees fragile to rely on. Especially in light of proposed changes to make that possible: https://github.com/bitcoin/bitcoin/pull/17167

ACKs for top commit:
  MarcoFalke:
    Should be trivial to re-ACK with `git range-diff bitcoin-core/master  fa2b5fe0c1 fafddafc2c`.
  jnewbery:
    Code review ACK fafddafc2c
  mzumsande:
    ACK fafddafc2c

Tree-SHA512: 73bf91afe93be619169cfbf3bf80cb08a5e6f73df4e0318b86817bd4d45f67408ea85998855992281d2decc9d24f7d75cffb83a0518d670090907309df8a3490
2022-06-15 08:14:02 +02:00
MacroFake
38c63e3683
Merge bitcoin/bitcoin#25338: scripted-diff: Avoid incompatibility with CMake AUTOUIC feature
018d70b587 scripted-diff: Avoid incompatibility with CMake AUTOUIC feature (Hennadii Stepanov)

Pull request description:

  Working on [migration](https://github.com/hebasto/bitcoin/pull/3) from Autotools to CMake build system, I found that our current code base needs to be adjusted.

  CMake [allows](https://cmake.org/cmake/help/latest/prop_tgt/AUTOUIC.html) to
  > handle the Qt `uic` code generator automatically

  When using this feature, statements like `#include "ui_<ui_base>.h"` are processed in a special way.

  The `node/ui_interface.h` unintentionally breaks this feature. Of course, it is possible to provide a list of source files to be excluded from `AUTOUIC`. But, unfortunately, this approach does not work for the `qt/sendcoinsdialog.cpp` source file, where there are both b71d37da2c/src/qt/sendcoinsdialog.cpp (L10) and b71d37da2c/src/qt/sendcoinsdialog.cpp (L24)

ACKs for top commit:
  MarcoFalke:
    cr ACK 018d70b587
  ryanofsky:
    Code review ACK 018d70b587
  furszy:
    Code review ACK 018d70b5

Tree-SHA512: 4fc83f2e5a82c8ab15c3c3d68f48b9863c47b96c0a66b6276b9b4dfc6063abffd73a16382acfe116553487b3ac697dbde2d9ada1b92010c5d8f8c6aa06f56428
2022-06-15 08:10:38 +02:00
BrokenProgrammer
e3609cdc01 doc: Update importaddress mention incompatibility with descriptor wallet 2022-06-14 20:54:45 +02:00
Hennadii Stepanov
a50e0b1bcb
qt, refactor: Add transactionoverviewwidget.cpp source file
Required for better/simpler interaction with CMake AUTOMOC.
2022-06-14 16:55:22 +02:00
furszy
192eb1e61c
refactor: getAddress don't access m_address_book, use FindAddressEntry function 2022-06-14 11:51:37 -03:00
laanwj
9e4fbebcc8
Merge bitcoin/bitcoin#25306: logging: add LogPrintfCategory to log unconditionally with category
ecff20db28 logging: use LogPrintfCategory rather than a manual category (Jon Atack)
eb8aab759f logging: add LogPrintfCategory to log unconditionally with category (Jon Atack)

Pull request description:

  These are the next two commits from #25203.

  - Add `LogPrintfCategory` to log unconditionally while prefixing the output with the passed category name. Add documentation and a unit test, and update the `lint-logs.py` and `lint-format-strings.py` scripts.

  - Replace the log messages that manually print a category, with `LogPrintfCategory`. In upcoming commits, it will likely be used in many other cases, such as to replace `LogPrintf` where it makes sense.

ACKs for top commit:
  klementtan:
    Code Review ACK ecff20db28
  laanwj:
    Code review ACK ecff20db28
  brunoerg:
    ACK ecff20db28

Tree-SHA512: ad3a82835254f7606efcd14b88f3d9072f1eb9b25db1321ed38ef6a4ec60efd555d78f5e19d93736f2f8500251d06f8beee9d694a153f24bf5cce3590a2a45a5
2022-06-14 11:46:32 +02:00
laanwj
1557014378
Merge bitcoin/bitcoin#25332: build: test for timingsafe_bcmp
491bb14c0c build: test for timingsafe_bcmp (fanquake)

Pull request description:

  Code introduced in #15649 added usage of [`timingsafe_bcmp()`](https://man.openbsd.org/timingsafe_bcmp.3), if
  available, otherwise falling back to our own implementation. However
  the relevant build system check was never added, so currently, we'll
  always just use our implementation, as `HAVE_TIMINGSAFE_BCMP` will never
  be defined.

  Add the check for `timingsafe_bcmp`. Note that as far as I'm aware, it's
  only available on OpenBSD.

  c3daa321f9/src/crypto/chacha_poly_aead.cpp (L16-L28)

  Guix Build (x86_64):
  ```bash
  0a890839e3de040e084d4df6aeabd924f6c6b04e724d7d2a87ef366d5493ac94  guix-build-491bb14c0c9c/output/aarch64-linux-gnu/SHA256SUMS.part
  fd5e1c4531f1739d63e8d552495c24c044ce9ddd34a424d6da1317830e625527  guix-build-491bb14c0c9c/output/aarch64-linux-gnu/bitcoin-491bb14c0c9c-aarch64-linux-gnu-debug.tar.gz
  551f58234ba5acf5c5125df85fccb49f8536399d2a1b7126848e4709b7edb61e  guix-build-491bb14c0c9c/output/aarch64-linux-gnu/bitcoin-491bb14c0c9c-aarch64-linux-gnu.tar.gz
  5a6f7630d36af7e4317f660232c52a5c8c983b1999f57e176a628d83a5eb7b4a  guix-build-491bb14c0c9c/output/arm-linux-gnueabihf/SHA256SUMS.part
  d1eba598d69498e899663cfcba295747ac5808218157adaca79d45459aac8ecf  guix-build-491bb14c0c9c/output/arm-linux-gnueabihf/bitcoin-491bb14c0c9c-arm-linux-gnueabihf-debug.tar.gz
  1e2559a99b89770501308416edc6cfeec94bfea9e9cadb6b64a4df7a487350d1  guix-build-491bb14c0c9c/output/arm-linux-gnueabihf/bitcoin-491bb14c0c9c-arm-linux-gnueabihf.tar.gz
  bc961b8b930df8123a6cad1c55f250658ea600d4a617ec4fceec2bfc28ec779f  guix-build-491bb14c0c9c/output/arm64-apple-darwin/SHA256SUMS.part
  f65118d324a8c1a3d80190dc0a80a2175b116a5ef5b0d977e8ffeaa7a8114851  guix-build-491bb14c0c9c/output/arm64-apple-darwin/bitcoin-491bb14c0c9c-arm64-apple-darwin-unsigned.dmg
  d27cd6193b1b5ecdab50d1fe2b4c3d0bfba04813506ecf63e27a6e9edb32913e  guix-build-491bb14c0c9c/output/arm64-apple-darwin/bitcoin-491bb14c0c9c-arm64-apple-darwin-unsigned.tar.gz
  76fc93a9c11909a826c9bd310ae4a70dc2083b96540c875d9cfb3b31bb86dd3e  guix-build-491bb14c0c9c/output/arm64-apple-darwin/bitcoin-491bb14c0c9c-arm64-apple-darwin.tar.gz
  43f157994432c16cfd481de2ce4894f7c241a0b87ce3797ffc492e219ed00c19  guix-build-491bb14c0c9c/output/dist-archive/bitcoin-491bb14c0c9c.tar.gz
  d04bc01a7b207e2d9e833ef4399d5daa789f5d7476df3915f426ea1c71578cb5  guix-build-491bb14c0c9c/output/powerpc64-linux-gnu/SHA256SUMS.part
  d815ab7157ca87a51c0c08907ba76f6bcec11cf9c0db77c2fd2885bf78796f97  guix-build-491bb14c0c9c/output/powerpc64-linux-gnu/bitcoin-491bb14c0c9c-powerpc64-linux-gnu-debug.tar.gz
  9f912bedf53d6921cf10f48569fb74ef4f42c8571fb976b50e67a64f6754833c  guix-build-491bb14c0c9c/output/powerpc64-linux-gnu/bitcoin-491bb14c0c9c-powerpc64-linux-gnu.tar.gz
  0651ed89f9a7cd4a4a196a48b330aec82f6ca1df5d842e6da863a87ae69f57f4  guix-build-491bb14c0c9c/output/powerpc64le-linux-gnu/SHA256SUMS.part
  4c5f1ea788580a99318dc91cb3ac51f11829163a5821a01d90459911b0ff791d  guix-build-491bb14c0c9c/output/powerpc64le-linux-gnu/bitcoin-491bb14c0c9c-powerpc64le-linux-gnu-debug.tar.gz
  61c91db6b7f34d43292b6e0c0a1e4bd5f6e2d532df835410daca337cf94c66af  guix-build-491bb14c0c9c/output/powerpc64le-linux-gnu/bitcoin-491bb14c0c9c-powerpc64le-linux-gnu.tar.gz
  be4d94e812c02a3955343d7a92a26deff9ced37aada049fd328118e01a8e3c53  guix-build-491bb14c0c9c/output/riscv64-linux-gnu/SHA256SUMS.part
  d73589e28311c8b442bb873d233181988f79d728965ccef395b19683b78203e9  guix-build-491bb14c0c9c/output/riscv64-linux-gnu/bitcoin-491bb14c0c9c-riscv64-linux-gnu-debug.tar.gz
  a1b15c96fcc936928aa183e7b06552c68a2dd5d178122394c3ed2cbd3f07ab2f  guix-build-491bb14c0c9c/output/riscv64-linux-gnu/bitcoin-491bb14c0c9c-riscv64-linux-gnu.tar.gz
  2d608c6b79be12cdc179e5e6414ea21d06d8b2816e098fbdb4e929b8f9338fa5  guix-build-491bb14c0c9c/output/x86_64-apple-darwin/SHA256SUMS.part
  ce11298ab92f388bd43ff2c6cb8c07c777dab44f0f6ea93b909805552bafd20d  guix-build-491bb14c0c9c/output/x86_64-apple-darwin/bitcoin-491bb14c0c9c-x86_64-apple-darwin-unsigned.dmg
  5d0626fc72d473157376efe0736f4d2b5836a5394a4869368bc65bf9d264d238  guix-build-491bb14c0c9c/output/x86_64-apple-darwin/bitcoin-491bb14c0c9c-x86_64-apple-darwin-unsigned.tar.gz
  d9f250bb45c4663f8160b7d22c1ccde8f1abad62dc6667e01fe71d577f00e9f9  guix-build-491bb14c0c9c/output/x86_64-apple-darwin/bitcoin-491bb14c0c9c-x86_64-apple-darwin.tar.gz
  72b3afe2d6124598eddbeed8d0799a8bd23536b4a3e4611162094601c75b923e  guix-build-491bb14c0c9c/output/x86_64-linux-gnu/SHA256SUMS.part
  eef6c0928762c77a23b485b55c350660b111ffdf3446825648d7da05e5e681eb  guix-build-491bb14c0c9c/output/x86_64-linux-gnu/bitcoin-491bb14c0c9c-x86_64-linux-gnu-debug.tar.gz
  a130d87e851f0192bf89dd5ecbe52d63231ce5dbbf584d1e4fb33a36ebb8bf7a  guix-build-491bb14c0c9c/output/x86_64-linux-gnu/bitcoin-491bb14c0c9c-x86_64-linux-gnu.tar.gz
  0f00372e30ea12ca9d16d70c4905b6b8492464987bb6b272ed4f9a945941d6b9  guix-build-491bb14c0c9c/output/x86_64-w64-mingw32/SHA256SUMS.part
  2852dff8d38ef6eee759bf9fe717a4288db46c300f061acb3212cd1499607d8d  guix-build-491bb14c0c9c/output/x86_64-w64-mingw32/bitcoin-491bb14c0c9c-win64-debug.zip
  ef087e9d6160e183f6ef6d64f9141b499e893d88705be5d1426ced6c49531c18  guix-build-491bb14c0c9c/output/x86_64-w64-mingw32/bitcoin-491bb14c0c9c-win64-setup-unsigned.exe
  79392686b9f5781275e346badf8d7166baa0b4f2c0037ddd6df0b4bc23eaedf6  guix-build-491bb14c0c9c/output/x86_64-w64-mingw32/bitcoin-491bb14c0c9c-win64-unsigned.tar.gz
  da8c9f6922bdab660dfbd757ec89ce7a2493bf1d02e32172b77c1a21b09daaa9  guix-build-491bb14c0c9c/output/x86_64-w64-mingw32/bitcoin-491bb14c0c9c-win64.zip
  ```

  Guix Build (arm64):
  ```bash
  ff7afe1f43ac18df89cf1932568b0713f6f22fd2b449a4a87f9aebf404449897  guix-build-491bb14c0c9c/output/arm-linux-gnueabihf/SHA256SUMS.part
  5e727cc3273615e6f75c6e15bc004946ab7494ee169ecf830f23290cf6f5c3de  guix-build-491bb14c0c9c/output/arm-linux-gnueabihf/bitcoin-491bb14c0c9c-arm-linux-gnueabihf-debug.tar.gz
  4aff5487b129dc483780646994246890a5917c8956980ec52682accfe5a0d02e  guix-build-491bb14c0c9c/output/arm-linux-gnueabihf/bitcoin-491bb14c0c9c-arm-linux-gnueabihf.tar.gz
  cabfeb29771017dfde35a1c8f08c7066255ad84a05d6d565cfcf852a5d869d16  guix-build-491bb14c0c9c/output/arm64-apple-darwin/SHA256SUMS.part
  99360c7135967e1d9709830abcc8f5b6ebc7bc37c5be0eac1ddebe0ce5dbe344  guix-build-491bb14c0c9c/output/arm64-apple-darwin/bitcoin-491bb14c0c9c-arm64-apple-darwin-unsigned.dmg
  9caa58d1efe18c7ad68fec2a71455ade61939f32ae2da0b0457b459204227046  guix-build-491bb14c0c9c/output/arm64-apple-darwin/bitcoin-491bb14c0c9c-arm64-apple-darwin-unsigned.tar.gz
  d9b0ad26346869aa6a4229aa77796535f68880fc50f8b7b7a4297f2e14d2e3ad  guix-build-491bb14c0c9c/output/arm64-apple-darwin/bitcoin-491bb14c0c9c-arm64-apple-darwin.tar.gz
  43f157994432c16cfd481de2ce4894f7c241a0b87ce3797ffc492e219ed00c19  guix-build-491bb14c0c9c/output/dist-archive/bitcoin-491bb14c0c9c.tar.gz
  e2f95f50ae973cef815731485be6b917f39eea92ef4e93fa63aa1ad6cb52a3c9  guix-build-491bb14c0c9c/output/powerpc64-linux-gnu/SHA256SUMS.part
  452f3091a1e841920e958f14f1650e94b3a61cb430cb99930fb5941d8a8aad3d  guix-build-491bb14c0c9c/output/powerpc64-linux-gnu/bitcoin-491bb14c0c9c-powerpc64-linux-gnu-debug.tar.gz
  a371cee3dae3d5cf5ca792b58a1bb492a6a6147e0b515e69869d3543edbeaea5  guix-build-491bb14c0c9c/output/powerpc64-linux-gnu/bitcoin-491bb14c0c9c-powerpc64-linux-gnu.tar.gz
  89153f4b6a3bc6d47787c4d63b57e1dade8116822abb547fc1759c84e6ff6fa2  guix-build-491bb14c0c9c/output/powerpc64le-linux-gnu/SHA256SUMS.part
  9f51353abe7b6154a48da5db3fce29d2dac1dbe9a6c78aade1b9e1b6b12370fa  guix-build-491bb14c0c9c/output/powerpc64le-linux-gnu/bitcoin-491bb14c0c9c-powerpc64le-linux-gnu-debug.tar.gz
  25b21eb2d8e3982dac5e1510b78339b7c4bddf164b986c929036369e403ddadd  guix-build-491bb14c0c9c/output/powerpc64le-linux-gnu/bitcoin-491bb14c0c9c-powerpc64le-linux-gnu.tar.gz
  92c4c404f7355897bca4ba7e38a908828da73617cac7b0fbd89952ce20859d83  guix-build-491bb14c0c9c/output/riscv64-linux-gnu/SHA256SUMS.part
  230361b5a493b3ac17780b3d5496cc10a37d3345b96874b04092c06aab36cb0d  guix-build-491bb14c0c9c/output/riscv64-linux-gnu/bitcoin-491bb14c0c9c-riscv64-linux-gnu-debug.tar.gz
  d8110e6d738a40ccd076cbd286557931b2a433e27c8defcc496ac56f60fe5327  guix-build-491bb14c0c9c/output/riscv64-linux-gnu/bitcoin-491bb14c0c9c-riscv64-linux-gnu.tar.gz
  2d608c6b79be12cdc179e5e6414ea21d06d8b2816e098fbdb4e929b8f9338fa5  guix-build-491bb14c0c9c/output/x86_64-apple-darwin/SHA256SUMS.part
  ce11298ab92f388bd43ff2c6cb8c07c777dab44f0f6ea93b909805552bafd20d  guix-build-491bb14c0c9c/output/x86_64-apple-darwin/bitcoin-491bb14c0c9c-x86_64-apple-darwin-unsigned.dmg
  5d0626fc72d473157376efe0736f4d2b5836a5394a4869368bc65bf9d264d238  guix-build-491bb14c0c9c/output/x86_64-apple-darwin/bitcoin-491bb14c0c9c-x86_64-apple-darwin-unsigned.tar.gz
  d9f250bb45c4663f8160b7d22c1ccde8f1abad62dc6667e01fe71d577f00e9f9  guix-build-491bb14c0c9c/output/x86_64-apple-darwin/bitcoin-491bb14c0c9c-x86_64-apple-darwin.tar.gz
  de7a52a67f243b6db1086c2ab2cc3f01784d38b43b7aaf795b7713c33799ab62  guix-build-491bb14c0c9c/output/x86_64-linux-gnu/SHA256SUMS.part
  88228ef3007e81ade481d0c3fa757ac3ae86bda50aeef2631335c5d54fb4194c  guix-build-491bb14c0c9c/output/x86_64-linux-gnu/bitcoin-491bb14c0c9c-x86_64-linux-gnu-debug.tar.gz
  b1f2ddf50658f4d1bd0667cc16502f9a45d9e0eef4c1d103cd7780cebfc2766d  guix-build-491bb14c0c9c/output/x86_64-linux-gnu/bitcoin-491bb14c0c9c-x86_64-linux-gnu.tar.gz
  f0cc08231ed964fcb4f2c5a697c52160dad8ed374f8d9537eb7f2ca9f47e7b2c  guix-build-491bb14c0c9c/output/x86_64-w64-mingw32/SHA256SUMS.part
  d9c49c031bde4f80e63955fdeb14a7fb8f74a27d09bcf01881648917df10a836  guix-build-491bb14c0c9c/output/x86_64-w64-mingw32/bitcoin-491bb14c0c9c-win64-debug.zip
  ef087e9d6160e183f6ef6d64f9141b499e893d88705be5d1426ced6c49531c18  guix-build-491bb14c0c9c/output/x86_64-w64-mingw32/bitcoin-491bb14c0c9c-win64-setup-unsigned.exe
  79392686b9f5781275e346badf8d7166baa0b4f2c0037ddd6df0b4bc23eaedf6  guix-build-491bb14c0c9c/output/x86_64-w64-mingw32/bitcoin-491bb14c0c9c-win64-unsigned.tar.gz
  1d76ceae8c3feef573d4e60fe6c7be5f3bea4afd3994ddc16759d8b381767015  guix-build-491bb14c0c9c/output/x86_64-w64-mingw32/bitcoin-491bb14c0c9c-win64.zip
  ```

ACKs for top commit:
  laanwj:
    Code review ACK 491bb14c0c
  theStack:
    ACK 491bb14c0c

Tree-SHA512: 50d273706e92016783f6a9d552f56b703c3c26ec2f0fafb9a0d1c1047456eee7c08e76ebc57077d2ecf95aaf5a3804c88a629a2e02a48c8be91b87ffa44cdb3e
2022-06-14 10:39:31 +02:00
Hennadii Stepanov
018d70b587
scripted-diff: Avoid incompatibility with CMake AUTOUIC feature
-BEGIN VERIFY SCRIPT-
sed -i "s|node/ui_interface|node/interface_ui|g" $(git grep -l "node/ui_interface" ./src)
git mv src/node/ui_interface.cpp src/node/interface_ui.cpp
git mv src/node/ui_interface.h src/node/interface_ui.h
sed -i "s|BITCOIN_NODE_UI_INTERFACE_H|BITCOIN_NODE_INTERFACE_UI_H|g" src/node/interface_ui.h
-END VERIFY SCRIPT-
2022-06-14 10:38:51 +02:00
laanwj
c5fbcf5f8d
Merge bitcoin/bitcoin#25320: util: modify Win32LockedPageAllocator to query windows for limit.
1cb42aeda3 util: modify Win32LockedPageAllocator to query windows for limit (Oskar Mendel)

Pull request description:

  This PR resolves a todo within the Win32LockedPageAllocator: `// TODO is there a limit on Windows, how to get it?`.
  The idea is to use the Windows API to get the limits like the posix based allocator does with `getrlimit`.

  I use [GetProcessWorkingSetSize](https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-getprocessworkingsetsize) to perform this task and fallback to `return std::numeric_limits<size_t>::max();` just like the posix implementation does.

ACKs for top commit:
  sipsorcery:
    tACK 1cb42aeda3.

Tree-SHA512: 7bdd8a57a4e64ee59d752417a519656e03526878462060753be4dce481eff4889fb5edc1bdbd575b707d9b2dfe255c87da9ef67baac97de9ac5e70a04c852081
2022-06-14 09:46:28 +02:00
MacroFake
fafddafc2c
refactor: Introduce PeerManagerImpl::RejectIncomingTxs
Currently there are some confusions in net_processing:

* There is confusion between `-blocksonly mode` and `block-relay-only`,
  so adjust all comments to use the same nomenclature.
* Whether to disconnect peers for providing invs/txs is implemented
  differently. For example, it seems a bit confusing to disconnect
  `block-relay-only` peers with `relay` permission when they send a tx
  message, but not when they send an inv message. Also, keeping track of
  their inv announcements seems both wasteful and confusing, as it does
  nothing. This isn't possible in practice, as outbound connections do
  not have permissions assigned, but sees fragile to rely on. Especially
  in light of proposed changes to make that possible:
  https://github.com/bitcoin/bitcoin/pull/17167
2022-06-14 08:39:55 +02:00
MacroFake
b91055ea55
Merge bitcoin/bitcoin#25251: Consolidate Windows ASLR workarounds for upstream secp256k1 changes
c41bfd1070 Squashed 'src/secp256k1/' changes from 8746600ee..44c2452fd (fanquake)
fbae8c59a2 compat: Consolidate mingw-w64 ASLR workaround for upstream libsecp changes (fanquake)

Pull request description:

  #18702 added a work around for `bitcoin-cli.exe`, to fix ASLR on Windows. ASLR was functioning for the rest of our binaries, mostly by accident, because:
  > [All other Windows binaries that we distribute (bitcoind, bitcoin-qt,
  bitcoin-wallet, bitcoin-tx and test_bitcoin) do not suffer this issue,
  and currently having working ASLR. This is due to them exporting
  (inadvertent or not) libsecp256k1 symbols, and, as a result, the .reloc
  section is not stripped by ld.](https://github.com/bitcoin/bitcoin/pull/18702)

  Upstream, libsecp256k1 has recently made a change to [no-longer export symbols in static libraries](https://github.com/bitcoin-core/secp256k1/pull/1105) (see related discussion in #25008). This would mean that on the next subtree update, anyone building using an older binutils (< 2.36) would be (silently) producing Windows binaries with non-functioning ASLR. Our release binaries would not be affected, as in our Guix environment we currently use binutils 2.37.

  To prevent users building with older binutils from silently losing ASLR on Windows, this PR applies our work around (export `main`) to the rest of our binaries, and updates the associated documentation to mention the affected binutils versions, so we know when it can be dropped.

  I've included both the libsecp256k1 subtree update, and the ASLR related changes in this PR. Happy to split the changes up if reviewers would prefer.

  Guix Build (x86_64):
  ```bash
  24fa1053fa3d310c4274f0700ac36f3c6e5b4486dc7f1aa7b2a5ded6937cf2b6  guix-build-913b1f2a5eb2/output/aarch64-linux-gnu/SHA256SUMS.part
  96c4150f93c1356dc02f3d383699bcd856da7f769344606324fdc111fbfa8031  guix-build-913b1f2a5eb2/output/aarch64-linux-gnu/bitcoin-913b1f2a5eb2-aarch64-linux-gnu-debug.tar.gz
  5e4adcaddf20a33cd4803e5a10f9a0653bcd40b1dfc7b680a741a17047103948  guix-build-913b1f2a5eb2/output/aarch64-linux-gnu/bitcoin-913b1f2a5eb2-aarch64-linux-gnu.tar.gz
  adfdac8fef797b13d845c13ab682611d0cc49a9772c2bd40f7aa6dbb1b4f11a8  guix-build-913b1f2a5eb2/output/arm-linux-gnueabihf/SHA256SUMS.part
  d51849bf907eecb168066a208b702314779fc12ae6fcaa8b5c2c3497e91820b9  guix-build-913b1f2a5eb2/output/arm-linux-gnueabihf/bitcoin-913b1f2a5eb2-arm-linux-gnueabihf-debug.tar.gz
  ca33ebed13316410d6d79e2db06f9bce8839fbc7216a5bc01a06745b2e470c2e  guix-build-913b1f2a5eb2/output/arm-linux-gnueabihf/bitcoin-913b1f2a5eb2-arm-linux-gnueabihf.tar.gz
  799fd15fa1e53d773a5ce391b7059920b54680591ee76bdc56bc7485a12d2af6  guix-build-913b1f2a5eb2/output/arm64-apple-darwin/SHA256SUMS.part
  0122eb5fdd4cce7077ee1a2bba8c5bd3557c1d3f12f2f2aad7216de33bea213e  guix-build-913b1f2a5eb2/output/arm64-apple-darwin/bitcoin-913b1f2a5eb2-arm64-apple-darwin-unsigned.dmg
  3a630cc96bf9a43cbb89976aabdddb7a9069f74320277a499f3bbb96526d9c5d  guix-build-913b1f2a5eb2/output/arm64-apple-darwin/bitcoin-913b1f2a5eb2-arm64-apple-darwin-unsigned.tar.gz
  e2530bab501750fd3d60776ba077bc4a8b145cc95e3a77105d86b388a1d961e1  guix-build-913b1f2a5eb2/output/arm64-apple-darwin/bitcoin-913b1f2a5eb2-arm64-apple-darwin.tar.gz
  f8fbc07221bd21f996dc29c65725740e9c2bfc9365367c806601f12b8e2d2691  guix-build-913b1f2a5eb2/output/dist-archive/bitcoin-913b1f2a5eb2.tar.gz
  fdbc8224d774f2428f037e65d9ac5728613cddee4ddcf6f1d144421cb1f37b3b  guix-build-913b1f2a5eb2/output/powerpc64-linux-gnu/SHA256SUMS.part
  c1098cba38aee264ee7de82be3d5f8c1ec2c915c30763292fa9b6dc37aba8de8  guix-build-913b1f2a5eb2/output/powerpc64-linux-gnu/bitcoin-913b1f2a5eb2-powerpc64-linux-gnu-debug.tar.gz
  567b8bf896a79e2f1b4961ec4f6c3501e414822f84f6fb40c9e3546e67ab08ff  guix-build-913b1f2a5eb2/output/powerpc64-linux-gnu/bitcoin-913b1f2a5eb2-powerpc64-linux-gnu.tar.gz
  cbd7713550c5922ee28e0915b0425dc702bb299ad6809ff60e389604f4da3a31  guix-build-913b1f2a5eb2/output/powerpc64le-linux-gnu/SHA256SUMS.part
  e50fa6e370602a956942703ab349808c01e7365a00faead941d9e6be3800c65c  guix-build-913b1f2a5eb2/output/powerpc64le-linux-gnu/bitcoin-913b1f2a5eb2-powerpc64le-linux-gnu-debug.tar.gz
  2380fbdf6916769783a0e6c7848fb8d3b3cb5c44c26817009a8481e815098e3a  guix-build-913b1f2a5eb2/output/powerpc64le-linux-gnu/bitcoin-913b1f2a5eb2-powerpc64le-linux-gnu.tar.gz
  a0fecb7b0d0a93aa15825572a0e1284f4776a5808f9f5eda7b2ddddaf2457fb2  guix-build-913b1f2a5eb2/output/riscv64-linux-gnu/SHA256SUMS.part
  14fe505f06de009b50c2b4ce0e0430ba09fa66385ff50aa90f9ed0b03a321e61  guix-build-913b1f2a5eb2/output/riscv64-linux-gnu/bitcoin-913b1f2a5eb2-riscv64-linux-gnu-debug.tar.gz
  98a70df9a6851d5221d8f8404f9656048ecf7cac2c9dffd2b6a55107783a60ad  guix-build-913b1f2a5eb2/output/riscv64-linux-gnu/bitcoin-913b1f2a5eb2-riscv64-linux-gnu.tar.gz
  decb20f8de61e3eeda7e8f6fefcbaf56593c37d989672c6e7e2cd5c8e982c342  guix-build-913b1f2a5eb2/output/x86_64-apple-darwin/SHA256SUMS.part
  e14275e1bbbe54179fb68b50ed7c72de4c7ebc5b442c7793daf9974be523e8da  guix-build-913b1f2a5eb2/output/x86_64-apple-darwin/bitcoin-913b1f2a5eb2-x86_64-apple-darwin-unsigned.dmg
  6bb2d9f6c8123156b0e11b73f67f4e4e780e6bccb739e600f4e9b06b29aa3832  guix-build-913b1f2a5eb2/output/x86_64-apple-darwin/bitcoin-913b1f2a5eb2-x86_64-apple-darwin-unsigned.tar.gz
  1f0fab16e32e4c9892b272edf43beb8e5de60bf8a04f41744809dc2a31b4f1b9  guix-build-913b1f2a5eb2/output/x86_64-apple-darwin/bitcoin-913b1f2a5eb2-x86_64-apple-darwin.tar.gz
  3d7e45c7189a8855ea8a0d498dcd4d3189aa01c528eac194300cdb59f79471f2  guix-build-913b1f2a5eb2/output/x86_64-linux-gnu/SHA256SUMS.part
  87b75a47a620dbd8ccf20768a3d82adf0b797ad86b7384cca62a7cf489b7a74c  guix-build-913b1f2a5eb2/output/x86_64-linux-gnu/bitcoin-913b1f2a5eb2-x86_64-linux-gnu-debug.tar.gz
  7e06af11bcef3ba6fd48501a09fbac86746537bad063f36caf39cd6bb857d3a8  guix-build-913b1f2a5eb2/output/x86_64-linux-gnu/bitcoin-913b1f2a5eb2-x86_64-linux-gnu.tar.gz
  c9ca794f7307df6f891008d92997719be95794f4670d018d0275f2a6c580d160  guix-build-913b1f2a5eb2/output/x86_64-w64-mingw32/SHA256SUMS.part
  7eb1551cdafc0a44e5b5fcea703c6eeb6fc0bca601b57ab52d1e5e62db3ccffc  guix-build-913b1f2a5eb2/output/x86_64-w64-mingw32/bitcoin-913b1f2a5eb2-win64-debug.zip
  8ef87c85c520aef150f4c11a9082e8a0b1ac74c5b6f4fcdceb9e734eb8106bca  guix-build-913b1f2a5eb2/output/x86_64-w64-mingw32/bitcoin-913b1f2a5eb2-win64-setup-unsigned.exe
  c5886ab3d6303bf8c946e4aafcfdfb5ee7dc9fbb50c34dfc5224db2f1f3b2a44  guix-build-913b1f2a5eb2/output/x86_64-w64-mingw32/bitcoin-913b1f2a5eb2-win64-unsigned.tar.gz
  f473902cea9e763b98ad69c5dcfaa990430f9b0f777112af5f1d289492d8cefe  guix-build-913b1f2a5eb2/output/x86_64-w64-mingw32/bitcoin-913b1f2a5eb2-win64.zip
  ```

  Guix Build (arm64):
  ```bash
  a175ce0055b206fe7b2752fa5ae33eed0f31236f7b37bbb530425532d88007c2  guix-build-913b1f2a5eb2/output/arm-linux-gnueabihf/SHA256SUMS.part
  1ab5d59685593eedbb59b5284d81cce568a6c9c900303f97c69e8194cb5bb7f5  guix-build-913b1f2a5eb2/output/arm-linux-gnueabihf/bitcoin-913b1f2a5eb2-arm-linux-gnueabihf-debug.tar.gz
  8d1b48d38b8af696b929ac077ba7e3dabb7c565862409b2f35db2217ab9bdb06  guix-build-913b1f2a5eb2/output/arm-linux-gnueabihf/bitcoin-913b1f2a5eb2-arm-linux-gnueabihf.tar.gz
  90230652cb39e2707ac79569899183dc1ff5d08c059e7a01d0c65144251679b5  guix-build-913b1f2a5eb2/output/arm64-apple-darwin/SHA256SUMS.part
  2b86da5e1ccebf348478ca69463d1be09c0f563ffa370ee5170c82ba706a7577  guix-build-913b1f2a5eb2/output/arm64-apple-darwin/bitcoin-913b1f2a5eb2-arm64-apple-darwin-unsigned.dmg
  648e968dbf3af3bf8a79d714f4395091058e2ff4294b202a0dc9b5e0092b4732  guix-build-913b1f2a5eb2/output/arm64-apple-darwin/bitcoin-913b1f2a5eb2-arm64-apple-darwin-unsigned.tar.gz
  bebe7ed21e4f74866ca99be31839beff01eac57afbaa2878f5c6637f0239c631  guix-build-913b1f2a5eb2/output/arm64-apple-darwin/bitcoin-913b1f2a5eb2-arm64-apple-darwin.tar.gz
  f8fbc07221bd21f996dc29c65725740e9c2bfc9365367c806601f12b8e2d2691  guix-build-913b1f2a5eb2/output/dist-archive/bitcoin-913b1f2a5eb2.tar.gz
  87156fe1fb397eaa1d1f15c36f2677b6aeb32eefac02202b2735f7d3165fceb1  guix-build-913b1f2a5eb2/output/powerpc64-linux-gnu/SHA256SUMS.part
  5f06e885564780d7dce78cc8cbb21b8dd5addba8b90bb2b8a7f03e946b6ed633  guix-build-913b1f2a5eb2/output/powerpc64-linux-gnu/bitcoin-913b1f2a5eb2-powerpc64-linux-gnu-debug.tar.gz
  95b9c0a7d82e7055c99d013fa183abf654caf14539c5ec9cfe785838f45747fc  guix-build-913b1f2a5eb2/output/powerpc64-linux-gnu/bitcoin-913b1f2a5eb2-powerpc64-linux-gnu.tar.gz
  8da6f0fb2bdc492f96ee70ca323787521e7fce7ebe2b9adb43b7b6ae56ff1916  guix-build-913b1f2a5eb2/output/powerpc64le-linux-gnu/SHA256SUMS.part
  a60623ac5bb76b3eae3129b4f32fe7287e526e043bd2e58f80ce5fccf91ef20c  guix-build-913b1f2a5eb2/output/powerpc64le-linux-gnu/bitcoin-913b1f2a5eb2-powerpc64le-linux-gnu-debug.tar.gz
  c9bbdca3c41c3783d57734e0fda875a6353bbf8fec8c8e61f037259acaad28cd  guix-build-913b1f2a5eb2/output/powerpc64le-linux-gnu/bitcoin-913b1f2a5eb2-powerpc64le-linux-gnu.tar.gz
  5f76aef2eed312153b60712450b4376b4965c2b0c86d2ddfc0b7f3d23fb31eee  guix-build-913b1f2a5eb2/output/riscv64-linux-gnu/SHA256SUMS.part
  40ad7ca605bb75e153a481a455b344f27d9c0b713f1312fc2a7703116508a127  guix-build-913b1f2a5eb2/output/riscv64-linux-gnu/bitcoin-913b1f2a5eb2-riscv64-linux-gnu-debug.tar.gz
  6031d28d6405f03b685884fdee6c2cc2126afffdc867ab743ca0c9cfcad81ac2  guix-build-913b1f2a5eb2/output/riscv64-linux-gnu/bitcoin-913b1f2a5eb2-riscv64-linux-gnu.tar.gz
  decb20f8de61e3eeda7e8f6fefcbaf56593c37d989672c6e7e2cd5c8e982c342  guix-build-913b1f2a5eb2/output/x86_64-apple-darwin/SHA256SUMS.part
  e14275e1bbbe54179fb68b50ed7c72de4c7ebc5b442c7793daf9974be523e8da  guix-build-913b1f2a5eb2/output/x86_64-apple-darwin/bitcoin-913b1f2a5eb2-x86_64-apple-darwin-unsigned.dmg
  6bb2d9f6c8123156b0e11b73f67f4e4e780e6bccb739e600f4e9b06b29aa3832  guix-build-913b1f2a5eb2/output/x86_64-apple-darwin/bitcoin-913b1f2a5eb2-x86_64-apple-darwin-unsigned.tar.gz
  1f0fab16e32e4c9892b272edf43beb8e5de60bf8a04f41744809dc2a31b4f1b9  guix-build-913b1f2a5eb2/output/x86_64-apple-darwin/bitcoin-913b1f2a5eb2-x86_64-apple-darwin.tar.gz
  b90d8c7252fd42809ac9bf8c7e5cf9c9207f7412314e9e6904ee2e51222bc8c5  guix-build-913b1f2a5eb2/output/x86_64-linux-gnu/SHA256SUMS.part
  b6cbcd305a9b6b8dcc6be71703745835c9e3e7652a3f3b18e7018f5ddb0fc26d  guix-build-913b1f2a5eb2/output/x86_64-linux-gnu/bitcoin-913b1f2a5eb2-x86_64-linux-gnu-debug.tar.gz
  6da0cf8fedd9c285926c132102d1e8f9d6fde7e0ecdac3ba159a3464fc2e98c0  guix-build-913b1f2a5eb2/output/x86_64-linux-gnu/bitcoin-913b1f2a5eb2-x86_64-linux-gnu.tar.gz
  30d2b25cdfce03edc2bfb8d39dcdcc6636ed3637cc0176f43f715dc795ab929e  guix-build-913b1f2a5eb2/output/x86_64-w64-mingw32/SHA256SUMS.part
  6028017fabcddac50857667d63da979b04a6dc331a26715f875e2db96b8935d7  guix-build-913b1f2a5eb2/output/x86_64-w64-mingw32/bitcoin-913b1f2a5eb2-win64-debug.zip
  8ef87c85c520aef150f4c11a9082e8a0b1ac74c5b6f4fcdceb9e734eb8106bca  guix-build-913b1f2a5eb2/output/x86_64-w64-mingw32/bitcoin-913b1f2a5eb2-win64-setup-unsigned.exe
  c5886ab3d6303bf8c946e4aafcfdfb5ee7dc9fbb50c34dfc5224db2f1f3b2a44  guix-build-913b1f2a5eb2/output/x86_64-w64-mingw32/bitcoin-913b1f2a5eb2-win64-unsigned.tar.gz
  4af0477e156b9a0c6fa1754ba7446b8c6c021075531aa4051980e47fa586e196  guix-build-913b1f2a5eb2/output/x86_64-w64-mingw32/bitcoin-913b1f2a5eb2-win64.zip
  ```

  Symbol exporting as of this PR (`bitcoind.exe`):
  ```bash
  Export Table:
   DLL name: bitcoind.exe
   Ordinal base: 1
   Ordinal      RVA  Name
         1 0xa09670  main
  ```

  Symbol exporting in the 23.0 bins (`bitcoind.exe`):
  ```bash
  Export Table:
   DLL name: bitcoind.exe
   Ordinal base: 1
   Ordinal      RVA  Name
         1 0x5569f0  secp256k1_context_clone
         2 0x556890  secp256k1_context_create
         3 0x556bd0  secp256k1_context_destroy
         4 0xa12710  secp256k1_context_no_precomp
         5 0x556900  secp256k1_context_preallocated_clone
         6 0x556740  secp256k1_context_preallocated_clone_size
         7 0x556750  secp256k1_context_preallocated_create
         8 0x556ae0  secp256k1_context_preallocated_destroy
         9 0x556710  secp256k1_context_preallocated_size
        10 0x5589c0  secp256k1_context_randomize
        11 0x556c80  secp256k1_context_set_error_callback
        12 0x556c20  secp256k1_context_set_illegal_callback
        13 0x558260  secp256k1_ec_privkey_negate
        14 0x5584e0  secp256k1_ec_privkey_tweak_add
        15 0x558730  secp256k1_ec_privkey_tweak_mul
        16 0x5572a0  secp256k1_ec_pubkey_cmp
        17 0x5589f0  secp256k1_ec_pubkey_combine
        18 0x557f40  secp256k1_ec_pubkey_create
        19 0x558270  secp256k1_ec_pubkey_negate
        20 0x556dc0  secp256k1_ec_pubkey_parse
        21 0x5570d0  secp256k1_ec_pubkey_serialize
        22 0x5584f0  secp256k1_ec_pubkey_tweak_add
        23 0x558740  secp256k1_ec_pubkey_tweak_mul
        24 0x558100  secp256k1_ec_seckey_negate
        25 0x5583a0  secp256k1_ec_seckey_tweak_add
        26 0x5585f0  secp256k1_ec_seckey_tweak_mul
        27 0x557ed0  secp256k1_ec_seckey_verify
        28 0x559120  secp256k1_ecdsa_recover
        29 0x558f50  secp256k1_ecdsa_recoverable_signature_convert
        30 0x558d00  secp256k1_ecdsa_recoverable_signature_parse_compact
        31 0x558e70  secp256k1_ecdsa_recoverable_signature_serialize_compact
        32 0x557da0  secp256k1_ecdsa_sign
        33 0x558fe0  secp256k1_ecdsa_sign_recoverable
        34 0x557ab0  secp256k1_ecdsa_signature_normalize
        35 0x557540  secp256k1_ecdsa_signature_parse_compact
        36 0x5573b0  secp256k1_ecdsa_signature_parse_der
        37 0x557a10  secp256k1_ecdsa_signature_serialize_compact
        38 0x557660  secp256k1_ecdsa_signature_serialize_der
        39 0x557bf0  secp256k1_ecdsa_verify
        40 0x5598a0  secp256k1_keypair_create
        41 0x559af0  secp256k1_keypair_pub
        42 0x559a60  secp256k1_keypair_sec
        43 0x559bc0  secp256k1_keypair_xonly_pub
        44 0x559d20  secp256k1_keypair_xonly_tweak_add
        45 0xa9e0c0  secp256k1_nonce_function_bip340
        46 0xa9e0e0  secp256k1_nonce_function_default
        47 0xa9e0e8  secp256k1_nonce_function_rfc6979
        48 0x559f00  secp256k1_schnorrsig_sign
        49 0x559f30  secp256k1_schnorrsig_sign_custom
        50 0x559fd0  secp256k1_schnorrsig_verify
        51 0x556ce0  secp256k1_scratch_space_create
        52 0x556d50  secp256k1_scratch_space_destroy
        53 0x558c20  secp256k1_tagged_sha256
        54 0x559470  secp256k1_xonly_pubkey_cmp
        55 0x559530  secp256k1_xonly_pubkey_from_pubkey
        56 0x559290  secp256k1_xonly_pubkey_parse
        57 0x5593a0  secp256k1_xonly_pubkey_serialize
        58 0x559650  secp256k1_xonly_pubkey_tweak_add
        59 0x559780  secp256k1_xonly_pubkey_tweak_add_check
  ```

ACKs for top commit:
  laanwj:
    Code review ACK 913b1f2a5e
  theuni:
    ACK 913b1f2a5e

Tree-SHA512: d3811c5731fab05bb68af72b7af231de8505b026bd1b2cd710e3e60386e793c2743412529142aa9893893f9d24c6e94dbac48ea59451bf55ae637d2e75e2b0a9
2022-06-13 21:43:39 +02:00
Luke Dashjr
7862c4ac4e RPC/blockchain: Reorder result documentation for scantxoutset
start, abort, status (with result), and status (no result) makes more logical sense
2022-06-13 14:09:48 +00:00
Luke Dashjr
98718d03be scripted-diff: RPC/blockchain: Lowercase "when" in scantxoutset documentation
-BEGIN VERIFY SCRIPT-
sed -i -e 's/"When /"when /' $(git grep -l 'RPCResult{"When ')
-END VERIFY SCRIPT-
2022-06-13 14:08:30 +00:00
Luke Dashjr
b283e4d823 RPC/blockchain: Elaborate on scantxoutset documentation 2022-06-13 14:05:06 +00:00
Hennadii Stepanov
37633d2f61
Merge bitcoin-core/gui#602: Unify bitcoin-qt and bitcoind persistent settings
e47c6c7656 Reset settings.json when GUI options are reset (Ryan Ofsky)
99ccc02b65 Add release notes about unified bitcoin-qt and bitcoind persistent settings (Ryan Ofsky)
504b06b1de Migrate -lang setting from QSettings to settings.json (Ryan Ofsky)
9a016a3c07 Migrate -prune setting from QSettings to settings.json (Ryan Ofsky)
f067e19433 Migrate -proxy and -onion settings from QSettings to settings.json (Ryan Ofsky)
a09e3b7cf2 Migrate -listen and -server settings from QSettings to settings.json (Ryan Ofsky)
d2ada6e635 Migrate -upnp and -natpmp settings from QSettings to settings.json (Ryan Ofsky)
1dc4fc29c1 Migrate -spendzeroconfchange and -signer settings from QSettings to settings.json (Ryan Ofsky)
a7ef6d5975 Migrate -par setting from QSettings to settings.json (Ryan Ofsky)
284f339de6 Migrate -dbcache setting from QSettings to settings.json (Ryan Ofsky)

Pull request description:

  If a setting like pruning, port mapping, or a network proxy is enabled in the GUI, it will now be stored in the bitcoin persistent setting file in the datadir and shared with bitcoind, instead of being stored as Qt settings which end up in the the windows registry or platform specific config files and are ignored by bitcoind.

  This PR has been split off from bitcoin/bitcoin#15936 so some review of these commits previously took place in that PR.

ACKs for top commit:
  furszy:
    Code review ACK e47c6c76
  hebasto:
    ACK e47c6c7656

Tree-SHA512: 076ea7c7efe67805b4a357113bfe1643dce364d0032774106de59566a0ed5771d57a5923920085e03d686beb34b98114bd278555dfdf8bb7af0b778b0f35b7d2
2022-06-12 14:59:14 +02:00
Hennadii Stepanov
7ab72b9d2a
qt: Fix BitcoinAmountField's base widget 2022-06-12 13:40:48 +02:00
Hennadii Stepanov
3262542104
qt, refactor: Fix sendcoinsentry.ui indentation 2022-06-12 13:40:48 +02:00
Hennadii Stepanov
f3c7603329
qt, refactor: Convert SendCoinsEntry to a sub-QWidget
It is no longer needed to derive the `SendCoinsEntry` class from the
`QStackedWidget` one.
2022-06-12 13:40:46 +02:00
Hennadii Stepanov
9ef180a0ab
Merge bitcoin-core/gui#608: wallet, refactor: Make WalletModel::sendCoins() return void
1f653dc262 qt, wallet, refactor: Make `WalletModel::sendCoins()` return `void` (Hennadii Stepanov)

Pull request description:

  Currently, the `WalletModel::sendCoins()` function always returns the same value.

  Also dead and noop (calling `processSendCoinsReturn(OK)`) code has been removed.

  The other `return` statements have been removed from the `WalletModel::sendCoins()` function in bitcoin/bitcoin#17154 and bitcoin/bitcoin#17165.

ACKs for top commit:
  kristapsk:
    cr ACK 1f653dc262
  furszy:
    Code review ACK 1f653dc2
  shaavan:
    Code Review ACK 1f653dc262
  w0xlt:
    Code Review ACK 1f653dc262

Tree-SHA512: 2b59495a7fc10b4de30fcc63fc3af92d50406e16031112eb72494736dce193ac1fbac0802623496cf81edcd16766e1647d9c4f3a607b3eb84cc50e273b999c04
2022-06-12 13:33:55 +02:00
fanquake
913b1f2a5e
Update secp256k1 subtree to latest upstream master 2022-06-11 14:55:18 +01:00
fanquake
c41bfd1070 Squashed 'src/secp256k1/' changes from 8746600ee..44c2452fd
44c2452fd Merge bitcoin-core/secp256k1#1105: Don't export symbols in static libraries
6f6cab998 abi: Don't export symbols in static Windows libraries
485f608fa Merge bitcoin-core/secp256k1#1104: Fix the false positive of `SECP_64BIT_ASM_CHECK`
8b013fce5 Merge bitcoin-core/secp256k1#1056: Save negations in var-time group addition
7efc9835a Fix the false positive of `SECP_64BIT_ASM_CHECK`
2f984ffc4 Save negations in var-time group addition

git-subtree-dir: src/secp256k1
git-subtree-split: 44c2452fd387f7ca604ab42d73746e7d3a44d8a2
2022-06-11 14:55:18 +01:00
fanquake
fbae8c59a2
compat: Consolidate mingw-w64 ASLR workaround for upstream libsecp changes
Achieve this by adding a MAIN_FUNCTION macro, consolidating the docs, and
introducing the macro across our distributed binaries.

Also update the docs to explain that anyone using binutils < 2.36 is
effected by this issue. Release builds are not, because they use binutils
2.37. Currently LTS Linux distros, like Ubuntu Focal, ship with 2.34.

https://packages.ubuntu.com/focal/binutils
2022-06-11 14:55:13 +01:00
Martin Zumsande
99b9e5f3a9 p2p: always set nTime for self-advertisements
If we self-advertised to an inbound peer with the address they gave us,
nTime was left default-initialized, so that our peer wouldn't relay it
any further along.
2022-06-10 10:50:07 -04:00
MacroFake
8f3ab9a1b1
Merge bitcoin/bitcoin#24931: Strengthen thread safety assertions
ce893c0497 doc: Update developer notes (Anthony Towns)
d2852917ee sync.h: Imply negative assertions when calling LOCK (Anthony Towns)
bba87c0553 scripted-diff: Convert global Mutexes to GlobalMutexes (Anthony Towns)
a559509a0b sync.h: Add GlobalMutex type (Anthony Towns)
be6aa72f9f qt/clientmodel: thread safety annotation for m_cached_tip_mutex (Anthony Towns)
f24bd45b37 net_processing: thread safety annotation for m_tx_relay_mutex (Anthony Towns)

Pull request description:

  This changes `LOCK(mutex)` for non-global, non-recursive mutexes to be annotated with the negative capability for the mutex it refers to, to prevent . clang applies negative capabilities recursively, so this helps avoid forgetting to annotate functions.

  This can't reasonably be used for globals, because clang would require every function to be annotated with `EXCLUSIVE_LOCKS_REQUIRED(!g_mutex)` for each global mutex; so this introduces a trivial `GlobalMutex` subclass of `Mutex`, and reduces the annotations for both `GlobalMutex`  to `LOCKS_EXCLUDED` which only catches trivial errors (eg (`LOCK(x); LOCK(x);`).

ACKs for top commit:
  MarcoFalke:
    review ACK ce893c0497 🐦
  hebasto:
    ACK ce893c0497

Tree-SHA512: 5c35e8c7677ce3d994a7e3774f4344adad496223a51b3a1d1d3b5f20684b2e1d5cff688eb3fbc8d33e1b9940dfa76e515f9434e21de6f3ce3c935e29a319f529
2022-06-10 16:42:53 +02:00
Oskar Mendel
1cb42aeda3
util: modify Win32LockedPageAllocator to query windows for limit 2022-06-10 14:44:23 +02:00
fanquake
491bb14c0c
build: test for timingsafe_bcmp
Code introduced in #15649 added usage of `timingsafe_bcmp()`, if
available, otherwise falling back to our own implementation. However
the relevant build system check was never added, so currently, we'll
always just use our implementation, as HAVE_TIMINGSAFE_BCMP will never
be defined.

Add the check for timingsafe_bcmp. Note that as far as I'm aware, it's
only available on OpenBSD.
2022-06-10 12:39:08 +01:00
Vasil Dimov
6e68ccbefe
net: use Sock::WaitMany() instead of CConnman::SocketEvents()
Rename `GenerateSelectSet()` to `GenerateWaitSockets()` and adapt it to
generate a wait data suitable for `Sock::WaitMany()`. Then call it from
`CConnman::SocketHandler()` and feed the generated data to
`Sock::WaitMany()`.

This way `CConnman::SocketHandler()` can be unit tested because
`Sock::WaitMany()` is mockable, so the usage of real sockets can be
avoided.

Resolves https://github.com/bitcoin/bitcoin/issues/21744
2022-06-09 16:20:24 +02:00
fanquake
e3c08eb620
Merge bitcoin/bitcoin#25307: doc: fix typo in kernel/context.h and add desig to ignore-words
d575413fb8 doc: add `desig` to ignore-words (brunoerg)
c06cc41ddb doc: fix typo in kernel/context.h (brunoerg)

Pull request description:

  This PR fixes a typo in `kernel/context.h` (libary => library) and add `desig` to ignore-words since it's a valid word, see:
  b9416c3847/src/net.cpp (L1105-L1117)

ACKs for top commit:
  fanquake:
    ACK d575413fb8

Tree-SHA512: 2d548c737b8184d0243445c7503f3f68256ecb0970bd834d52de099de3cd8c8b9c140e2b77d55e2542fbd45b1d21cbdee639f5b2ef8138c37b8b72e5211029c3
2022-06-09 13:24:00 +01:00
Vasil Dimov
ae263460ba
net: introduce Sock::WaitMany()
It allows waiting concurrently on more than one socket. Being a
`virtual` `Sock` method it can be overriden by tests.

Will be used to replace `CConnman::SocketEvents()`.
2022-06-09 14:20:18 +02:00
Vasil Dimov
cc74459768
net: also wait for exceptional events in Sock::Wait()
This mimics closely `CConnman::SocketEvents()` and the underlying
`poll(2)`.
2022-06-09 13:34:27 +02:00
fanquake
9edc5133d4
Merge bitcoin/bitcoin#25303: refactor: Remove redundant addrman time checks
8888bd43c1 Remove redundant nLastTry check (MarcoFalke)
00001e57fe Remove redundant nTime checks (MarcoFalke)

Pull request description:

  Split out from https://github.com/bitcoin/bitcoin/pull/24697 because it makes sense on its own.

ACKs for top commit:
  dergoegge:
    re-ACK 8888bd43c1
  naumenkogs:
    utACK 8888bd43c1

Tree-SHA512: 32c6cde1c71e943c76b7991c2c24caf29ae467ab4ea2d758483a0cee64625190d1a833b468e8eab1f834beeb2c365af96552c14b05270f08cf63790e0707581d
2022-06-09 12:28:25 +01:00
furszy
fd5c996d16
wallet: GetAvailableBalance, remove double walk-through every available coin
Filtering `AvailableCoins` by spendable outputs only and using the retrieved total_amount.
2022-06-08 11:30:26 -03:00
furszy
162d4ad10f
wallet: add 'only_spendable' filter to AvailableCoins
We are skipping the non-spendable coins that appear in vCoins ('AvailableCoins' result) later, in several parts of the CreateTransaction and GetBalance flows:

GetAvailableBalance (1) gets all the available coins calling AvailableCoins and, right away, walk through the entire vector, skipping the non-spendable coins, to calculate the total balance.

Inside CreateTransactionInternal —> SelectCoins(vCoins,...), we have several calls to AttemptSelection which, on each of them internally, we call twice to GroupOutputs which internally has two for-loops over the entire vCoins vector that skip the non-spendable coins.

So, Purpose is not add the non-spendable coins into the AvailableCoins result (vCoins) in the first place for the processes that aren’t using them at all, so we don’t waste resources skipping them later so many times.

Note: this speedup is for all the processes that call to CreateTransaction and GetBalance* internally.
2022-06-08 11:30:25 -03:00
furszy
cdf185ccfb
wallet: remove unused IsSpentKey(hash, index) method 2022-06-08 11:22:40 -03:00
furszy
4b83bf8dbc
wallet: avoid extra IsSpentKey -> GetWalletTx lookups 2022-06-08 11:22:40 -03:00
furszy
3d8a282257
wallet: decouple IsSpentKey(scriptPubKey) from IsSpentKey(hash, n)
This will be used in a follow-up commit to prevent extra 'GetWalletTx' lookups if the function caller already have the wtx and can just provide the scriptPubKey directly.
2022-06-08 11:22:39 -03:00
furszy
a06fa94ff8
wallet: IsSpent, 'COutPoint' arg instead of (hash, index) 2022-06-08 11:22:39 -03:00
furszy
91902b7720
wallet: IsLockedCoin, 'COutPoint' arg instead of (hash, index) 2022-06-08 10:26:48 -03:00
furszy
9472ca0a65
wallet: AvailableCoins, don't call 'wtx.tx->vout[i]' multiple times 2022-06-08 10:25:51 -03:00
furszy
4ce235ef8f
wallet: return 'CoinsResult' struct in AvailableCoins
Instead of accepting a `vCoins` reference that is cleared at the beginning of the method.

Note:
This new struct, down the commits line, will contain other `AvailableCoins` useful results.
2022-06-08 10:25:16 -03:00
brunoerg
c06cc41ddb doc: fix typo in kernel/context.h 2022-06-08 10:03:43 -03:00
Jon Atack
ecff20db28 logging: use LogPrintfCategory rather than a manual category
Here we update only the log messages that manually print a category.

In upcoming commits, LogPrintCategory will likely be used in many
other cases, such as to replace `LogPrintf` where it makes sense.
2022-06-08 14:02:54 +02:00
Jon Atack
eb8aab759f logging: add LogPrintfCategory to log unconditionally with category
prefixing the output with the passed category name.

- add documentation
- add a unit test
- update lint-logs.py
- update lint-format-strings.py
2022-06-08 14:02:54 +02:00
MarcoFalke
8888bd43c1
Remove redundant nLastTry check
All other places calculate "now - nLastTry", which is safe and correct
to do when nLastTry is 0. So do the same here.
2022-06-08 13:35:32 +02:00
fanquake
b9416c3847
Merge bitcoin/bitcoin#25096: [net] Minor improvements to addr caching
292828cd77 [test] Test addr cache for multiple onion binds (dergoegge)
3382905bef [net] Seed addr cache randomizer with port from binding address (dergoegge)
f10e80b6e4 [net] Use ConnectedThroughNetwork() instead of GetNetwork() to seed addr cache randomizer (dergoegge)

Pull request description:

  The addr cache id randomizer is currently supposed to be seeded with the network of the inbound connection and the local socket (only the address is used not the port):  a8098f2cef/src/net.cpp (L2800-L2804)

  For inbound onion connections `CNode::addr.GetNetwork()` returns `NET_UNROUTABLE` and `CNode::addrBind` is set to `127.0.0.1:<onion bind port>`. This results in the same addr cache for all inbound connections on 127.0.0.1 binds.

  To avoid the same addr cache across all onion and other 127.0.0.1 binds, we should seed the addr cache randomizer with the correct network for inbound onion connections (using `CNode::ConnectedThroughNetwork()`) as well as the port of `CNode::addrBind`.

ACKs for top commit:
  sipa:
    utACK 292828cd77
  mzumsande:
    Code Review ACK 292828cd77
  naumenkogs:
    utACK 292828cd77

Tree-SHA512: d0be13bab6bc121c2926d4b168687f6c2ed4ce0c9dd19be71eb4886adeba8afc3daacdc4e232a0ba3b03a89d69b618abc5595b69abd1ad0c476d825bc6ea1f9f
2022-06-08 11:21:38 +01:00
MarcoFalke
00001e57fe
Remove redundant nTime checks
nTime is always initialized on deserialization or default-initialized
with TIME_INIT, so special casing 0 does not make sense.
2022-06-08 09:17:39 +02:00
Ben Woosley
241c4d047e
doc: Correct comment describing value of MAX_FILE_SIZE_PSBT as in MiB
100 MiB is 100 * (10224 ** 2), or 107,374,182,400 bytes.
2022-06-07 15:49:07 -05:00
darosior
64f81a38b9
doc: Correct nPruneTarget misidentifying units of variable 2022-06-07 15:30:16 -05:00
Andrew Chow
79cabe3a5b
Merge bitcoin/bitcoin#25239: wallet: 'CommitTransaction', remove extra wtx lookup and add exception for db write error
57fb37c275 wallet: CommitTransaction, remove extra wtx lookup and add exception for a possible db write error. (furszy)

Pull request description:

  Two points for `CWallet::CommitTransaction`:

  1) The extra wtx lookup:
      As we are calling to `AddToWallet` first, which returns the recently added/updated wtx pointer, there is no need to look up the wtx again few lines later. We can just use it.

  2) The db write error:
      `AddToWallet` can only return a nullptr if the db write fails, which inside `CommitTransaction` translates to an exception throw cause. We expect everywhere that `CommitTransaction` always succeed.

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

  Extra note:
  This finding generated another working path for me :)
   It starts with the following question: why are we returning a nullptr from `AddToWallet` if the db write failed without removing the recently added transaction from the wallet's map?..
   Can led to a wallet invalid state where the inputs of this new transaction are not marked dirty, while the transaction that spends them still exist on the in-memory wallet tx map.
  -- I'm writing it here to gather some feedback first and not forget it, will create a follow-up PR in the coming days 🚜 --

ACKs for top commit:
  achow101:
    ACK 57fb37c275
  jonatack:
    ACK 57fb37c
  ryanofsky:
    Code review ACK 57fb37c275. Seems like a clear improvement. Better to fail earlier with a better error message if the failure is going to happen anyway

Tree-SHA512: 80e59c01852cfbbc70a5de1a1c2c59b5e572f9eaa08c2175112cb515256e63fa04c7942f92a513b620d6b06e66392029ebe8902287c456efdbee58a7a5ae42da
2022-06-07 15:02:53 -04:00
laanwj
d8ae504448
Merge bitcoin/bitcoin#25245: refactor: Remove no-op TIME_INIT on deser
fa243e9313 Remove no-op TIME_INIT on deser (MarcoFalke)

Pull request description:

  Split out from https://github.com/bitcoin/bitcoin/pull/24697

ACKs for top commit:
  laanwj:
    ACK fa243e9313
  fanquake:
    ACK fa243e9313

Tree-SHA512: 3b92578a291279d04ac1b274807a6e4ee7a342e3527cc03d90223a1dbc4961668ddb572e40aff85171600a5a3cb2572188c0d75f757a3db8a441c1103eb66e84
2022-06-07 19:42:13 +02:00
MacroFake
45d8b1e94a
Merge bitcoin/bitcoin#25286: scripted-diff: remove duplicate categories from LogPrint output
d40550d725 scripted-diff: remove duplicate categories from LogPrint output (Jon Atack)

Pull request description:

  This is the first commit from #25203.

  - Scripted-diff: de-duplicate logging category output for the tor, i2p, net, zmq, and prune messages (e.g. where I found duplicates), as these category prefixes are now printed automatically since #24464

  examples before
  ```
  [tor] tor: Successfully connected!
  [i2p] I2P: Creating SAM session with 127.0.0.1:7656
  [zmq] zmq: Initialize notification interface
  [net] net: enabling extra block-relay-only peers
  ```
  after
  ```
  [tor] Successfully connected!
  [i2p] Creating SAM session with 127.0.0.1:7656
  [zmq] Initialize notification interface
  [net] enabling extra block-relay-only peers
  ```

ACKs for top commit:
  klementtan:
    crACK d40550d725
  MarcoFalke:
    cr ACK d40550d725

Tree-SHA512: 63b799f2f899f0597981dd1acb91ef4439cd00b257a9eb19d67c4ce2c4dc72a95ac5761cb78f2a19090a10be74f23ea1db6929ed942ba0d008b4be563f0d5e7e
2022-06-07 11:33:58 +02:00
MacroFake
2ab4a80480
Merge bitcoin/bitcoin#25254: Move minRelayTxFee to policy/settings
fa4068b4e2 Move minRelayTxFee to policy/settings (MacroFake)

Pull request description:

  Seems a bit confusing to put policy stuff into validation, so fix that.

  Also fix includes via `iwyu`.

ACKs for top commit:
  ariard:
    ACK fa4068b, the includes move compiles well locally.
  ryanofsky:
    Code review ACK fa4068b4e2. Make sense to move the global variable to policy/settings and the default constant to policy/policy. Ariard points out other constants that could be moved, which seems fine, but it seems like moving the global variable to be with other related global variables is more significant.

Tree-SHA512: adf9619002610d1877f3aef0a9e6115fc4c2ad64135a3e5100824c650b560c47f47ac28894c6214a50a7888355252a9f6f7cec98c23a771a1964160ef1ca77de
2022-06-07 11:31:10 +02:00
MacroFake
581e2bdbac
Merge bitcoin/bitcoin#24629: Bugfix: RPC/blockchain: pruneblockchain: Return the height of the actual last pruned block
e593ae07c4 Bugfix: RPC/blockchain: pruneblockchain: Return the height of the actual last pruned block (Luke Dashjr)

Pull request description:

  From 0.14 (2017 Mar) until before 0.19 (2019 Nov), the height of the last block pruned was returned, subject to a bug if there were blocks left unpruned due to sharing files with later blocks.

  In #15991, this was "fixed" to the current implementation, introducing a new bug: now, it returns the first *unpruned* block.

  Since the user provides the parameter as a block to include in pruning, it makes more sense to fix the behaviour to match the documentation.

  ~~(Additionally, the description of "pruneheight" in getblockchaininfo is fixed to be technically correct)~~

ACKs for top commit:
  fjahr:
    utACK e593ae07c4
  ryanofsky:
    Code review ACK e593ae07c4. Just rebased since last review. Maybe some of the original reviewers of #15991 will want to take a look at this to correct the mistake that was introduced there!

Tree-SHA512: c2d511df80682d57260aae8af1665f9d7eaed16448f185f4c9f23c78fa9b8289a02053da7a0b83643fef57610d601ea63b59ff39661a51f4827f1eb27cc30594
2022-06-07 08:04:51 +02:00
Carl Dong
0f1a259657 miner: Make mempool optional for BlockAssembler
...also adjust callers

Changes:

- In BlockAssembler::CreateNewBlock, we now only lock m_mempool->cs and
  call addPackageTxs if m_mempool is not nullptr
- BlockAssembler::addPackageTxs now takes in a mempool reference, and is
  annotated to require that mempool's lock.
- In TestChain100Setup::CreateBlock and generateblock, don't construct
  an empty mempool, just pass in a nullptr for mempool
2022-06-06 15:38:09 -04:00
laanwj
06ea2783a2
Merge bitcoin/bitcoin#25220: rpc: fix incorrect warning for address type p2sh-segwit in createmultisig
3a9b9bb38e test: ensure createmultisig and addmultisigaddress are not returning any warning for expected cases (brunoerg)
eaf6f630c0 rpc: fix inappropriate warning for address type p2sh-segwit in createmultisig and addmultisigaddress (brunoerg)

Pull request description:

  Fixes #25127

  If there are any uncompressed keys when calling `AddAndGetMultisigDestination`, it will just default to a legacy address regardless of the chosen `address_type`. So, #23113 added a warnings field which will warn the user why their address format is different.

  However, when creating a multisig (p2sh-segwit), it is returning an inappropriate warning, because when getting the output type from destination (`OutputTypeFromDestination`), it returns `ScriptHash` for both legacy and `P2SH_SEGWIT`. So, since `P2SH_SEGWIT` is different from `ScriptHash`, it returns the warning:
  192d639a6b/src/rpc/output_script.cpp (L166-L169)

  So, to avoid this mistake I changed `OutputTypeFromDestination` to `descriptor->GetOutputType()` to get the appropriate output type.

ACKs for top commit:
  jonatack:
    ACK 3a9b9bb38e
  laanwj:
    Code review ACK 3a9b9bb38e

Tree-SHA512: 49f717479c2b8906277e7591ddd4747f7961c2d5c77494b5124045de9036a4277d46b9ad99279d51f0c4484284c445f1e1d3c55c49bbf0716741bad426a89369
2022-06-06 17:13:22 +02:00
MacroFake
e82d8069bc
Merge bitcoin/bitcoin#25276: doc: Fix typo in importdescriptors
210cd592cd doc: Fix typo in importdescriptors (Kolby Moroz Liebl)

Pull request description:

ACKs for top commit:
  1440000bytes:
    ACK 210cd592cd
  LarryRuane:
    ACK 210cd592cd
  brunoerg:
    crACK 210cd592cd

Tree-SHA512: 39ff9777b05abc1a68c8c3e646e00b0672838696c567c582d0492baa753863231447fd8439bd41cd8a8b8ba752299b032e839c8862c02faa2bdc207a9a7a8540
2022-06-06 15:54:30 +02:00
brunoerg
eaf6f630c0 rpc: fix inappropriate warning for address type p2sh-segwit in createmultisig and addmultisigaddress 2022-06-06 09:46:02 -03:00
Jon Atack
d40550d725 scripted-diff: remove duplicate categories from LogPrint output
-BEGIN VERIFY SCRIPT-
s() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; }
s 'BCLog::TOR, "tor: '       'BCLog::TOR, "'
s 'BCLog::I2P, "I2P: '       'BCLog::I2P, "'
s 'BCLog::NET, "net: '       'BCLog::NET, "'
s 'BCLog::ZMQ, "zmq: '       'BCLog::ZMQ, "'
s 'BCLog::PRUNE, "Prune: '   'BCLog::PRUNE, "'
-END VERIFY SCRIPT-
2022-06-06 12:12:03 +02:00
Hennadii Stepanov
ce1c8104aa
build: Remove unused LIBBITCOIN_KERNEL variable 2022-06-05 21:43:13 +02:00
Hennadii Stepanov
1b2e1d179c
Merge bitcoin-core/gui#614: Drop no longer supported Android architecture
d1b7bcbca2 qt: Drop no longer supported Android architecture (Hennadii Stepanov)

Pull request description:

  The `i686-linux-android` arch support has been dropped since bitcoin/bitcoin#23744.

ACKs for top commit:
  katesalazar:
    ACK d1b7bcbca2
  icota:
    utACK d1b7bcbca2
  prusnak:
    Approach ACK d1b7bcbca2

Tree-SHA512: 13689ec8c63c92b9a52a3c25edc35536b8e51ff583f57c45b168515f928d020d6bb85d03db9efd8d5efd57b944dfd313a89f5ff8a52f99982ccc8d9671f6e7a9
2022-06-05 14:29:29 +02:00
Kolby Moroz Liebl
210cd592cd
doc: Fix typo in importdescriptors 2022-06-04 18:48:30 -06:00
fanquake
695ca641a4
Merge bitcoin/bitcoin#24860: Miniscript integration follow-ups
f3a50c9dfe miniscript: rename IsSane and IsSaneSubexpression to prevent misuse (Antoine Poinsot)
c5fe5163dc miniscript: nit: don't return after assert(false) (Antoine Poinsot)
7bbaca9d8d miniscript: explicit the threshold size computation in multi() (Antoine Poinsot)
8323e4249d miniscript: add an OpCode typedef for readability (Antoine Poinsot)
7a549c6c59 miniscript: mark nodes with duplicate keys as insane (Antoine Poinsot)
8c0f8bf7bc fuzz: add a Miniscript target for string representation roundtripping (Antoine Poinsot)
be34d5077b fuzz: rename and improve the Miniscript Script roundtrip target (Antoine Poinsot)
7eb70f0ac0 miniscript: tiny doc fixups (Antoine Poinsot)
5cea85f12c miniscript: split ValidSatisfactions from IsSane (Antoine Poinsot)
a0f064dc14 miniscript: introduce a CheckTimeLocksMix helper (Antoine Poinsot)
ed45ee3882 miniscript: use optional instead of bool/outarg (Antoine Poinsot)
1ab8d89fd1 miniscript: make equality operator non-recursive (Antoine Poinsot)
5922c662c0 scripted-diff: miniscript: rename 'nodetype' variables to 'fragment' (Antoine Poinsot)
c5f65db0f0 miniscript: remove a workaround for a GCC 4.8 bug (Antoine Poinsot)

Pull request description:

  The Miniscript repository and the Miniscript integration PR here have been a moving target for the past months, and some final cleanups were done there that were not included here. I initially intended to add some small followup commits to #24148 but i think there are enough of them to be worth a followup PR on its own.

  Some parts of the code did not change since it was initially written in 2019, and the code could use some modernization. (Use std::optional instead of out args, remove old compiler workarounds).
  We refactored the helpers to be more meaningful, and also did some renaming. A new fuzz target was also added and both were merged in a single file. 2 more will be added in #24149 that will be contained in this file too.

  The only behaviour change in this PR is to rule out Miniscript with duplicate keys from sane Miniscripts. In a P2WSH context, signatures can be rebounded (Miniscript does not use CODESEPARATOR) and it's reasonable to assume that reusing keys across the Script drops the malleability guarantees.
  It was previously assumed such Miniscript would never exist in the first place since a compiler should never create them. We finally agreed that if one were to exist (say, written by hand or from a buggy compiler) it would be very confusing if an imported Miniscript descriptor (after #24148) with duplicate keys was deemed sane (ie, "safe to use") by Bitcoin Core. We now check for duplicate keys in the constructor.

  This is (still) joint work with Pieter Wuille. (Actually he entirely authored the cleanups and code modernization.)

ACKs for top commit:
  sipa:
    utACK f3a50c9dfe (with the caveat that a lot of it is my own code)
  sanket1729:
    code review ACK f3a50c9dfe. Did not review the fuzz tests.

Tree-SHA512: c043325e4936fe25e8ece4266b46119e000c6745f88cea530fed1edf01c80f03ee6f9edc83b6e9d42ca01688d184bad16bfd967c5bb8037744e726993adf3deb
2022-06-04 20:54:20 +01:00
fanquake
aac9c259b0
Merge bitcoin/bitcoin#25065: [kernel 2c/n] Introduce kernel::Context, encapsulate global init/teardown
d87784ac87 kernel: SanityChecks: Return an error struct (Carl Dong)
265d6393bf Move init::SanityCheck to kernel::SanityCheck (Carl Dong)
fed085a1a4 init: Initialize globals with kernel::Context's life (Carl Dong)
7d03feef81 kernel: Introduce empty and unused kernel::Context (Carl Dong)
eeb4fc20c5 test: Use Set/UnsetGlobals in BasicTestingSetup (Carl Dong)

Pull request description:

  The full `init/common.cpp` is dependent on things like ArgsManager (which we wish to remove from libbitcoinkernel in the future) and sanity checks. These aren't necessary for libbitcoinkernel so we only extract the portion that is necessary (namely `init::{Set,Unset}Globals()`.

ACKs for top commit:
  theuni:
    ACK d87784ac87
  vasild:
    ACK d87784ac87

Tree-SHA512: cd6b4923ea1865001b5f0caed9a4ff99c198d22bf74154d935dc09a47fda22ebe585ec912398cea69f722454ed1dbb4898faab5a2d02fb4c5e719c5c8d71a3f9
2022-06-04 20:25:57 +01:00
Hennadii Stepanov
d1b7bcbca2
qt: Drop no longer supported Android architecture 2022-06-04 11:42:26 +02:00
Luke Dashjr
e593ae07c4 Bugfix: RPC/blockchain: pruneblockchain: Return the height of the actual last pruned block
From 0.14 (2017 Mar) until before 0.19 (2019 Nov), the height of the last
block pruned was returned, subject to a bug if there were blocks left unpruned
due to sharing files with later blocks.

In #15991, this was "fixed" to the current implementation, introducing a new
bug: now, it returns the first *unpruned* block.

Since the user provides the parameter as a block to include in pruning, it
makes more sense to fix the behaviour to match the documentation.
2022-06-03 07:20:07 +00:00