pyln-testing: allow bitcoind mocks to return None to mean "don't mock".
What changed, and why it matters
This is a small change to a Python testing helper used only in Core Lightning's test suite. It lets a fake Bitcoin RPC call return None as a signal to fall through to the real RPC call. There is no production code affected and no security issue visible in the patch.
No security action needed. Review the follow-up commit referenced as 'next patch' if it is included in the same review batch, as this change is explicitly scaffolding for that later change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In contrib/pyln-testing/pyln/testing/btcproxy.py, the BitcoinRpcProxy mock dispatcher is modified so that if a registered mock function returns None, execution continues to the real underlying RPC instead of returning None to the caller. This is a test-framework-only feature for conditional mocking. No cryptographic, network, or node logic is changed.
Changed components
contrib/pyln-testing/pyln/testing/btcproxy.pyInspect captured patch +4 / −1
diff --git a/contrib/pyln-testing/pyln/testing/btcproxy.py b/contrib/pyln-testing/pyln/testing/btcproxy.py
index 6c599479..5a24d7ba 100644
--- a/contrib/pyln-testing/pyln/testing/btcproxy.py
+++ b/contrib/pyln-testing/pyln/testing/btcproxy.py
@@ -47,7 +47,10 @@ class BitcoinRpcProxy(object):
return ret
elif method in self.mocks and callable(self.mocks[method]):
self.mock_counts[method] += 1
- return self.mocks[method](r)
+ # If a mock returns "None" it means "call the real one"
+ ret = self.mocks[method](r)
+ if ret is not None:
+ return ret
try:
reply = {
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.