diff --git a/lightningd/pay.c b/lightningd/pay.c index 8043b04cb..ff6f49964 100644 --- a/lightningd/pay.c +++ b/lightningd/pay.c @@ -978,6 +978,11 @@ send_payment(struct lightningd *ld, if (!final_tlv && payment_secret) final_tlv = true; + /* Parallel payments are invalid for legacy. */ + if (partid && !final_tlv) + return command_fail(cmd, PAY_DESTINATION_PERM_FAIL, + "Cannot do parallel payments to legacy node"); + onion = onion_final_hop(cmd, final_tlv, route[i].amount, @@ -1306,6 +1311,10 @@ static struct command_result *json_sendpay(struct command *cmd, } #endif + if (*partid && !payment_secret) + return command_fail(cmd, JSONRPC2_INVALID_PARAMS, + "partid requires payment_secret"); + return send_payment(cmd->ld, cmd, rhash, *partid, route, route[routetok->size-1].amount, diff --git a/tests/test_pay.py b/tests/test_pay.py index 009a7cb4f..9b3198278 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -2570,6 +2570,7 @@ def test_sendonion_rpc(node_factory): @unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1") +@unittest.skipIf(not EXPERIMENTAL_FEATURES, "needs partid support") def test_partial_payment(node_factory, bitcoind, executor): # We want to test two payments at the same time, before we send commit l1, l2, l3, l4 = node_factory.get_nodes(4, [{}] + [{'disconnect': ['=WIRE_UPDATE_ADD_HTLC-nocommit']}] * 2 + [{}])