Browse Source

configure: make partid payments only available with EXPERIMENTAL_FEATURES and payment_secret

Explicit #if EXPERIMENTAL_FEATURES check in case we enable them at different
times, but it requires a payment_secret since we put them in the same field.

This incidently stops it working on legacy nodes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
travis-debug
Rusty Russell 5 years ago
committed by Christian Decker
parent
commit
63fffd41c8
  1. 9
      lightningd/pay.c
  2. 1
      tests/test_pay.py

9
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,

1
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 + [{}])

Loading…
Cancel
Save