Skip to content

[pull] master from bitcoin:master#704

Merged
pull[bot] merged 11 commits intoorngr:masterfrom
bitcoin:master
Mar 18, 2026
Merged

[pull] master from bitcoin:master#704
pull[bot] merged 11 commits intoorngr:masterfrom
bitcoin:master

Conversation

@pull
Copy link

@pull pull bot commented Mar 18, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

MarcoFalke and others added 11 commits March 10, 2026 11:01
This makes it easier to use mock-time in tests. Also, it resets the
global mocktime, so that no state is leaked between test cases.
This refactor does not change any behavior.

However, it is nice to know that no global mocktime leaks from the fuzz
init step to the first fuzz input, or from one fuzz input execution to
the next.
With the clock context, the global is re-set at the end of the context.
Initially only move skip_type_check there.

In the future, more options can be added, without having to touch the
constructors.
This prepares the function to be more flexible, when more options are
passed in the future.
This should fix #34367

I am not familiar with Windows sockets thread-safety, but creating the
event loop on the main thread, and running it in the network thread
could lead to a fast abort in Python on Windows (without any stderr):

```
77/276 - wallet_txn_clone.py failed, Duration: 1 s

stdout:
2025-12-10T08:04:27.500134Z TestFramework (INFO): PRNG seed is: 4018092284830106117

stderr:

Combine the logs and print the last 99999999 lines ...
============
Combined log for D:\a\_temp/test_runner_₿_🏃_20251210_075632/wallet_txn_clone_196:
============
 test  2025-12-10T08:04:27.500134Z TestFramework (INFO): PRNG seed is: 4018092284830106117
 test  2025-12-10T08:04:27.500433Z TestFramework (DEBUG): Setting up network thread
```

Also, I couldn't find any docs that require the loop must be created on
the thread that runs them:

* https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.new_event_loop
* https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_forever

However, the patch seems trivial to review, harmless, and easy to
revert, so it may be a good try to fix the intermittent Windows Python
crash.
For RPCResults, the type may be ELISION, which is confusing and brittle:

* The elision should only affect the help output, not the type.
* The type should be the real type, so that type checks can be run on
  it.

Fix this issue by introducing a new print_elision option and using it
in decodepsbt.

This change will ensure that RPCResult::MatchesType is properly run.
Also, this clarifies the RPC output minimally:

```diff
--- a/decodepsbt
+++ b/decodepsbt
@@ -35,7 +35,7 @@ Result:
   "inputs" : [                             (json array)
     {                                      (json object)
       "non_witness_utxo" : {               (json object, optional) Decoded network transaction for non-witness UTXOs
-        ...
+        ...                                The layout is the same as the output of decoderawtransaction.
       },
       "witness_utxo" : {                   (json object, optional) Transaction output for witness UTXOs
         "amount" : n,                      (numeric) The value in BTC
```
faea12e test: Fixup docs for NodeClockContext and SteadyClockContext (MarcoFalke)
eeeeb2a fuzz: Use NodeClockContext (MarcoFalke)
fa4fae6 test: Add NodeClockContext (MarcoFalke)

Pull request description:

  Iterating over fuzz inputs will usually be done in the same process. As the mocktime is global, it can theoretically leak from one fuzz input run into the next run, making it less deterministic.

  Fix this issue, by adding and using a context manager to handle the mocktime and reset it before the end.

  This refactor should not change any behavior.

ACKs for top commit:
  seduless:
    re-ACK faea12e
  dergoegge:
    utACK faea12e
  brunoerg:
    code review ACK faea12e

Tree-SHA512: e222c4e4217a504d058b30f1e975dfdfff019363c82385bd62f368b16fb029c46a5d1b43cd773dbdd9efcd7f968d46dbe2c75812971696b1b879b8f081fc6b1b
…syncio.WindowsSelectorEventLoopPolicy(), move loop creation

fa050da test: Move event loop creation to network thread (MarcoFalke)
fa9168f test: Use asyncio.SelectorEventLoop() over deprecated asyncio.WindowsSelectorEventLoopPolicy() (MarcoFalke)

Pull request description:

  It is deprecated according to https://docs.python.org/3.14/library/asyncio-policy.html#asyncio.WindowsSelectorEventLoopPolicy The replacement exists since python 3.7

  Also, move the event loop creation to happen in the thread that runs the loop.

ACKs for top commit:
  l0rinc:
    ACK fa050da
  sedited:
    ACK fa050da

Tree-SHA512: dce25596a04e8f133630d84c03a770185a81b1bcd0aae975f0dbdd579d22b7b79a9b1172abf46c61d0845d3f5ab4a6414fa0f17c59f0ea0f6fa9bdcac085a2a7
fadf901 rpc: Run type check on decodepsbt result (MarcoFalke)
fa4d589 refactor: Introduce TxDocOptions (MarcoFalke)
fa8250e refactor: Add and use RPCResultOptions (MarcoFalke)

Pull request description:

  For RPCResults, the type may be ELISION, which is confusing and brittle:

  * The elision should only affect the help output, not the type.
  * The type should be the real type, so that type checks can be run on it.

  Fix this issue by introducing a new print_elision option and using it in `decodepsbt`.

  This change will ensure that `RPCResult::MatchesType` is properly run.

  Can be tested by introducing a bug:

  ```diff
  diff --git a/src/core_io.cpp b/src/core_io.cpp
  index 7492e9c..4927b70c8e 100644
  --- a/src/core_io.cpp
  +++ b/src/core_io.cpp
  @@ -436,2 +436,3 @@ void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry
       entry.pushKV("version", tx.version);
  +    entry.pushKV("bug", "error!");
       entry.pushKV("size", tx.ComputeTotalSize());
  ```
  And then running (in a debug build) `decodepsbt cHNidP8BAAoCAAAAAAAAAAAAAA==`

  Before, on master: passes
  Now, on this pull: Properly detects the bug

ACKs for top commit:
  nervana21:
    tACK fadf901
  achow101:
    ACK fadf901
  willcl-ark:
    ACK fadf901
  satsfy:
    re-ACK fadf901
  seduless:
    re-ACK fadf901

Tree-SHA512: 4fb000dba9fe39bcd2bac72e2d88553f54134a250c985b4ca7150b483d7185009047d8fe4ba75c522bfc26706de20c913b8905e7552ab0c41802ae744cb92038
@pull pull bot locked and limited conversation to collaborators Mar 18, 2026
@pull pull bot added the ⤵️ pull label Mar 18, 2026
@pull pull bot merged commit d81b562 into orngr:master Mar 18, 2026
1 of 6 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants