mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
pytest: create proper mock failures.
We actually produce an invalid JSON error at the moment: bitcoin-cli complains "JSON value is not an integer as expected" rather than returning the given error. Make our error a valid JSON RPC error. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
27b66997da
commit
2d7c1ed0cf
@ -56,6 +56,7 @@ class BitcoinRpcProxy(object):
|
|||||||
except JSONRPCError as e:
|
except JSONRPCError as e:
|
||||||
reply = {
|
reply = {
|
||||||
"error": e.error,
|
"error": e.error,
|
||||||
|
"code": -32603,
|
||||||
"id": r['id']
|
"id": r['id']
|
||||||
}
|
}
|
||||||
self.request_count += 1
|
self.request_count += 1
|
||||||
|
@ -1112,7 +1112,7 @@ def test_fundee_forget_funding_tx_unconfirmed(node_factory, bitcoind):
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
def mock_sendrawtransaction(r):
|
def mock_sendrawtransaction(r):
|
||||||
return {'error': 'sendrawtransaction disabled'}
|
return {'id': r['id'], 'error': {'code': 100, 'message': 'sendrawtransaction disabled'}}
|
||||||
|
|
||||||
# Prevent funder from broadcasting funding tx (any tx really).
|
# Prevent funder from broadcasting funding tx (any tx really).
|
||||||
l1.daemon.rpcproxy.mock_rpc('sendrawtransaction', mock_sendrawtransaction)
|
l1.daemon.rpcproxy.mock_rpc('sendrawtransaction', mock_sendrawtransaction)
|
||||||
|
Loading…
Reference in New Issue
Block a user