rpc: improve error format

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
This commit is contained in:
Vincenzo Palazzo
2022-07-12 10:55:02 +01:00
committed by Christian Decker
parent 1d671a2380
commit 7ae616ef60
4 changed files with 25 additions and 68 deletions

View File

@@ -2722,9 +2722,12 @@ def test_checkmessage_pubkey_not_found(node_factory):
pubkey = "03be3b0e9992153b1d5a6e1623670b6c3663f72ce6cf2e0dd39c0a373a7de5a3b7"
zbase = "d66bqz3qsku5fxtqsi37j11pci47ydxa95iusphutggz9ezaxt56neh77kxe5hyr41kwgkncgiu94p9ecxiexgpgsz8daoq4tw8kj8yx"
with pytest.raises(RpcError, match="not found in the graph, expected pubkey is {}".format(pubkey)):
with pytest.raises(RpcError) as exception:
l1.rpc.checkmessage(msg, zbase)
err = exception.value
assert err.error['message'] == "pubkey not found in the graph"
assert err.error['data']['claimed_key'] == pubkey
check_result = l1.rpc.checkmessage(msg, zbase, pubkey=pubkey)
assert check_result["pubkey"] == pubkey
assert check_result["verified"] is True
assert check_result["verified"] is True