From 13356b75bfb56cd855360c3488bd52cec8974c5a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 15 May 2020 20:02:02 +0930 Subject: [PATCH] wire: move towire/fromwire_amount from wire/ into common/amount.c Signed-off-by: Rusty Russell --- cli/test/run-large-input.c | 12 +++++++++++ cli/test/run-remove-hint.c | 12 +++++++++++ common/amount.c | 30 ++++++++++++++++++++++++++- common/amount.h | 5 +++++ common/test/run-amount.c | 12 +++++------ common/test/run-funding_tx.c | 6 ------ common/test/run-gossip_rcvd_filter.c | 3 +++ common/test/run-sphinx.c | 12 +++++++++++ onchaind/test/run-grind_feerate-bug.c | 12 +++++------ onchaind/test/run-grind_feerate.c | 12 +++++------ wire/fromwire.c | 16 -------------- wire/test/run-peer-wire.c | 20 +----------------- wire/towire.c | 10 --------- wire/wire.h | 4 ---- 14 files changed, 92 insertions(+), 74 deletions(-) diff --git a/cli/test/run-large-input.c b/cli/test/run-large-input.c index e1b3cf794..91e7dec3e 100644 --- a/cli/test/run-large-input.c +++ b/cli/test/run-large-input.c @@ -57,6 +57,12 @@ size_t bigsize_get(const u8 *p UNNEEDED, size_t max UNNEEDED, bigsize_t *val UNN /* Generated stub for bigsize_put */ size_t bigsize_put(u8 buf[BIGSIZE_MAX_LEN] UNNEEDED, bigsize_t v UNNEEDED) { fprintf(stderr, "bigsize_put called!\n"); abort(); } +/* Generated stub for fromwire_amount_msat */ +struct amount_msat fromwire_amount_msat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) +{ fprintf(stderr, "fromwire_amount_msat called!\n"); abort(); } +/* Generated stub for fromwire_amount_sat */ +struct amount_sat fromwire_amount_sat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) +{ fprintf(stderr, "fromwire_amount_sat called!\n"); abort(); } /* Generated stub for fromwire_channel_id */ void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct channel_id *channel_id UNNEEDED) @@ -83,6 +89,12 @@ void json_object_end(struct json_stream *js UNNEEDED) /* Generated stub for json_object_start */ void json_object_start(struct json_stream *ks UNNEEDED, const char *fieldname UNNEEDED) { fprintf(stderr, "json_object_start called!\n"); abort(); } +/* Generated stub for towire_amount_msat */ +void towire_amount_msat(u8 **pptr UNNEEDED, const struct amount_msat msat UNNEEDED) +{ fprintf(stderr, "towire_amount_msat called!\n"); abort(); } +/* Generated stub for towire_amount_sat */ +void towire_amount_sat(u8 **pptr UNNEEDED, const struct amount_sat sat UNNEEDED) +{ fprintf(stderr, "towire_amount_sat called!\n"); abort(); } /* Generated stub for towire_channel_id */ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "towire_channel_id called!\n"); abort(); } diff --git a/cli/test/run-remove-hint.c b/cli/test/run-remove-hint.c index f535dc929..d7c1b02a9 100644 --- a/cli/test/run-remove-hint.c +++ b/cli/test/run-remove-hint.c @@ -60,6 +60,12 @@ size_t bigsize_get(const u8 *p UNNEEDED, size_t max UNNEEDED, bigsize_t *val UNN /* Generated stub for bigsize_put */ size_t bigsize_put(u8 buf[BIGSIZE_MAX_LEN] UNNEEDED, bigsize_t v UNNEEDED) { fprintf(stderr, "bigsize_put called!\n"); abort(); } +/* Generated stub for fromwire_amount_msat */ +struct amount_msat fromwire_amount_msat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) +{ fprintf(stderr, "fromwire_amount_msat called!\n"); abort(); } +/* Generated stub for fromwire_amount_sat */ +struct amount_sat fromwire_amount_sat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) +{ fprintf(stderr, "fromwire_amount_sat called!\n"); abort(); } /* Generated stub for fromwire_channel_id */ void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct channel_id *channel_id UNNEEDED) @@ -86,6 +92,12 @@ void json_object_end(struct json_stream *js UNNEEDED) /* Generated stub for json_object_start */ void json_object_start(struct json_stream *ks UNNEEDED, const char *fieldname UNNEEDED) { fprintf(stderr, "json_object_start called!\n"); abort(); } +/* Generated stub for towire_amount_msat */ +void towire_amount_msat(u8 **pptr UNNEEDED, const struct amount_msat msat UNNEEDED) +{ fprintf(stderr, "towire_amount_msat called!\n"); abort(); } +/* Generated stub for towire_amount_sat */ +void towire_amount_sat(u8 **pptr UNNEEDED, const struct amount_sat sat UNNEEDED) +{ fprintf(stderr, "towire_amount_sat called!\n"); abort(); } /* Generated stub for towire_channel_id */ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "towire_channel_id called!\n"); abort(); } diff --git a/common/amount.c b/common/amount.c index e989d69a6..028b31763 100644 --- a/common/amount.c +++ b/common/amount.c @@ -7,6 +7,7 @@ #include #include #include +#include bool amount_sat_to_msat(struct amount_msat *msat, struct amount_sat sat) @@ -473,6 +474,33 @@ struct amount_sat amount_asset_to_sat(struct amount_asset *amount) { struct amount_sat sats; assert(amount_asset_is_main(amount)); - sats.satoshis = amount->value; /* Raw: low-level conversion */ + sats.satoshis = amount->value; return sats; } + +struct amount_msat fromwire_amount_msat(const u8 **cursor, size_t *max) +{ + struct amount_msat msat; + + msat.millisatoshis = fromwire_u64(cursor, max); + return msat; +} + +struct amount_sat fromwire_amount_sat(const u8 **cursor, size_t *max) +{ + struct amount_sat sat; + + sat.satoshis = fromwire_u64(cursor, max); + return sat; +} + +void towire_amount_msat(u8 **pptr, const struct amount_msat msat) +{ + towire_u64(pptr, msat.millisatoshis); +} + +void towire_amount_sat(u8 **pptr, const struct amount_sat sat) +{ + towire_u64(pptr, sat.satoshis); +} + diff --git a/common/amount.h b/common/amount.h index 8bd7cd4ef..792fba891 100644 --- a/common/amount.h +++ b/common/amount.h @@ -168,4 +168,9 @@ bool parse_amount_msat(struct amount_msat *msat, const char *s, size_t slen); */ bool parse_amount_sat(struct amount_sat *sat, const char *s, size_t slen); +/* Marshal/unmarshal functions */ +struct amount_msat fromwire_amount_msat(const u8 **cursor, size_t *max); +struct amount_sat fromwire_amount_sat(const u8 **cursor, size_t *max); +void towire_amount_msat(u8 **pptr, const struct amount_msat msat); +void towire_amount_sat(u8 **pptr, const struct amount_sat sat); #endif /* LIGHTNING_COMMON_AMOUNT_H */ diff --git a/common/test/run-amount.c b/common/test/run-amount.c index a5b6285f1..d4a348650 100644 --- a/common/test/run-amount.c +++ b/common/test/run-amount.c @@ -7,9 +7,6 @@ /* Generated stub for fromwire */ const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) { fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for fromwire_amount_sat */ -struct amount_sat fromwire_amount_sat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_amount_sat called!\n"); abort(); } /* Generated stub for fromwire_fail */ const void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_fail called!\n"); abort(); } @@ -28,15 +25,15 @@ u8 *fromwire_tal_arrn(const tal_t *ctx UNNEEDED, /* Generated stub for fromwire_u16 */ u16 fromwire_u16(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_u16 called!\n"); abort(); } +/* Generated stub for fromwire_u64 */ +u64 fromwire_u64(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) +{ fprintf(stderr, "fromwire_u64 called!\n"); abort(); } /* Generated stub for fromwire_u8 */ u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_u8 called!\n"); abort(); } /* Generated stub for towire */ void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) { fprintf(stderr, "towire called!\n"); abort(); } -/* Generated stub for towire_amount_sat */ -void towire_amount_sat(u8 **pptr UNNEEDED, const struct amount_sat sat UNNEEDED) -{ fprintf(stderr, "towire_amount_sat called!\n"); abort(); } /* Generated stub for towire_secp256k1_ecdsa_signature */ void towire_secp256k1_ecdsa_signature(u8 **pptr UNNEEDED, const secp256k1_ecdsa_signature *signature UNNEEDED) @@ -47,6 +44,9 @@ void towire_sha256_double(u8 **pptr UNNEEDED, const struct sha256_double *sha256 /* Generated stub for towire_u16 */ void towire_u16(u8 **pptr UNNEEDED, u16 v UNNEEDED) { fprintf(stderr, "towire_u16 called!\n"); abort(); } +/* Generated stub for towire_u64 */ +void towire_u64(u8 **pptr UNNEEDED, u64 v UNNEEDED) +{ fprintf(stderr, "towire_u64 called!\n"); abort(); } /* Generated stub for towire_u8 */ void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED) { fprintf(stderr, "towire_u8 called!\n"); abort(); } diff --git a/common/test/run-funding_tx.c b/common/test/run-funding_tx.c index a19c4ff70..ec8f30d0a 100644 --- a/common/test/run-funding_tx.c +++ b/common/test/run-funding_tx.c @@ -21,9 +21,6 @@ /* Generated stub for fromwire */ const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) { fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for fromwire_amount_sat */ -struct amount_sat fromwire_amount_sat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_amount_sat called!\n"); abort(); } /* Generated stub for fromwire_bool */ bool fromwire_bool(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_bool called!\n"); abort(); } @@ -63,9 +60,6 @@ u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) /* Generated stub for towire */ void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) { fprintf(stderr, "towire called!\n"); abort(); } -/* Generated stub for towire_amount_sat */ -void towire_amount_sat(u8 **pptr UNNEEDED, const struct amount_sat sat UNNEEDED) -{ fprintf(stderr, "towire_amount_sat called!\n"); abort(); } /* Generated stub for towire_bool */ void towire_bool(u8 **pptr UNNEEDED, bool v UNNEEDED) { fprintf(stderr, "towire_bool called!\n"); abort(); } diff --git a/common/test/run-gossip_rcvd_filter.c b/common/test/run-gossip_rcvd_filter.c index af404afdd..f9446db03 100644 --- a/common/test/run-gossip_rcvd_filter.c +++ b/common/test/run-gossip_rcvd_filter.c @@ -27,6 +27,9 @@ bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) /* Generated stub for bigsize_get */ size_t bigsize_get(const u8 *p UNNEEDED, size_t max UNNEEDED, bigsize_t *val UNNEEDED) { fprintf(stderr, "bigsize_get called!\n"); abort(); } +/* Generated stub for fromwire_amount_sat */ +struct amount_sat fromwire_amount_sat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) +{ fprintf(stderr, "fromwire_amount_sat called!\n"); abort(); } /* Generated stub for memleak_remove_htable */ void memleak_remove_htable(struct htable *memtable UNNEEDED, const struct htable *ht UNNEEDED) { fprintf(stderr, "memleak_remove_htable called!\n"); abort(); } diff --git a/common/test/run-sphinx.c b/common/test/run-sphinx.c index f73bc74ec..fe41a8096 100644 --- a/common/test/run-sphinx.c +++ b/common/test/run-sphinx.c @@ -50,9 +50,21 @@ size_t bigsize_put(u8 buf[BIGSIZE_MAX_LEN] UNNEEDED, bigsize_t v UNNEEDED) /* Generated stub for ecdh */ void ecdh(const struct pubkey *point UNNEEDED, struct secret *ss UNNEEDED) { fprintf(stderr, "ecdh called!\n"); abort(); } +/* Generated stub for fromwire_amount_msat */ +struct amount_msat fromwire_amount_msat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) +{ fprintf(stderr, "fromwire_amount_msat called!\n"); abort(); } +/* Generated stub for fromwire_amount_sat */ +struct amount_sat fromwire_amount_sat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) +{ fprintf(stderr, "fromwire_amount_sat called!\n"); abort(); } /* Generated stub for pubkey_from_node_id */ bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED) { fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); } +/* Generated stub for towire_amount_msat */ +void towire_amount_msat(u8 **pptr UNNEEDED, const struct amount_msat msat UNNEEDED) +{ fprintf(stderr, "towire_amount_msat called!\n"); abort(); } +/* Generated stub for towire_amount_sat */ +void towire_amount_sat(u8 **pptr UNNEEDED, const struct amount_sat sat UNNEEDED) +{ fprintf(stderr, "towire_amount_sat called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ extern secp256k1_context *secp256k1_ctx; diff --git a/onchaind/test/run-grind_feerate-bug.c b/onchaind/test/run-grind_feerate-bug.c index a99e3b37d..36a07586a 100644 --- a/onchaind/test/run-grind_feerate-bug.c +++ b/onchaind/test/run-grind_feerate-bug.c @@ -30,9 +30,6 @@ bool dump_memleak(struct htable *memtable UNNEEDED) /* Generated stub for fromwire */ const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) { fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for fromwire_amount_sat */ -struct amount_sat fromwire_amount_sat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_amount_sat called!\n"); abort(); } /* Generated stub for fromwire_fail */ const void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_fail called!\n"); abort(); } @@ -75,6 +72,9 @@ u8 *fromwire_tal_arrn(const tal_t *ctx UNNEEDED, /* Generated stub for fromwire_u16 */ u16 fromwire_u16(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_u16 called!\n"); abort(); } +/* Generated stub for fromwire_u64 */ +u64 fromwire_u64(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) +{ fprintf(stderr, "fromwire_u64 called!\n"); abort(); } /* Generated stub for fromwire_u8 */ u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_u8 called!\n"); abort(); } @@ -208,9 +208,6 @@ u8 *to_self_wscript(const tal_t *ctx UNNEEDED, /* Generated stub for towire */ void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) { fprintf(stderr, "towire called!\n"); abort(); } -/* Generated stub for towire_amount_sat */ -void towire_amount_sat(u8 **pptr UNNEEDED, const struct amount_sat sat UNNEEDED) -{ fprintf(stderr, "towire_amount_sat called!\n"); abort(); } /* Generated stub for towire_hsm_get_per_commitment_point */ u8 *towire_hsm_get_per_commitment_point(const tal_t *ctx UNNEEDED, u64 n UNNEEDED) { fprintf(stderr, "towire_hsm_get_per_commitment_point called!\n"); abort(); } @@ -269,6 +266,9 @@ void towire_sha256_double(u8 **pptr UNNEEDED, const struct sha256_double *sha256 /* Generated stub for towire_u16 */ void towire_u16(u8 **pptr UNNEEDED, u16 v UNNEEDED) { fprintf(stderr, "towire_u16 called!\n"); abort(); } +/* Generated stub for towire_u64 */ +void towire_u64(u8 **pptr UNNEEDED, u64 v UNNEEDED) +{ fprintf(stderr, "towire_u64 called!\n"); abort(); } /* Generated stub for towire_u8 */ void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED) { fprintf(stderr, "towire_u8 called!\n"); abort(); } diff --git a/onchaind/test/run-grind_feerate.c b/onchaind/test/run-grind_feerate.c index ac5330336..c537f2d71 100644 --- a/onchaind/test/run-grind_feerate.c +++ b/onchaind/test/run-grind_feerate.c @@ -31,9 +31,6 @@ bool dump_memleak(struct htable *memtable UNNEEDED) /* Generated stub for fromwire */ const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) { fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for fromwire_amount_sat */ -struct amount_sat fromwire_amount_sat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_amount_sat called!\n"); abort(); } /* Generated stub for fromwire_fail */ const void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_fail called!\n"); abort(); } @@ -76,6 +73,9 @@ u8 *fromwire_tal_arrn(const tal_t *ctx UNNEEDED, /* Generated stub for fromwire_u16 */ u16 fromwire_u16(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_u16 called!\n"); abort(); } +/* Generated stub for fromwire_u64 */ +u64 fromwire_u64(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) +{ fprintf(stderr, "fromwire_u64 called!\n"); abort(); } /* Generated stub for fromwire_u8 */ u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_u8 called!\n"); abort(); } @@ -223,9 +223,6 @@ u8 *to_self_wscript(const tal_t *ctx UNNEEDED, /* Generated stub for towire */ void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) { fprintf(stderr, "towire called!\n"); abort(); } -/* Generated stub for towire_amount_sat */ -void towire_amount_sat(u8 **pptr UNNEEDED, const struct amount_sat sat UNNEEDED) -{ fprintf(stderr, "towire_amount_sat called!\n"); abort(); } /* Generated stub for towire_hsm_get_per_commitment_point */ u8 *towire_hsm_get_per_commitment_point(const tal_t *ctx UNNEEDED, u64 n UNNEEDED) { fprintf(stderr, "towire_hsm_get_per_commitment_point called!\n"); abort(); } @@ -287,6 +284,9 @@ void towire_sha256_double(u8 **pptr UNNEEDED, const struct sha256_double *sha256 /* Generated stub for towire_u16 */ void towire_u16(u8 **pptr UNNEEDED, u16 v UNNEEDED) { fprintf(stderr, "towire_u16 called!\n"); abort(); } +/* Generated stub for towire_u64 */ +void towire_u64(u8 **pptr UNNEEDED, u64 v UNNEEDED) +{ fprintf(stderr, "towire_u64 called!\n"); abort(); } /* Generated stub for towire_u8 */ void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED) { fprintf(stderr, "towire_u8 called!\n"); abort(); } diff --git a/wire/fromwire.c b/wire/fromwire.c index 9b068d7b2..143345bd7 100644 --- a/wire/fromwire.c +++ b/wire/fromwire.c @@ -320,22 +320,6 @@ void fromwire_siphash_seed(const u8 **cursor, size_t *max, fromwire(cursor, max, seed, sizeof(*seed)); } -struct amount_msat fromwire_amount_msat(const u8 **cursor, size_t *max) -{ - struct amount_msat msat; - - msat.millisatoshis = fromwire_u64(cursor, max); /* Raw: primitive */ - return msat; -} - -struct amount_sat fromwire_amount_sat(const u8 **cursor, size_t *max) -{ - struct amount_sat sat; - - sat.satoshis = fromwire_u64(cursor, max); /* Raw: primitive */ - return sat; -} - void fromwire_bip32_key_version(const u8** cursor, size_t *max, struct bip32_key_version *version) { diff --git a/wire/test/run-peer-wire.c b/wire/test/run-peer-wire.c index c12a3478f..2a49f06a8 100644 --- a/wire/test/run-peer-wire.c +++ b/wire/test/run-peer-wire.c @@ -1,6 +1,7 @@ #include "../towire.c" #include "../fromwire.c" #include "../peer_wire.c" +#include "common/amount.c" #include "common/channel_id.c" #include @@ -16,25 +17,6 @@ extern secp256k1_context *secp256k1_ctx; /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ /* memsetting pubkeys doesn't work */ diff --git a/wire/towire.c b/wire/towire.c index 4807da5d5..caa8d6d15 100644 --- a/wire/towire.c +++ b/wire/towire.c @@ -198,16 +198,6 @@ void towire_siphash_seed(u8 **pptr, const struct siphash_seed *seed) towire(pptr, seed, sizeof(*seed)); } -void towire_amount_msat(u8 **pptr, const struct amount_msat msat) -{ - towire_u64(pptr, msat.millisatoshis); /* Raw: primitive */ -} - -void towire_amount_sat(u8 **pptr, const struct amount_sat sat) -{ - towire_u64(pptr, sat.satoshis); /* Raw: primitive */ -} - void towire_bip32_key_version(u8 **pptr, const struct bip32_key_version *version) { towire_u32(pptr, version->bip32_pubkey_version); diff --git a/wire/wire.h b/wire/wire.h index b2693df2e..7236c0b7d 100644 --- a/wire/wire.h +++ b/wire/wire.h @@ -51,8 +51,6 @@ void towire_short_channel_id_dir(u8 **pptr, void towire_sha256(u8 **pptr, const struct sha256 *sha256); void towire_sha256_double(u8 **pptr, const struct sha256_double *sha256d); void towire_ripemd160(u8 **pptr, const struct ripemd160 *ripemd); -void towire_amount_msat(u8 **pptr, const struct amount_msat msat); -void towire_amount_sat(u8 **pptr, const struct amount_sat sat); void towire_u8(u8 **pptr, u8 v); void towire_u16(u8 **pptr, u16 v); void towire_u32(u8 **pptr, u32 v); @@ -100,8 +98,6 @@ void fromwire_sha256(const u8 **cursor, size_t *max, struct sha256 *sha256); void fromwire_sha256_double(const u8 **cursor, size_t *max, struct sha256_double *sha256d); void fromwire_ripemd160(const u8 **cursor, size_t *max, struct ripemd160 *ripemd); -struct amount_msat fromwire_amount_msat(const u8 **cursor, size_t *max); -struct amount_sat fromwire_amount_sat(const u8 **cursor, size_t *max); void fromwire_pad(const u8 **cursor, size_t *max, size_t num); void fromwire_u8_array(const u8 **cursor, size_t *max, u8 *arr, size_t num);