Skip to content

Conversation

@Rob1Ham
Copy link
Owner

@Rob1Ham Rob1Ham commented Nov 8, 2025

To be clear - for visualization purposes only, for the love of Satoshi do not do anything with this code that touches even regtest.

luke-jr and others added 30 commits November 7, 2025 21:34
…to reduce data push size limit to 256 bytes (except for P2SH redeemScript push)
…l never), limit non-OP_RETURN scripts to 34 bytes
…BLE_WITNESS_PROGRAM,UPGRADABLE_TAPROOT_VERSION,OP_SUCCESS}
…AM,UPGRADABLE_TAPROOT_VERSION,OP_SUCCESS} on blocks when DEPLOYMENT_REDUCED_DATA is active (never yet)
Github-Pull: bitcoin#10532
Rebased-From: cd74a23fcf9588199e196ab31bc64972400c2027
… risk

Github-Pull: bitcoin#10532
Rebased-From: e42a2f6beb61df3e3a201804cf3bcce6b00c88ba
3c853b6299 and others added 17 commits November 7, 2025 21:51
…imit; add reduced_data deployment name to allow regtest RPC access for testing
…DUCED_DATA); adapt 6 tests to NODE_BIP148 service flag; add assert_equal_without_usage helper for testmempoolaccept results
…eviction threshold

The test was failing because commit 58a329b changed gen_return_txouts()
from using 1 large OP_RETURN output to 734 small OP_RETURN outputs (to
comply with the new MAX_OUTPUT_SCRIPT_SIZE=34 consensus rule in bip444).

This change altered how fill_mempool() fills the mempool, raising the
eviction threshold from ~0.68 sat/vB to ~1.10 sat/vB. The test's
create_package_2p1c() was using hardcoded feerates (1.0 and 2.0 sat/vB),
causing parent1 to be below the new eviction threshold and get rejected.

Solution: Calculate parent feerates dynamically based on the actual
mempoolminfee after fill_mempool() runs. This makes the test robust to
future changes in mempool dynamics.

- Store mempoolminfee in raise_network_minfee()
- Use 2x and 4x mempoolminfee for parent1 and parent2 feerates
- Add logging to show the calculated feerates

Test results with fix:
- mempoolminfee: 1.101 sat/vB
- parent1: 2.202 sat/vB (2x threshold) → accepted ✓
- parent2: 4.404 sat/vB (4x threshold) → accepted ✓
The test was expecting services string ending with "nwl2?" but now
receives "nwl1" because NODE_BIP148 is advertised (BIP148 service bit
is represented as "1" in the services string).

Updated regex pattern from "nwl2?" to "nwl[12]?" to accept both the
BIP148 service bit (1) and any other service bits that may be represented
as (2).
…coding

The test was expecting addrv2 messages to be 187 bytes, but they're now
227 bytes due to the BIP148 service bit being added to P2P_SERVICES.

P2P_SERVICES is now NODE_NETWORK | NODE_WITNESS | NODE_BIP148 = 0x08000009,
which requires 5 bytes in CompactSize encoding (not 1 byte as before).

Updated calc_addrv2_msg_size() to properly calculate the services field
size using ser_compact_size() instead of assuming 1 byte.

Difference: 5 bytes - 1 byte = 4 bytes per address × 10 addresses = 40 bytes
187 + 40 = 227 bytes ✓
The addpeeraddress RPC was creating addresses with only NODE_NETWORK |
NODE_WITNESS, but the node requires NODE_BIP148 for outbound connections
(added in commit c684ff1 from 2017).

ThreadOpenConnections filters addresses using HasAllDesirableServiceFlags,
which requires NODE_NETWORK | NODE_WITNESS | NODE_BIP148. Addresses
without NODE_BIP148 are skipped entirely, making addpeeraddress useless
for its intended testing purpose.

This fix updates addpeeraddress to match production requirements, allowing
test-added addresses to actually be used for outbound connections.

Fixes p2p_seednode.py test which was failing because addresses added via
addpeeraddress were being filtered out, preventing "trying v1 connection"
log messages from appearing.
…gin from reduced_data script validation rules
Adapt unit tests to comply with REDUCED_DATA restrictions:
- Add REDUCED_DATA flag to mapFlagNames in transaction_tests
- Update witness test from 520-byte to 256-byte push limit
- Accept SCRIPT_ERR_PUSH_SIZE in miniscript satisfaction tests
- Update Taproot tree depth tests from 128 to 7 levels
- Fix descriptor error message to report correct nesting limit (7)

REDUCED_DATA enforces MAX_SCRIPT_ELEMENT_SIZE_REDUCED (256 bytes)
and TAPROOT_CONTROL_MAX_NODE_COUNT_REDUCED (7 levels) at the
policy level via STANDARD_SCRIPT_VERIFY_FLAGS.
Replace thresh(2,pk(...),s:pk(...),adv:older(42)) with
and_v(v:pk(...),pk(...)) because thresh() uses OP_IF opcodes
which are completely forbidden in Tapscript when REDUCED_DATA
is active (see src/script/interpreter.cpp:621-623).

The and_v() construction provides equivalent 2-of-2 multisig
functionality without conditional branching, making it
compatible with REDUCED_DATA restrictions.

Also update line 1010 test to expect "tr() supports at most 7
nesting levels" error instead of multi() error, as the test's
22 opening braces exceed REDUCED_DATA's 7-level limit before
the parser can discover the multi() error.
Add NODE_BIP444 flag to GetDesirableServiceFlags assertions in
peerman_tests and to service flags in denialofservice_tests and
net_tests peer setup.

NODE_BIP444 (bit 27) signals BIP444/REDUCED_DATA enforcement and
is now included in desirable service flags alongside NODE_NETWORK
and NODE_WITNESS for peer connections.
Comment on lines +340 to +347
NODE_UTREEXO_TMP = (1 << 24),

NODE_REPLACE_BY_FEE = (1 << 26),

// NODE_BIP444 means the node enforces BIP 444 rules as applicable
NODE_BIP444 = (1 << 27),

NODE_MALICIOUS = (1 << 29),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its interesting utreexo stuff somehow ended up in here. Also NODE_MALICIOUS? Was that part of the bip444 implementation?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repo is me cherry picking all UASF commits and just dropping them on v30 with llms doing auto merge conflicts.

here it is in the original proposed uasf code: https://github.com/UASF/bitcoin/blob/e5100daf50eea365f0930fbdb00a973cd0bc1371/src/protocol.cpp#L107

Copy link
Owner Author

@Rob1Ham Rob1Ham Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dathon told me it's a knots service bit that rejects libre relay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants