core-lightning/common/descriptor_checksum.h
Antoine Poinsot 419612c4bd common: add a descriptor checksum computation module
This is stolen from William's clightning-dumpkeys (https://github.com/jb55/clightning-dumpkeys),
itself adapted from 42b66a6b81/src/script/descriptor.cpp (L25)

Co-authored-by: William Casarin <jb55@jb55.com>
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2020-11-10 10:34:13 -06:00

17 lines
493 B
C

#ifndef LIGHTNING_COMMON_DESCRIPTOR_CHECKSUM_H
#define LIGHTNING_COMMON_DESCRIPTOR_CHECKSUM_H
#include "config.h"
#include <stdbool.h>
/* https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md#reference */
#define DESCRIPTOR_CHECKSUM_LENGTH 8
struct descriptor_checksum {
char csum[DESCRIPTOR_CHECKSUM_LENGTH + 1];
};
bool descriptor_checksum(const char *descriptor, int desc_size,
struct descriptor_checksum *checksum);
#endif /* LIGHTNING_COMMON_DESCRIPTOR_CHECKSUM_H */