tests/autogenerate-rpc-examples.py: always use largest UTXO for fundchannel example.
What changed, and why it matters
This is a one-line change to a test script that auto-generates example RPC commands for documentation. It sorts a node's available coins by amount and picks the largest one, instead of picking whichever one happened to be listed first. This only affects documentation generation and has no security relevance.
No security action needed. This is a benign test/documentation fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies tests/autogenerate-rpc-examples.py so that when building a fundchannel example using a specific UTXO, the script sorts listfunds() outputs by amount_msat descending and selects the largest. Previously it used the first output returned, which became insufficient after an ordering change elsewhere. The change is purely in test/documentation tooling and does not touch production code, consensus, networking, or wallet logic.
Changed components
tests/autogenerate-rpc-examples.pyInspect captured patch +1 / −1
diff --git a/tests/autogenerate-rpc-examples.py b/tests/autogenerate-rpc-examples.py
index 9441b89c..5f6cd571 100644
--- a/tests/autogenerate-rpc-examples.py
+++ b/tests/autogenerate-rpc-examples.py
@@ -864,7 +864,7 @@ def generate_channels_examples(node_factory, bitcoind, l1, l3, l4, l5):
l3.rpc.connect(l5.info['id'], 'localhost', l5.port)
l4.rpc.connect(l1.info['id'], 'localhost', l1.port)
c35res = update_example(node=l3, method='fundchannel', params={'id': l5.info['id'], 'amount': FUND_CHANNEL_AMOUNT_SAT, 'announce': True})
- outputs = l4.rpc.listfunds()['outputs']
+ outputs = sorted(l4.rpc.listfunds()['outputs'], key=lambda o: o["amount_msat"], reverse=True)
utxo = f"{outputs[0]['txid']}:{outputs[0]['output']}"
c41res = update_example(node=l4, method='fundchannel',
params={'id': l1.info['id'], 'amount': 'all', 'feerate': 'normal', 'push_msat': 100000, 'utxos': [utxo]},
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.