2015-06-12 04:23:27 +02:00
|
|
|
#ifndef LIGHTNING_BITCOIN_PUBKEY_H
|
|
|
|
#define LIGHTNING_BITCOIN_PUBKEY_H
|
2015-06-02 04:23:59 +02:00
|
|
|
#include <ccan/short_types/short_types.h>
|
|
|
|
#include <ccan/tal/tal.h>
|
2015-06-12 04:23:27 +02:00
|
|
|
#include "../lightning.pb-c.h"
|
2015-06-02 04:23:59 +02:00
|
|
|
|
|
|
|
struct pubkey {
|
|
|
|
u8 key[65];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Convert to-from protobuf to internal representation. */
|
|
|
|
BitcoinPubkey *pubkey_to_proto(const tal_t *ctx, const struct pubkey *key);
|
|
|
|
bool proto_to_pubkey(const BitcoinPubkey *pb, struct pubkey *key);
|
|
|
|
|
|
|
|
/* 33 or 65 bytes? */
|
|
|
|
size_t pubkey_len(const struct pubkey *key);
|
|
|
|
|
2015-06-05 04:54:58 +02:00
|
|
|
/* Convert from hex string (scriptPubKey from validateaddress) */
|
|
|
|
bool pubkey_from_hexstr(const char *str, struct pubkey *key);
|
|
|
|
|
2015-06-02 04:23:59 +02:00
|
|
|
#endif /* LIGHTNING_PUBKEY_H */
|