2015-06-12 04:39:05 +02:00
|
|
|
#ifndef LIGHTNING_PROTOBUF_CONVERT_H
|
|
|
|
#define LIGHTNING_PROTOBUF_CONVERT_H
|
2016-01-21 21:08:08 +01:00
|
|
|
#include "config.h"
|
|
|
|
#include "lightning.pb-c.h"
|
2016-01-21 21:11:47 +01:00
|
|
|
#include "secp256k1.h"
|
2015-06-12 04:39:05 +02:00
|
|
|
#include <ccan/tal/tal.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
/* Convert to-from protobuf to internal representation. */
|
|
|
|
struct signature;
|
|
|
|
Signature *signature_to_proto(const tal_t *ctx, const struct signature *sig);
|
|
|
|
bool proto_to_signature(const Signature *pb, struct signature *sig);
|
|
|
|
|
|
|
|
/* Convert to-from protobuf to internal representation. */
|
|
|
|
struct pubkey;
|
|
|
|
BitcoinPubkey *pubkey_to_proto(const tal_t *ctx, const struct pubkey *key);
|
2016-01-21 21:11:47 +01:00
|
|
|
bool proto_to_pubkey(secp256k1_context *secpctx,
|
|
|
|
const BitcoinPubkey *pb, struct pubkey *key);
|
2015-06-12 04:39:05 +02:00
|
|
|
|
|
|
|
/* Useful helper for allocating & populating a protobuf Sha256Hash */
|
|
|
|
struct sha256;
|
|
|
|
Sha256Hash *sha256_to_proto(const tal_t *ctx, const struct sha256 *hash);
|
|
|
|
void proto_to_sha256(const Sha256Hash *pb, struct sha256 *hash);
|
2015-06-12 05:23:49 +02:00
|
|
|
|
2016-06-28 23:19:20 +02:00
|
|
|
struct rval {
|
|
|
|
u8 r[32];
|
|
|
|
};
|
|
|
|
Rval *rval_to_proto(const tal_t *ctx, const struct rval *r);
|
|
|
|
void proto_to_rval(const Rval *pb, struct rval *r);
|
|
|
|
|
2016-01-21 21:08:08 +01:00
|
|
|
struct rel_locktime;
|
|
|
|
struct abs_locktime;
|
|
|
|
bool proto_to_rel_locktime(const Locktime *l, struct rel_locktime *locktime);
|
|
|
|
bool proto_to_abs_locktime(const Locktime *l, struct abs_locktime *locktime);
|
2016-01-21 21:08:08 +01:00
|
|
|
Locktime *rel_locktime_to_proto(const tal_t *ctx,
|
|
|
|
const struct rel_locktime *locktime);
|
|
|
|
Locktime *abs_locktime_to_proto(const tal_t *ctx,
|
|
|
|
const struct abs_locktime *locktime);
|
2015-06-12 04:39:05 +02:00
|
|
|
#endif /* LIGHTNING_PROTOBUF_CONVERT_H */
|