From bc5a8171000d62fdaf15ba7fefff2d750fa6de74 Mon Sep 17 00:00:00 2001 From: niftynei Date: Sun, 12 Jul 2020 17:36:41 -0500 Subject: [PATCH] elements: convenience methods for dealing with assets We don't preserve detailed asset information at the moment, so provide a way to convert from a sat to an amount_asset struct. We also need a way to convert from an 'amount_asset' to a 'value' for elements, which for explicit (i.e. non-blinded) asssets is a 0x01 prefix plus the big-endian encoded value. --- bitcoin/test/run-bitcoin_block_from_hex.c | 6 ++++++ bitcoin/test/run-tx-encode.c | 6 ++++++ cli/test/run-large-input.c | 6 ++++++ cli/test/run-remove-hint.c | 6 ++++++ common/amount.c | 24 +++++++++++++++++++++++ common/amount.h | 9 +++++++++ common/test/run-bigsize.c | 6 ++++++ common/test/run-cryptomsg.c | 6 ++++++ common/test/run-derive_basepoints.c | 6 ++++++ common/test/run-features.c | 6 ++++++ common/test/run-gossip_rcvd_filter.c | 6 ++++++ common/test/run-ip_port_parsing.c | 6 ++++++ common/test/run-json_remove.c | 6 ++++++ common/test/run-key_derive.c | 6 ++++++ common/test/run-lock.c | 6 ++++++ common/test/run-softref.c | 6 ++++++ common/test/run-sphinx.c | 6 ++++++ connectd/test/run-initiator-success.c | 6 ++++++ connectd/test/run-responder-success.c | 6 ++++++ 19 files changed, 135 insertions(+) diff --git a/bitcoin/test/run-bitcoin_block_from_hex.c b/bitcoin/test/run-bitcoin_block_from_hex.c index e9a021660..aacc5bac4 100644 --- a/bitcoin/test/run-bitcoin_block_from_hex.c +++ b/bitcoin/test/run-bitcoin_block_from_hex.c @@ -7,6 +7,9 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -29,6 +32,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/bitcoin/test/run-tx-encode.c b/bitcoin/test/run-tx-encode.c index 3437f9b52..6dcb159da 100644 --- a/bitcoin/test/run-tx-encode.c +++ b/bitcoin/test/run-tx-encode.c @@ -8,6 +8,9 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -30,6 +33,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/cli/test/run-large-input.c b/cli/test/run-large-input.c index 8add9a51c..e10db714c 100644 --- a/cli/test/run-large-input.c +++ b/cli/test/run-large-input.c @@ -33,6 +33,9 @@ int test_chdir(const char *path); #undef main /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -55,6 +58,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/cli/test/run-remove-hint.c b/cli/test/run-remove-hint.c index 02ab66cbf..1ac21dfa5 100644 --- a/cli/test/run-remove-hint.c +++ b/cli/test/run-remove-hint.c @@ -36,6 +36,9 @@ int test_chdir(const char *path); #undef main /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -58,6 +61,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/common/amount.c b/common/amount.c index 028b31763..680499f39 100644 --- a/common/amount.c +++ b/common/amount.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -478,6 +479,29 @@ struct amount_sat amount_asset_to_sat(struct amount_asset *amount) return sats; } +struct amount_asset amount_sat_to_asset(struct amount_sat *sat, const u8 *asset) { + struct amount_asset amt_asset; + + assert(33 == sizeof(amt_asset.asset)); + memcpy(amt_asset.asset, asset, sizeof(amt_asset.asset)); + amt_asset.value = sat->satoshis; /* Raw: type conversion */ + return amt_asset; +} + +u8 *amount_asset_extract_value(const tal_t *ctx, struct amount_asset *asset) +{ + u8 *val = tal_arr(ctx, u8, 9); + + /* FIXME: persist blinded values */ + if (asset->value == 0) + return NULL; + + beint64_t be64 = cpu_to_be64(asset->value); + val[0] = 0x01; + memcpy(val + 1, &be64, sizeof(be64)); + return val; +} + struct amount_msat fromwire_amount_msat(const u8 **cursor, size_t *max) { struct amount_msat msat; diff --git a/common/amount.h b/common/amount.h index 792fba891..3883e6320 100644 --- a/common/amount.h +++ b/common/amount.h @@ -112,6 +112,15 @@ bool amount_msat_eq_sat(struct amount_msat msat, struct amount_sat sat); * current chain. */ bool amount_asset_is_main(struct amount_asset *asset); +/* Convert an amount_sat to an amount_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat, const u8 *asset); + +/* amount_asset_extract_value -Prefix the amount_asset's value + * to have the 'explicit' marker. Returns NULL if the + * asset was originally blinded. + * FIXME: pass through blinded amounts */ +u8 *amount_asset_extract_value(const tal_t *ctx, struct amount_asset *asset); + /* Convert from a generic asset to the fee-paying asset if possible. */ struct amount_sat amount_asset_to_sat(struct amount_asset *asset); diff --git a/common/test/run-bigsize.c b/common/test/run-bigsize.c index 64c0f1eae..074e796e6 100644 --- a/common/test/run-bigsize.c +++ b/common/test/run-bigsize.c @@ -13,6 +13,9 @@ static const char *reason; #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -35,6 +38,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/common/test/run-cryptomsg.c b/common/test/run-cryptomsg.c index 0694d7b48..36f53de02 100644 --- a/common/test/run-cryptomsg.c +++ b/common/test/run-cryptomsg.c @@ -8,6 +8,9 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -30,6 +33,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/common/test/run-derive_basepoints.c b/common/test/run-derive_basepoints.c index 8279c832c..d7d529ae0 100644 --- a/common/test/run-derive_basepoints.c +++ b/common/test/run-derive_basepoints.c @@ -9,6 +9,9 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -31,6 +34,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/common/test/run-features.c b/common/test/run-features.c index 42fb4d72c..7cd107f53 100644 --- a/common/test/run-features.c +++ b/common/test/run-features.c @@ -8,6 +8,9 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -30,6 +33,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/common/test/run-gossip_rcvd_filter.c b/common/test/run-gossip_rcvd_filter.c index c0fc19a5c..a0e742f36 100644 --- a/common/test/run-gossip_rcvd_filter.c +++ b/common/test/run-gossip_rcvd_filter.c @@ -5,6 +5,9 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -27,6 +30,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/common/test/run-ip_port_parsing.c b/common/test/run-ip_port_parsing.c index e04b18705..4ac0ab737 100644 --- a/common/test/run-ip_port_parsing.c +++ b/common/test/run-ip_port_parsing.c @@ -7,6 +7,9 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -29,6 +32,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/common/test/run-json_remove.c b/common/test/run-json_remove.c index 1f2fd1a06..7c9c193d1 100644 --- a/common/test/run-json_remove.c +++ b/common/test/run-json_remove.c @@ -5,6 +5,9 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -27,6 +30,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/common/test/run-key_derive.c b/common/test/run-key_derive.c index 039e320d0..581d147f9 100644 --- a/common/test/run-key_derive.c +++ b/common/test/run-key_derive.c @@ -10,6 +10,9 @@ #include "../key_derive.c" /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -32,6 +35,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/common/test/run-lock.c b/common/test/run-lock.c index 268130d19..7271f12e0 100644 --- a/common/test/run-lock.c +++ b/common/test/run-lock.c @@ -9,6 +9,9 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -31,6 +34,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/common/test/run-softref.c b/common/test/run-softref.c index caa2a8514..acac56416 100644 --- a/common/test/run-softref.c +++ b/common/test/run-softref.c @@ -6,6 +6,9 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -28,6 +31,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/common/test/run-sphinx.c b/common/test/run-sphinx.c index 84a355603..baea842a2 100644 --- a/common/test/run-sphinx.c +++ b/common/test/run-sphinx.c @@ -16,6 +16,9 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -44,6 +47,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/connectd/test/run-initiator-success.c b/connectd/test/run-initiator-success.c index 904846c8c..e5488799b 100644 --- a/connectd/test/run-initiator-success.c +++ b/connectd/test/run-initiator-success.c @@ -12,6 +12,9 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -34,6 +37,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); } diff --git a/connectd/test/run-responder-success.c b/connectd/test/run-responder-success.c index 34cf0c692..50254b118 100644 --- a/connectd/test/run-responder-success.c +++ b/connectd/test/run-responder-success.c @@ -12,6 +12,9 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for amount_asset_extract_value */ +u8 *amount_asset_extract_value(const tal_t *ctx UNNEEDED, struct amount_asset *asset UNNEEDED) +{ fprintf(stderr, "amount_asset_extract_value called!\n"); abort(); } /* 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(); } @@ -34,6 +37,9 @@ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNN struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_sub called!\n"); abort(); } +/* Generated stub for amount_sat_to_asset */ +struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) +{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } /* Generated stub for amount_tx_fee */ struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) { fprintf(stderr, "amount_tx_fee called!\n"); abort(); }