2020-12-05 03:23:54 +01:00
|
|
|
#ifndef LIGHTNING_COMMON_BOLT12_MERKLE_H
|
|
|
|
#define LIGHTNING_COMMON_BOLT12_MERKLE_H
|
|
|
|
#include "config.h"
|
2021-01-13 04:00:24 +01:00
|
|
|
#include <common/bolt12.h>
|
2020-12-05 03:23:54 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* merkle_tlv - bolt12-style merkle hash of this tlv minus signature fields
|
|
|
|
* @fields: tal_arr of fields from tlv.
|
|
|
|
* @merkle: returned merkle hash.
|
|
|
|
*/
|
|
|
|
void merkle_tlv(const struct tlv_field *fields, struct sha256 *merkle);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* sighash_from_merkle - bolt12-style signature hash using this merkle root.
|
|
|
|
* @messagename: message name, such as "offer".
|
|
|
|
* @fieldname: field name, such as "recurrence_signature".
|
|
|
|
* @merkle: the merkle root as calculated by merkle_tlv.
|
|
|
|
* @sighash: the returned hash.
|
|
|
|
*/
|
|
|
|
void sighash_from_merkle(const char *messagename,
|
|
|
|
const char *fieldname,
|
|
|
|
const struct sha256 *merkle,
|
|
|
|
struct sha256 *sighash);
|
2020-12-16 04:13:37 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* payer_key_tweak - get the actual tweak to use for a payer_key
|
|
|
|
*/
|
2021-10-08 00:54:42 +02:00
|
|
|
void payer_key_tweak(const struct point32 *bolt12,
|
2020-12-16 04:13:37 +01:00
|
|
|
const u8 *publictweak, size_t publictweaklen,
|
|
|
|
struct sha256 *tweak);
|
|
|
|
|
2020-12-05 03:23:54 +01:00
|
|
|
#endif /* LIGHTNING_COMMON_BOLT12_MERKLE_H */
|