mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
pay: don't require description for hashdesc invoices (i.e. undeprecate).
Since we didn't hash the descriptions properly (see previous commit), we cannot immediately deprecate omitting the descriptions (since you'd have to omit them for backwards compat!). And move the "must have description or hash" test into bolt11.c core. Changelog-Deprecated: `pay` has *undeprecated* paying a description-hash invoice without providing the description. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1053,24 +1053,6 @@ static struct command_result *json_pay(struct command *cmd,
|
||||
cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"Invalid bolt11:"
|
||||
" sets feature var_onion with no secret");
|
||||
|
||||
/* BOLT #11:
|
||||
* A reader:
|
||||
*...
|
||||
* - MUST check that the SHA2 256-bit hash in the `h` field
|
||||
* exactly matches the hashed description.
|
||||
*/
|
||||
if (!b11->description && !deprecated_apis) {
|
||||
if (!b11->description_hash) {
|
||||
return command_fail(cmd,
|
||||
JSONRPC2_INVALID_PARAMS,
|
||||
"Invalid bolt11: missing description");
|
||||
}
|
||||
if (!description)
|
||||
return command_fail(cmd,
|
||||
JSONRPC2_INVALID_PARAMS,
|
||||
"bolt11 uses description_hash, but you did not provide description parameter");
|
||||
}
|
||||
} else {
|
||||
b12 = invoice_decode(tmpctx, b11str, strlen(b11str),
|
||||
plugin_feature_set(cmd->plugin),
|
||||
|
||||
Reference in New Issue
Block a user