hsmd: roll the definition of simple_htlc into the csv.
This is such a simple struct that we can actually define it in csv. This prevents us from accidentally breaking the ABI in future. I tested this hadn't accidentally changed the wire format by disabling version checks and using an old hsmd with the altered daemons and running the test suite. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
* v5 with preapprove_check: 0ed6dd4ea2c02b67c51b1420b3d07ab2227a4c06ce7e2942d946967687e9baf7
|
||||
* v6 no secret from get_per_commitment_point: 0cad1790beb3473d64355f4cb4f64daa80c28c8a241998b7ef0223385d7ffff9
|
||||
* v6 with sign_bolt12_2 (tweak using node id): 8fcb731279a10af3f95aeb8be1da6b2ced76a1984afa18c5f46a03515d70ea0e
|
||||
* v6 (internal rework only): fba120d3d926de00f0377c4cba91caa89a9eaacb666fd04a5a0e677b4d310d65
|
||||
* v6 (internal rework only): eb34a3d575c2d2a2ed4d70df0858670b066fb8cb75ec8d39d0c996ae195a473b
|
||||
*/
|
||||
#define HSM_MIN_VERSION 5
|
||||
#define HSM_MAX_VERSION 6
|
||||
|
||||
@@ -24,20 +24,6 @@ static struct failed_htlc *failed_htlc_dup(const tal_t *ctx,
|
||||
return newf;
|
||||
}
|
||||
|
||||
struct simple_htlc *new_simple_htlc(const tal_t *ctx,
|
||||
enum side side,
|
||||
struct amount_msat amount,
|
||||
const struct sha256 *payment_hash,
|
||||
u32 cltv_expiry)
|
||||
{
|
||||
struct simple_htlc *simple = tal(ctx, struct simple_htlc);
|
||||
simple->side = side;
|
||||
simple->amount = amount;
|
||||
simple->payment_hash = *payment_hash;
|
||||
simple->cltv_expiry = cltv_expiry;
|
||||
return simple;
|
||||
}
|
||||
|
||||
struct existing_htlc *new_existing_htlc(const tal_t *ctx,
|
||||
u64 id,
|
||||
enum htlc_state state,
|
||||
@@ -113,14 +99,6 @@ void towire_existing_htlc(u8 **pptr, const struct existing_htlc *existing)
|
||||
towire_bool(pptr, false);
|
||||
}
|
||||
|
||||
void towire_simple_htlc(u8 **pptr, const struct simple_htlc *simple)
|
||||
{
|
||||
towire_side(pptr, simple->side);
|
||||
towire_amount_msat(pptr, simple->amount);
|
||||
towire_sha256(pptr, &simple->payment_hash);
|
||||
towire_u32(pptr, simple->cltv_expiry);
|
||||
}
|
||||
|
||||
void towire_fulfilled_htlc(u8 **pptr, const struct fulfilled_htlc *fulfilled)
|
||||
{
|
||||
towire_u64(pptr, fulfilled->id);
|
||||
@@ -217,18 +195,6 @@ struct existing_htlc *fromwire_existing_htlc(const tal_t *ctx,
|
||||
return existing;
|
||||
}
|
||||
|
||||
struct simple_htlc *fromwire_simple_htlc(const tal_t *ctx,
|
||||
const u8 **cursor, size_t *max)
|
||||
{
|
||||
struct simple_htlc *simple = tal(ctx, struct simple_htlc);
|
||||
|
||||
simple->side = fromwire_side(cursor, max);
|
||||
simple->amount = fromwire_amount_msat(cursor, max);
|
||||
fromwire_sha256(cursor, max, &simple->payment_hash);
|
||||
simple->cltv_expiry = fromwire_u32(cursor, max);
|
||||
return simple;
|
||||
}
|
||||
|
||||
void fromwire_fulfilled_htlc(const u8 **cursor, size_t *max,
|
||||
struct fulfilled_htlc *fulfilled)
|
||||
{
|
||||
|
||||
@@ -60,14 +60,6 @@ struct changed_htlc {
|
||||
u64 id;
|
||||
};
|
||||
|
||||
/* For signing interfaces */
|
||||
struct simple_htlc {
|
||||
enum side side;
|
||||
struct amount_msat amount;
|
||||
struct sha256 payment_hash;
|
||||
u32 cltv_expiry;
|
||||
};
|
||||
|
||||
struct existing_htlc *new_existing_htlc(const tal_t *ctx,
|
||||
u64 id,
|
||||
enum htlc_state state,
|
||||
@@ -79,15 +71,8 @@ struct existing_htlc *new_existing_htlc(const tal_t *ctx,
|
||||
const struct preimage *preimage TAKES,
|
||||
const struct failed_htlc *failed TAKES);
|
||||
|
||||
struct simple_htlc *new_simple_htlc(const tal_t *ctx,
|
||||
enum side side,
|
||||
struct amount_msat amount,
|
||||
const struct sha256 *payment_hash,
|
||||
u32 cltv_expiry);
|
||||
|
||||
void towire_added_htlc(u8 **pptr, const struct added_htlc *added);
|
||||
void towire_existing_htlc(u8 **pptr, const struct existing_htlc *existing);
|
||||
void towire_simple_htlc(u8 **pptr, const struct simple_htlc *simple);
|
||||
void towire_fulfilled_htlc(u8 **pptr, const struct fulfilled_htlc *fulfilled);
|
||||
void towire_failed_htlc(u8 **pptr, const struct failed_htlc *failed);
|
||||
void towire_changed_htlc(u8 **pptr, const struct changed_htlc *changed);
|
||||
@@ -98,8 +83,6 @@ void fromwire_added_htlc(const u8 **cursor, size_t *max,
|
||||
struct added_htlc *added);
|
||||
struct existing_htlc *fromwire_existing_htlc(const tal_t *ctx,
|
||||
const u8 **cursor, size_t *max);
|
||||
struct simple_htlc *fromwire_simple_htlc(const tal_t *ctx,
|
||||
const u8 **cursor, size_t *max);
|
||||
void fromwire_fulfilled_htlc(const u8 **cursor, size_t *max,
|
||||
struct fulfilled_htlc *fulfilled);
|
||||
struct failed_htlc *fromwire_failed_htlc(const tal_t *ctx, const u8 **cursor,
|
||||
|
||||
Reference in New Issue
Block a user