mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 22:45:27 +01:00
lightningd: remove deprecated behavior where checkmessage would fail quietly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Removed: JSON-RPC: `checkmessage` now always returns an error when the pubkey is not specified and it is unknown in the network graph (deprecated v0.12.0)
This commit is contained in:
parent
1c4f6ab2c5
commit
06b9009dd8
2 changed files with 13 additions and 9 deletions
|
@ -134,9 +134,10 @@ static void listnodes_done(const char *buffer,
|
||||||
if (t)
|
if (t)
|
||||||
t = json_get_member(buffer, t, "nodes");
|
t = json_get_member(buffer, t, "nodes");
|
||||||
|
|
||||||
if (!deprecated_apis && (!t || t->size == 0)) {
|
if (!t || t->size == 0) {
|
||||||
response = json_stream_fail(can->cmd, SIGNMESSAGE_PUBKEY_NOT_FOUND,
|
response = json_stream_fail(can->cmd,
|
||||||
"pubkey not found in the graph");
|
SIGNMESSAGE_PUBKEY_NOT_FOUND,
|
||||||
|
"pubkey not found in the graph");
|
||||||
json_add_node_id(response, "claimed_key", &can->id);
|
json_add_node_id(response, "claimed_key", &can->id);
|
||||||
json_object_end(response);
|
json_object_end(response);
|
||||||
was_pending(command_failed(can->cmd, response));
|
was_pending(command_failed(can->cmd, response));
|
||||||
|
|
|
@ -2011,8 +2011,7 @@ def test_relative_config_dir(node_factory):
|
||||||
|
|
||||||
|
|
||||||
def test_signmessage(node_factory):
|
def test_signmessage(node_factory):
|
||||||
l1, l2 = node_factory.line_graph(2, wait_for_announce=True,
|
l1, l2 = node_factory.line_graph(2, wait_for_announce=True)
|
||||||
opts={'allow-deprecated-apis': True})
|
|
||||||
l1.rpc.jsonschemas = {}
|
l1.rpc.jsonschemas = {}
|
||||||
|
|
||||||
corpus = [[None,
|
corpus = [[None,
|
||||||
|
@ -2049,13 +2048,17 @@ def test_signmessage(node_factory):
|
||||||
|
|
||||||
assert l1.rpc.checkmessage(c[1], c[2], c[3])['verified']
|
assert l1.rpc.checkmessage(c[1], c[2], c[3])['verified']
|
||||||
assert not l1.rpc.checkmessage(c[1] + "modified", c[2], c[3])['verified']
|
assert not l1.rpc.checkmessage(c[1] + "modified", c[2], c[3])['verified']
|
||||||
checknokey = l1.rpc.checkmessage(c[1], c[2])
|
|
||||||
# Of course, we know our own pubkey
|
# Of course, we know our own pubkey
|
||||||
if c[3] == l1.info['id']:
|
if c[3] == l1.info['id']:
|
||||||
assert checknokey['verified']
|
assert l1.rpc.checkmessage(c[1], c[2])['verified']
|
||||||
else:
|
else:
|
||||||
assert not checknokey['verified']
|
# It will error, as it can't verify.
|
||||||
assert checknokey['pubkey'] == c[3]
|
with pytest.raises(RpcError, match="pubkey not found in the graph") as err:
|
||||||
|
l1.rpc.checkmessage(c[1], c[2])
|
||||||
|
|
||||||
|
# But error contains the key which it claims.
|
||||||
|
assert err.value.error['data']['claimed_key'] == c[3]
|
||||||
|
|
||||||
# l2 knows about l1, so it can validate it.
|
# l2 knows about l1, so it can validate it.
|
||||||
zm = l1.rpc.signmessage(message="message for you")['zbase']
|
zm = l1.rpc.signmessage(message="message for you")['zbase']
|
||||||
|
|
Loading…
Add table
Reference in a new issue