mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
pytest: test for compat code.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
4d0a97e1bd
commit
65f5bb2638
2 changed files with 19 additions and 2 deletions
|
@ -419,7 +419,8 @@ static struct command_result *check_previous_invoice(struct command *cmd,
|
|||
/* BOLT-offers #12:
|
||||
* - MUST fail the request if `signature` is not correct.
|
||||
*/
|
||||
static bool check_payer_sig(const struct tlv_invoice_request *invreq,
|
||||
static bool check_payer_sig(struct command *cmd,
|
||||
const struct tlv_invoice_request *invreq,
|
||||
const struct point32 *payer_key,
|
||||
const struct bip340sig *sig)
|
||||
{
|
||||
|
@ -436,6 +437,8 @@ static bool check_payer_sig(const struct tlv_invoice_request *invreq,
|
|||
return false;
|
||||
|
||||
/* Try old name */
|
||||
plugin_log(cmd->plugin, LOG_DBG,
|
||||
"Testing invoice_request with old name 'payer_signature'");
|
||||
sighash_from_merkle("invoice_request", "payer_signature",
|
||||
&merkle, &sighash);
|
||||
|
||||
|
@ -728,7 +731,7 @@ static struct command_result *listoffers_done(struct command *cmd,
|
|||
err = invreq_must_have(cmd, ir, signature);
|
||||
if (err)
|
||||
return err;
|
||||
if (!check_payer_sig(ir->invreq,
|
||||
if (!check_payer_sig(cmd, ir->invreq,
|
||||
ir->invreq->payer_key,
|
||||
ir->invreq->signature)) {
|
||||
return fail_invreq(cmd, ir, "bad signature");
|
||||
|
|
|
@ -4453,6 +4453,20 @@ def test_offer(node_factory, bitcoind):
|
|||
assert 'recurrence: every 600 seconds paywindow -10 to +600 (pay proportional)\n' in output
|
||||
|
||||
|
||||
def test_deprecated_offer(node_factory, bitcoind):
|
||||
"""Test that we allow old invreq name `payer_signature` with deprecated_apis"""
|
||||
l1, l2 = node_factory.line_graph(2, opts={'experimental-offers': None,
|
||||
'allow-deprecated-apis': True})
|
||||
|
||||
offer = l2.rpc.call('offer', {'amount': 10000,
|
||||
'description': 'test'})['bolt12']
|
||||
|
||||
inv = l1.rpc.call('fetchinvoice', {'offer': offer})['invoice']
|
||||
l2.daemon.wait_for_log("Testing invoice_request with old name 'payer_signature'")
|
||||
|
||||
l1.rpc.pay(inv)
|
||||
|
||||
|
||||
@pytest.mark.developer("dev-no-modern-onion is DEVELOPER-only")
|
||||
def test_fetchinvoice_3hop(node_factory, bitcoind):
|
||||
l1, l2, l3, l4 = node_factory.line_graph(4, wait_for_announce=True,
|
||||
|
|
Loading…
Add table
Reference in a new issue