2018-04-03 09:20:49 +02:00
|
|
|
#include <ccan/array_size/array_size.h>
|
|
|
|
#include <ccan/time/time.h>
|
2020-05-16 00:13:22 +02:00
|
|
|
#include <common/setup.h>
|
2018-04-03 09:20:49 +02:00
|
|
|
#include <common/status.h>
|
|
|
|
|
2019-09-08 18:39:26 +02:00
|
|
|
#undef status_debug
|
|
|
|
#define status_debug(...)
|
2018-04-03 09:20:49 +02:00
|
|
|
|
|
|
|
#define main unused_main
|
|
|
|
int main(int argc, char *argv[]);
|
2018-09-03 05:40:00 +02:00
|
|
|
#include "../onchaind.c"
|
2018-04-03 09:20:49 +02:00
|
|
|
#undef main
|
|
|
|
|
|
|
|
/* AUTOGENERATED MOCKS START */
|
|
|
|
/* Generated stub for commit_number_obscurer */
|
|
|
|
u64 commit_number_obscurer(const struct pubkey *opener_payment_basepoint UNNEEDED,
|
|
|
|
const struct pubkey *accepter_payment_basepoint UNNEEDED)
|
|
|
|
{ fprintf(stderr, "commit_number_obscurer called!\n"); abort(); }
|
|
|
|
/* Generated stub for daemon_shutdown */
|
|
|
|
void daemon_shutdown(void)
|
|
|
|
{ fprintf(stderr, "daemon_shutdown called!\n"); abort(); }
|
|
|
|
/* Generated stub for derive_keyset */
|
|
|
|
bool derive_keyset(const struct pubkey *per_commitment_point UNNEEDED,
|
2018-07-23 04:23:02 +02:00
|
|
|
const struct basepoints *self UNNEEDED,
|
|
|
|
const struct basepoints *other UNNEEDED,
|
2019-09-10 04:25:27 +02:00
|
|
|
bool option_static_remotekey UNNEEDED,
|
2018-04-03 09:20:49 +02:00
|
|
|
struct keyset *keyset UNNEEDED)
|
|
|
|
{ fprintf(stderr, "derive_keyset called!\n"); abort(); }
|
2019-09-06 06:40:05 +02:00
|
|
|
/* Generated stub for dump_memleak */
|
|
|
|
bool dump_memleak(struct htable *memtable UNNEEDED)
|
|
|
|
{ fprintf(stderr, "dump_memleak called!\n"); abort(); }
|
2020-05-15 12:31:24 +02:00
|
|
|
/* 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(); }
|
2020-05-15 12:32:43 +02:00
|
|
|
/* Generated stub for fromwire_bool */
|
|
|
|
bool fromwire_bool(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
|
|
|
{ fprintf(stderr, "fromwire_bool called!\n"); abort(); }
|
2019-06-21 02:11:41 +02:00
|
|
|
/* Generated stub for fromwire_fail */
|
2020-05-19 03:05:40 +02:00
|
|
|
void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
2019-06-21 02:11:41 +02:00
|
|
|
{ fprintf(stderr, "fromwire_fail called!\n"); abort(); }
|
2018-07-23 04:23:03 +02:00
|
|
|
/* Generated stub for fromwire_hsm_get_per_commitment_point_reply */
|
|
|
|
bool fromwire_hsm_get_per_commitment_point_reply(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct pubkey *per_commitment_point UNNEEDED, struct secret **old_commitment_secret UNNEEDED)
|
|
|
|
{ fprintf(stderr, "fromwire_hsm_get_per_commitment_point_reply called!\n"); abort(); }
|
2018-07-23 04:23:02 +02:00
|
|
|
/* Generated stub for fromwire_hsm_sign_tx_reply */
|
2018-12-03 00:15:06 +01:00
|
|
|
bool fromwire_hsm_sign_tx_reply(const void *p UNNEEDED, struct bitcoin_signature *sig UNNEEDED)
|
2018-07-23 04:23:02 +02:00
|
|
|
{ fprintf(stderr, "fromwire_hsm_sign_tx_reply called!\n"); abort(); }
|
2018-04-03 09:20:49 +02:00
|
|
|
/* Generated stub for fromwire_onchain_depth */
|
2020-04-03 03:46:18 +02:00
|
|
|
bool fromwire_onchain_depth(const void *p UNNEEDED, struct bitcoin_txid *txid UNNEEDED, u32 *depth UNNEEDED, bool *is_replay UNNEEDED)
|
2018-04-03 09:20:49 +02:00
|
|
|
{ fprintf(stderr, "fromwire_onchain_depth called!\n"); abort(); }
|
2018-11-22 03:17:29 +01:00
|
|
|
/* Generated stub for fromwire_onchain_dev_memleak */
|
|
|
|
bool fromwire_onchain_dev_memleak(const void *p UNNEEDED)
|
|
|
|
{ fprintf(stderr, "fromwire_onchain_dev_memleak called!\n"); abort(); }
|
2018-04-03 09:20:49 +02:00
|
|
|
/* Generated stub for fromwire_onchain_htlc */
|
|
|
|
bool fromwire_onchain_htlc(const void *p UNNEEDED, struct htlc_stub *htlc UNNEEDED, bool *tell_if_missing UNNEEDED, bool *tell_immediately UNNEEDED)
|
|
|
|
{ fprintf(stderr, "fromwire_onchain_htlc called!\n"); abort(); }
|
|
|
|
/* Generated stub for fromwire_onchain_init */
|
2020-08-14 03:30:42 +02:00
|
|
|
bool fromwire_onchain_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct shachain *shachain UNNEEDED, const struct chainparams **chainparams UNNEEDED, struct amount_sat *funding_amount_satoshi UNNEEDED, struct amount_msat *our_msat UNNEEDED, struct pubkey *old_remote_per_commitment_point UNNEEDED, struct pubkey *remote_per_commitment_point UNNEEDED, u32 *local_to_self_delay UNNEEDED, u32 *remote_to_self_delay UNNEEDED, u32 *delayed_to_us_feerate UNNEEDED, u32 *htlc_feerate UNNEEDED, u32 *penalty_feerate UNNEEDED, struct amount_sat *local_dust_limit_satoshi UNNEEDED, struct bitcoin_txid *our_broadcast_txid UNNEEDED, u8 **local_scriptpubkey UNNEEDED, u8 **remote_scriptpubkey UNNEEDED, struct pubkey *ourwallet_pubkey UNNEEDED, enum side *opener UNNEEDED, struct basepoints *local_basepoints UNNEEDED, struct basepoints *remote_basepoints UNNEEDED, struct tx_parts **tx_parts UNNEEDED, u32 *locktime UNNEEDED, u32 *tx_blockheight UNNEEDED, u32 *reasonable_depth UNNEEDED, struct bitcoin_signature **htlc_signature UNNEEDED, u64 *num_htlcs UNNEEDED, u32 *min_possible_feerate UNNEEDED, u32 *max_possible_feerate UNNEEDED, struct pubkey **possible_remote_per_commit_point UNNEEDED, struct pubkey *local_funding_pubkey UNNEEDED, struct pubkey *remote_funding_pubkey UNNEEDED, bool *option_static_remotekey UNNEEDED, bool *option_anchor_outputs UNNEEDED, bool *is_replay UNNEEDED)
|
2018-04-03 09:20:49 +02:00
|
|
|
{ fprintf(stderr, "fromwire_onchain_init called!\n"); abort(); }
|
|
|
|
/* Generated stub for fromwire_onchain_known_preimage */
|
2020-04-03 03:46:18 +02:00
|
|
|
bool fromwire_onchain_known_preimage(const void *p UNNEEDED, struct preimage *preimage UNNEEDED, bool *is_replay UNNEEDED)
|
2018-04-03 09:20:49 +02:00
|
|
|
{ fprintf(stderr, "fromwire_onchain_known_preimage called!\n"); abort(); }
|
|
|
|
/* Generated stub for fromwire_onchain_spent */
|
2020-05-26 05:39:40 +02:00
|
|
|
bool fromwire_onchain_spent(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct tx_parts **tx UNNEEDED, u32 *input_num UNNEEDED, u32 *blockheight UNNEEDED, bool *is_replay UNNEEDED)
|
2018-04-03 09:20:49 +02:00
|
|
|
{ fprintf(stderr, "fromwire_onchain_spent called!\n"); abort(); }
|
2020-05-15 12:30:43 +02:00
|
|
|
/* Generated stub for fromwire_secp256k1_ecdsa_signature */
|
|
|
|
void fromwire_secp256k1_ecdsa_signature(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
|
|
|
secp256k1_ecdsa_signature *signature UNNEEDED)
|
|
|
|
{ fprintf(stderr, "fromwire_secp256k1_ecdsa_signature called!\n"); abort(); }
|
2020-05-16 03:29:05 +02:00
|
|
|
/* Generated stub for fromwire_sha256 */
|
|
|
|
void fromwire_sha256(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct sha256 *sha256 UNNEEDED)
|
|
|
|
{ fprintf(stderr, "fromwire_sha256 called!\n"); abort(); }
|
2020-03-31 00:39:00 +02:00
|
|
|
/* Generated stub for fromwire_tal_arrn */
|
|
|
|
u8 *fromwire_tal_arrn(const tal_t *ctx UNNEEDED,
|
|
|
|
const u8 **cursor UNNEEDED, size_t *max UNNEEDED, size_t num UNNEEDED)
|
|
|
|
{ fprintf(stderr, "fromwire_tal_arrn called!\n"); abort(); }
|
|
|
|
/* Generated stub for fromwire_u16 */
|
|
|
|
u16 fromwire_u16(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
|
|
|
{ fprintf(stderr, "fromwire_u16 called!\n"); abort(); }
|
2020-05-21 05:57:41 +02:00
|
|
|
/* Generated stub for fromwire_u32 */
|
|
|
|
u32 fromwire_u32(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
|
|
|
{ fprintf(stderr, "fromwire_u32 called!\n"); abort(); }
|
2020-05-15 12:32:02 +02:00
|
|
|
/* Generated stub for fromwire_u64 */
|
|
|
|
u64 fromwire_u64(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
|
|
|
{ fprintf(stderr, "fromwire_u64 called!\n"); abort(); }
|
2020-05-15 12:30:43 +02:00
|
|
|
/* Generated stub for fromwire_u8 */
|
|
|
|
u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
|
|
|
{ fprintf(stderr, "fromwire_u8 called!\n"); abort(); }
|
2018-04-03 09:20:49 +02:00
|
|
|
/* Generated stub for htlc_offered_wscript */
|
|
|
|
u8 *htlc_offered_wscript(const tal_t *ctx UNNEEDED,
|
|
|
|
const struct ripemd160 *ripemd UNNEEDED,
|
2020-08-13 19:42:02 +02:00
|
|
|
const struct keyset *keyset UNNEEDED,
|
|
|
|
bool option_anchor_outputs UNNEEDED)
|
2018-04-03 09:20:49 +02:00
|
|
|
{ fprintf(stderr, "htlc_offered_wscript called!\n"); abort(); }
|
|
|
|
/* Generated stub for htlc_received_wscript */
|
|
|
|
u8 *htlc_received_wscript(const tal_t *ctx UNNEEDED,
|
|
|
|
const struct ripemd160 *ripemd UNNEEDED,
|
|
|
|
const struct abs_locktime *expiry UNNEEDED,
|
2020-08-13 19:42:02 +02:00
|
|
|
const struct keyset *keyset UNNEEDED,
|
|
|
|
bool option_anchor_outputs UNNEEDED)
|
2018-04-03 09:20:49 +02:00
|
|
|
{ fprintf(stderr, "htlc_received_wscript called!\n"); abort(); }
|
|
|
|
/* Generated stub for htlc_success_tx */
|
|
|
|
struct bitcoin_tx *htlc_success_tx(const tal_t *ctx UNNEEDED,
|
2019-07-30 16:14:43 +02:00
|
|
|
const struct chainparams *chainparams UNNEEDED,
|
2018-04-03 09:20:49 +02:00
|
|
|
const struct bitcoin_txid *commit_txid UNNEEDED,
|
|
|
|
unsigned int commit_output_number UNNEEDED,
|
2020-05-21 21:46:19 +02:00
|
|
|
const u8 *commit_wscript UNNEEDED,
|
2019-02-21 04:45:55 +01:00
|
|
|
struct amount_msat htlc_msatoshi UNNEEDED,
|
2018-04-03 09:20:49 +02:00
|
|
|
u16 to_self_delay UNNEEDED,
|
|
|
|
u32 feerate_per_kw UNNEEDED,
|
2020-08-13 19:42:02 +02:00
|
|
|
const struct keyset *keyset UNNEEDED,
|
|
|
|
bool option_anchor_outputs UNNEEDED)
|
2018-04-03 09:20:49 +02:00
|
|
|
{ fprintf(stderr, "htlc_success_tx called!\n"); abort(); }
|
|
|
|
/* Generated stub for htlc_timeout_tx */
|
|
|
|
struct bitcoin_tx *htlc_timeout_tx(const tal_t *ctx UNNEEDED,
|
2019-07-30 16:14:43 +02:00
|
|
|
const struct chainparams *chainparams UNNEEDED,
|
2018-04-03 09:20:49 +02:00
|
|
|
const struct bitcoin_txid *commit_txid UNNEEDED,
|
|
|
|
unsigned int commit_output_number UNNEEDED,
|
2020-05-21 21:46:19 +02:00
|
|
|
const u8 *commit_wscript UNNEEDED,
|
2019-02-21 04:45:55 +01:00
|
|
|
struct amount_msat htlc_msatoshi UNNEEDED,
|
2018-04-03 09:20:49 +02:00
|
|
|
u32 cltv_expiry UNNEEDED,
|
|
|
|
u16 to_self_delay UNNEEDED,
|
|
|
|
u32 feerate_per_kw UNNEEDED,
|
2020-08-13 19:42:02 +02:00
|
|
|
const struct keyset *keyset UNNEEDED,
|
|
|
|
bool option_anchor_outputs UNNEEDED)
|
2018-04-03 09:20:49 +02:00
|
|
|
{ fprintf(stderr, "htlc_timeout_tx called!\n"); abort(); }
|
|
|
|
/* Generated stub for master_badmsg */
|
|
|
|
void master_badmsg(u32 type_expected UNNEEDED, const u8 *msg)
|
|
|
|
{ fprintf(stderr, "master_badmsg called!\n"); abort(); }
|
2019-09-06 06:40:05 +02:00
|
|
|
/* Generated stub for memleak_enter_allocations */
|
|
|
|
struct htable *memleak_enter_allocations(const tal_t *ctx UNNEEDED,
|
|
|
|
const void *exclude1 UNNEEDED,
|
|
|
|
const void *exclude2 UNNEEDED)
|
|
|
|
{ fprintf(stderr, "memleak_enter_allocations called!\n"); abort(); }
|
|
|
|
/* Generated stub for memleak_remove_referenced */
|
|
|
|
void memleak_remove_referenced(struct htable *memtable UNNEEDED, const void *root UNNEEDED)
|
|
|
|
{ fprintf(stderr, "memleak_remove_referenced called!\n"); abort(); }
|
|
|
|
/* Generated stub for memleak_scan_region */
|
|
|
|
void memleak_scan_region(struct htable *memtable UNNEEDED,
|
|
|
|
const void *p UNNEEDED, size_t bytelen UNNEEDED)
|
|
|
|
{ fprintf(stderr, "memleak_scan_region called!\n"); abort(); }
|
2020-04-15 05:08:06 +02:00
|
|
|
/* Generated stub for new_coin_chain_fees */
|
|
|
|
struct chain_coin_mvt *new_coin_chain_fees(const tal_t *ctx UNNEEDED,
|
|
|
|
const char *account_name UNNEEDED,
|
|
|
|
const struct bitcoin_txid *tx_txid UNNEEDED,
|
|
|
|
u32 blockheight UNNEEDED,
|
2020-04-15 05:40:28 +02:00
|
|
|
struct amount_msat amount UNNEEDED)
|
2020-04-15 05:08:06 +02:00
|
|
|
{ fprintf(stderr, "new_coin_chain_fees called!\n"); abort(); }
|
|
|
|
/* Generated stub for new_coin_chain_fees_sat */
|
|
|
|
struct chain_coin_mvt *new_coin_chain_fees_sat(const tal_t *ctx UNNEEDED,
|
|
|
|
const char *account_name UNNEEDED,
|
|
|
|
const struct bitcoin_txid *tx_txid UNNEEDED,
|
|
|
|
u32 blockheight UNNEEDED,
|
2020-04-15 05:40:28 +02:00
|
|
|
struct amount_sat amount UNNEEDED)
|
2020-04-15 05:08:06 +02:00
|
|
|
{ fprintf(stderr, "new_coin_chain_fees_sat called!\n"); abort(); }
|
|
|
|
/* Generated stub for new_coin_journal_entry */
|
|
|
|
struct chain_coin_mvt *new_coin_journal_entry(const tal_t *ctx UNNEEDED,
|
|
|
|
const char *account_name UNNEEDED,
|
|
|
|
const struct bitcoin_txid *txid UNNEEDED,
|
|
|
|
const struct bitcoin_txid *out_txid UNNEEDED,
|
|
|
|
u32 vout UNNEEDED,
|
|
|
|
u32 blockheight UNNEEDED,
|
|
|
|
struct amount_msat amount UNNEEDED,
|
2020-04-15 05:40:28 +02:00
|
|
|
bool is_credit UNNEEDED)
|
2020-04-15 05:08:06 +02:00
|
|
|
{ fprintf(stderr, "new_coin_journal_entry called!\n"); abort(); }
|
|
|
|
/* Generated stub for new_coin_onchain_htlc_sat */
|
|
|
|
struct chain_coin_mvt *new_coin_onchain_htlc_sat(const tal_t *ctx UNNEEDED,
|
2020-04-15 05:40:28 +02:00
|
|
|
const char *account_name UNNEEDED,
|
2020-04-15 05:08:06 +02:00
|
|
|
const struct bitcoin_txid *txid UNNEEDED,
|
|
|
|
const struct bitcoin_txid *out_txid UNNEEDED,
|
2020-04-22 01:53:15 +02:00
|
|
|
u32 vout UNNEEDED,
|
|
|
|
struct sha256 payment_hash UNNEEDED,
|
2020-04-15 05:08:06 +02:00
|
|
|
u32 blockheight UNNEEDED,
|
|
|
|
struct amount_sat amount UNNEEDED,
|
2020-04-15 05:40:28 +02:00
|
|
|
bool is_credit UNNEEDED)
|
2020-04-15 05:08:06 +02:00
|
|
|
{ fprintf(stderr, "new_coin_onchain_htlc_sat called!\n"); abort(); }
|
|
|
|
/* Generated stub for new_coin_penalty_sat */
|
|
|
|
struct chain_coin_mvt *new_coin_penalty_sat(const tal_t *ctx UNNEEDED,
|
|
|
|
const char *account_name UNNEEDED,
|
|
|
|
const struct bitcoin_txid *txid UNNEEDED,
|
|
|
|
const struct bitcoin_txid *out_txid UNNEEDED,
|
|
|
|
u32 vout UNNEEDED,
|
|
|
|
u32 blockheight UNNEEDED,
|
2020-04-15 05:40:28 +02:00
|
|
|
struct amount_sat amount UNNEEDED)
|
2020-04-15 05:08:06 +02:00
|
|
|
{ fprintf(stderr, "new_coin_penalty_sat called!\n"); abort(); }
|
|
|
|
/* Generated stub for new_coin_withdrawal */
|
|
|
|
struct chain_coin_mvt *new_coin_withdrawal(const tal_t *ctx UNNEEDED,
|
2020-04-02 04:35:52 +02:00
|
|
|
const char *account_name UNNEEDED,
|
|
|
|
const struct bitcoin_txid *tx_txid UNNEEDED,
|
2020-04-15 05:08:06 +02:00
|
|
|
const struct bitcoin_txid *out_txid UNNEEDED,
|
2020-04-02 04:35:52 +02:00
|
|
|
u32 vout UNNEEDED,
|
2020-04-03 23:52:35 +02:00
|
|
|
u32 blockheight UNNEEDED,
|
2020-04-15 05:40:28 +02:00
|
|
|
struct amount_msat amount UNNEEDED)
|
2020-04-15 05:08:06 +02:00
|
|
|
{ fprintf(stderr, "new_coin_withdrawal called!\n"); abort(); }
|
|
|
|
/* Generated stub for new_coin_withdrawal_sat */
|
|
|
|
struct chain_coin_mvt *new_coin_withdrawal_sat(const tal_t *ctx UNNEEDED,
|
|
|
|
const char *account_name UNNEEDED,
|
|
|
|
const struct bitcoin_txid *tx_txid UNNEEDED,
|
|
|
|
const struct bitcoin_txid *out_txid UNNEEDED,
|
|
|
|
u32 vout UNNEEDED,
|
|
|
|
u32 blockheight UNNEEDED,
|
2020-04-15 05:40:28 +02:00
|
|
|
struct amount_sat amount UNNEEDED)
|
2020-04-15 05:08:06 +02:00
|
|
|
{ fprintf(stderr, "new_coin_withdrawal_sat called!\n"); abort(); }
|
2019-09-06 06:40:05 +02:00
|
|
|
/* Generated stub for notleak_ */
|
|
|
|
void *notleak_(const void *ptr UNNEEDED, bool plus_children UNNEEDED)
|
|
|
|
{ fprintf(stderr, "notleak_ called!\n"); abort(); }
|
2018-04-03 09:20:49 +02:00
|
|
|
/* Generated stub for peer_billboard */
|
|
|
|
void peer_billboard(bool perm UNNEEDED, const char *fmt UNNEEDED, ...)
|
|
|
|
{ fprintf(stderr, "peer_billboard called!\n"); abort(); }
|
2018-08-17 06:16:33 +02:00
|
|
|
/* Generated stub for shachain_get_secret */
|
|
|
|
bool shachain_get_secret(const struct shachain *shachain UNNEEDED,
|
|
|
|
u64 commit_num UNNEEDED,
|
|
|
|
struct secret *preimage UNNEEDED)
|
|
|
|
{ fprintf(stderr, "shachain_get_secret called!\n"); abort(); }
|
2018-04-03 09:20:49 +02:00
|
|
|
/* Generated stub for status_failed */
|
|
|
|
void status_failed(enum status_failreason code UNNEEDED,
|
|
|
|
const char *fmt UNNEEDED, ...)
|
|
|
|
{ fprintf(stderr, "status_failed called!\n"); abort(); }
|
2018-06-20 08:50:44 +02:00
|
|
|
/* Generated stub for status_fmt */
|
2019-11-17 12:42:33 +01:00
|
|
|
void status_fmt(enum log_level level UNNEEDED,
|
|
|
|
const struct node_id *peer UNNEEDED,
|
|
|
|
const char *fmt UNNEEDED, ...)
|
2018-06-20 08:50:44 +02:00
|
|
|
|
|
|
|
{ fprintf(stderr, "status_fmt called!\n"); abort(); }
|
2018-04-03 09:20:49 +02:00
|
|
|
/* Generated stub for status_setup_sync */
|
|
|
|
void status_setup_sync(int fd UNNEEDED)
|
|
|
|
{ fprintf(stderr, "status_setup_sync called!\n"); abort(); }
|
|
|
|
/* Generated stub for subdaemon_setup */
|
|
|
|
void subdaemon_setup(int argc UNNEEDED, char *argv[])
|
|
|
|
{ fprintf(stderr, "subdaemon_setup called!\n"); abort(); }
|
|
|
|
/* Generated stub for to_self_wscript */
|
|
|
|
u8 *to_self_wscript(const tal_t *ctx UNNEEDED,
|
|
|
|
u16 to_self_delay UNNEEDED,
|
|
|
|
const struct keyset *keyset UNNEEDED)
|
|
|
|
{ fprintf(stderr, "to_self_wscript called!\n"); abort(); }
|
2020-05-15 12:31:24 +02:00
|
|
|
/* Generated stub for towire */
|
|
|
|
void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire called!\n"); abort(); }
|
2020-05-15 12:32:43 +02:00
|
|
|
/* Generated stub for towire_bool */
|
|
|
|
void towire_bool(u8 **pptr UNNEEDED, bool v UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_bool called!\n"); abort(); }
|
2018-07-23 04:23:03 +02:00
|
|
|
/* 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(); }
|
2018-07-23 04:23:02 +02:00
|
|
|
/* Generated stub for towire_hsm_sign_delayed_payment_to_us */
|
2020-05-27 03:37:44 +02:00
|
|
|
u8 *towire_hsm_sign_delayed_payment_to_us(const tal_t *ctx UNNEEDED, u64 commit_num UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, const u8 *wscript UNNEEDED)
|
2018-07-23 04:23:02 +02:00
|
|
|
{ fprintf(stderr, "towire_hsm_sign_delayed_payment_to_us called!\n"); abort(); }
|
2018-07-23 04:23:02 +02:00
|
|
|
/* Generated stub for towire_hsm_sign_local_htlc_tx */
|
2020-08-13 19:43:02 +02:00
|
|
|
u8 *towire_hsm_sign_local_htlc_tx(const tal_t *ctx UNNEEDED, u64 commit_num UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, const u8 *wscript UNNEEDED, bool option_anchor_outputs UNNEEDED)
|
2018-07-23 04:23:02 +02:00
|
|
|
{ fprintf(stderr, "towire_hsm_sign_local_htlc_tx called!\n"); abort(); }
|
2018-07-23 04:23:02 +02:00
|
|
|
/* Generated stub for towire_hsm_sign_penalty_to_us */
|
2020-05-27 03:37:44 +02:00
|
|
|
u8 *towire_hsm_sign_penalty_to_us(const tal_t *ctx UNNEEDED, const struct secret *revocation_secret UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, const u8 *wscript UNNEEDED)
|
2018-07-23 04:23:02 +02:00
|
|
|
{ fprintf(stderr, "towire_hsm_sign_penalty_to_us called!\n"); abort(); }
|
|
|
|
/* Generated stub for towire_hsm_sign_remote_htlc_to_us */
|
2020-08-13 19:43:02 +02:00
|
|
|
u8 *towire_hsm_sign_remote_htlc_to_us(const tal_t *ctx UNNEEDED, const struct pubkey *remote_per_commitment_point UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, const u8 *wscript UNNEEDED, bool option_anchor_outputs UNNEEDED)
|
2018-07-23 04:23:02 +02:00
|
|
|
{ fprintf(stderr, "towire_hsm_sign_remote_htlc_to_us called!\n"); abort(); }
|
2018-04-03 09:20:49 +02:00
|
|
|
/* Generated stub for towire_onchain_add_utxo */
|
2019-02-22 16:36:09 +01:00
|
|
|
u8 *towire_onchain_add_utxo(const tal_t *ctx UNNEEDED, const struct bitcoin_txid *prev_out_tx UNNEEDED, u32 prev_out_index UNNEEDED, const struct pubkey *per_commit_point UNNEEDED, struct amount_sat value UNNEEDED, u32 blockheight UNNEEDED, const u8 *scriptpubkey UNNEEDED)
|
2018-04-03 09:20:49 +02:00
|
|
|
{ fprintf(stderr, "towire_onchain_add_utxo called!\n"); abort(); }
|
|
|
|
/* Generated stub for towire_onchain_all_irrevocably_resolved */
|
|
|
|
u8 *towire_onchain_all_irrevocably_resolved(const tal_t *ctx UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_onchain_all_irrevocably_resolved called!\n"); abort(); }
|
2019-10-04 12:27:48 +02:00
|
|
|
/* Generated stub for towire_onchain_annotate_txin */
|
|
|
|
u8 *towire_onchain_annotate_txin(const tal_t *ctx UNNEEDED, const struct bitcoin_txid *txid UNNEEDED, u32 innum UNNEEDED, enum wallet_tx_type type UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_onchain_annotate_txin called!\n"); abort(); }
|
|
|
|
/* Generated stub for towire_onchain_annotate_txout */
|
|
|
|
u8 *towire_onchain_annotate_txout(const tal_t *ctx UNNEEDED, const struct bitcoin_txid *txid UNNEEDED, u32 outnum UNNEEDED, enum wallet_tx_type type UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_onchain_annotate_txout called!\n"); abort(); }
|
2018-04-03 09:20:49 +02:00
|
|
|
/* Generated stub for towire_onchain_broadcast_tx */
|
2019-06-07 11:38:20 +02:00
|
|
|
u8 *towire_onchain_broadcast_tx(const tal_t *ctx UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, enum wallet_tx_type type UNNEEDED)
|
2018-04-03 09:20:49 +02:00
|
|
|
{ fprintf(stderr, "towire_onchain_broadcast_tx called!\n"); abort(); }
|
2018-11-22 03:17:29 +01:00
|
|
|
/* Generated stub for towire_onchain_dev_memleak_reply */
|
|
|
|
u8 *towire_onchain_dev_memleak_reply(const tal_t *ctx UNNEEDED, bool leak UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_onchain_dev_memleak_reply called!\n"); abort(); }
|
2018-04-03 09:20:49 +02:00
|
|
|
/* Generated stub for towire_onchain_extracted_preimage */
|
|
|
|
u8 *towire_onchain_extracted_preimage(const tal_t *ctx UNNEEDED, const struct preimage *preimage UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_onchain_extracted_preimage called!\n"); abort(); }
|
|
|
|
/* Generated stub for towire_onchain_htlc_timeout */
|
|
|
|
u8 *towire_onchain_htlc_timeout(const tal_t *ctx UNNEEDED, const struct htlc_stub *htlc UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_onchain_htlc_timeout called!\n"); abort(); }
|
|
|
|
/* Generated stub for towire_onchain_init_reply */
|
|
|
|
u8 *towire_onchain_init_reply(const tal_t *ctx UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_onchain_init_reply called!\n"); abort(); }
|
|
|
|
/* Generated stub for towire_onchain_missing_htlc_output */
|
|
|
|
u8 *towire_onchain_missing_htlc_output(const tal_t *ctx UNNEEDED, const struct htlc_stub *htlc UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_onchain_missing_htlc_output called!\n"); abort(); }
|
2020-04-02 04:16:32 +02:00
|
|
|
/* Generated stub for towire_onchain_notify_coin_mvt */
|
|
|
|
u8 *towire_onchain_notify_coin_mvt(const tal_t *ctx UNNEEDED, const struct chain_coin_mvt *mvt UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_onchain_notify_coin_mvt called!\n"); abort(); }
|
2018-04-03 09:20:49 +02:00
|
|
|
/* Generated stub for towire_onchain_unwatch_tx */
|
|
|
|
u8 *towire_onchain_unwatch_tx(const tal_t *ctx UNNEEDED, const struct bitcoin_txid *txid UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_onchain_unwatch_tx called!\n"); abort(); }
|
2020-05-15 12:30:43 +02:00
|
|
|
/* Generated stub for towire_secp256k1_ecdsa_signature */
|
|
|
|
void towire_secp256k1_ecdsa_signature(u8 **pptr UNNEEDED,
|
|
|
|
const secp256k1_ecdsa_signature *signature UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_secp256k1_ecdsa_signature called!\n"); abort(); }
|
2020-05-16 03:29:05 +02:00
|
|
|
/* Generated stub for towire_sha256 */
|
|
|
|
void towire_sha256(u8 **pptr UNNEEDED, const struct sha256 *sha256 UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_sha256 called!\n"); abort(); }
|
2020-03-31 00:39:00 +02:00
|
|
|
/* Generated stub for towire_u16 */
|
|
|
|
void towire_u16(u8 **pptr UNNEEDED, u16 v UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_u16 called!\n"); abort(); }
|
2020-05-21 05:57:41 +02:00
|
|
|
/* Generated stub for towire_u32 */
|
|
|
|
void towire_u32(u8 **pptr UNNEEDED, u32 v UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_u32 called!\n"); abort(); }
|
2020-05-15 12:32:02 +02:00
|
|
|
/* Generated stub for towire_u64 */
|
|
|
|
void towire_u64(u8 **pptr UNNEEDED, u64 v UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_u64 called!\n"); abort(); }
|
2020-05-15 12:30:43 +02:00
|
|
|
/* Generated stub for towire_u8 */
|
|
|
|
void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_u8 called!\n"); abort(); }
|
2020-03-31 00:39:00 +02:00
|
|
|
/* Generated stub for towire_u8_array */
|
|
|
|
void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNEEDED)
|
|
|
|
{ fprintf(stderr, "towire_u8_array called!\n"); abort(); }
|
2018-04-03 09:20:49 +02:00
|
|
|
/* Generated stub for wire_sync_read */
|
|
|
|
u8 *wire_sync_read(const tal_t *ctx UNNEEDED, int fd UNNEEDED)
|
|
|
|
{ fprintf(stderr, "wire_sync_read called!\n"); abort(); }
|
|
|
|
/* Generated stub for wire_sync_write */
|
|
|
|
bool wire_sync_write(int fd UNNEEDED, const void *msg TAKES UNNEEDED)
|
|
|
|
{ fprintf(stderr, "wire_sync_write called!\n"); abort(); }
|
|
|
|
/* AUTOGENERATED MOCKS END */
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2020-05-16 00:13:22 +02:00
|
|
|
common_setup(argv[0]);
|
2018-04-25 12:55:34 +02:00
|
|
|
|
2018-04-03 09:20:49 +02:00
|
|
|
struct bitcoin_tx *tx;
|
2018-12-03 00:15:06 +01:00
|
|
|
struct bitcoin_signature sig;
|
2018-04-03 09:20:49 +02:00
|
|
|
u8 *der, *wscript;
|
2019-02-21 04:45:55 +01:00
|
|
|
struct amount_sat fee;
|
2018-04-03 09:20:49 +02:00
|
|
|
struct pubkey htlc_key;
|
|
|
|
struct keyset *keys;
|
|
|
|
struct timeabs start, end;
|
|
|
|
int iterations = 1000;
|
|
|
|
|
2019-09-26 00:42:26 +02:00
|
|
|
chainparams = chainparams_for_network("bitcoin");
|
2018-04-03 09:20:49 +02:00
|
|
|
tx = bitcoin_tx_from_hex(tmpctx, "0200000001e1ebca08cf1c301ac563580a1126d5c8fcb0e5e2043230b852c726553caf1e1d0000000000000000000160ae0a000000000022002082e03c5a9cb79c82cd5a0572dc175290bc044609aabe9cc852d61927436041796d000000",
|
|
|
|
strlen("0200000001e1ebca08cf1c301ac563580a1126d5c8fcb0e5e2043230b852c726553caf1e1d0000000000000000000160ae0a000000000022002082e03c5a9cb79c82cd5a0572dc175290bc044609aabe9cc852d61927436041796d000000"));
|
2019-07-30 21:09:47 +02:00
|
|
|
tx->chainparams = chainparams_for_network("regtest");
|
2020-05-27 03:37:44 +02:00
|
|
|
psbt_input_set_prev_utxo(tx->psbt, 0, NULL, AMOUNT_SAT(700000));
|
2019-07-30 16:14:43 +02:00
|
|
|
tx->chainparams = chainparams_for_network("bitcoin");
|
2018-12-03 00:15:06 +01:00
|
|
|
der = tal_hexdata(tmpctx, "30450221009b2e0eef267b94c3899fb0dc7375012e2cee4c10348a068fe78d1b82b4b14036022077c3fad3adac2ddf33f415e45f0daf6658b7a0b09647de4443938ae2dbafe2b9" "01",
|
|
|
|
strlen("30450221009b2e0eef267b94c3899fb0dc7375012e2cee4c10348a068fe78d1b82b4b14036022077c3fad3adac2ddf33f415e45f0daf6658b7a0b09647de4443938ae2dbafe2b9" "01"));
|
2018-07-28 08:00:16 +02:00
|
|
|
if (!signature_from_der(der, tal_count(der), &sig))
|
2018-04-03 09:20:49 +02:00
|
|
|
abort();
|
|
|
|
|
|
|
|
wscript = tal_hexdata(tmpctx, "76a914a8c40c334351dbe8e5908544f1c98fbcfb8719fc8763ac6721038ffd2621647812011960152bfb79c5a2787dfe6c4f37e2222547de054432eb7f7c820120876475527c2103cf8e2f193a6aed60db80af75f3c8d59c2de735b299b7c7083527be9bd23b77a852ae67a914b8bcd51efa35be1e50ae2d5f72f4500acb005c9c88ac6868", strlen("76a914a8c40c334351dbe8e5908544f1c98fbcfb8719fc8763ac6721038ffd2621647812011960152bfb79c5a2787dfe6c4f37e2222547de054432eb7f7c820120876475527c2103cf8e2f193a6aed60db80af75f3c8d59c2de735b299b7c7083527be9bd23b77a852ae67a914b8bcd51efa35be1e50ae2d5f72f4500acb005c9c88ac6868"));
|
|
|
|
if (!pubkey_from_hexstr("038ffd2621647812011960152bfb79c5a2787dfe6c4f37e2222547de054432eb7f",
|
|
|
|
strlen("038ffd2621647812011960152bfb79c5a2787dfe6c4f37e2222547de054432eb7f"),
|
|
|
|
&htlc_key))
|
|
|
|
abort();
|
|
|
|
|
|
|
|
/* Dance around a little because keyset is const */
|
|
|
|
keys = tal(tmpctx, struct keyset);
|
|
|
|
keys->other_htlc_key = htlc_key;
|
|
|
|
keyset = keys;
|
|
|
|
|
|
|
|
if (argc > 1)
|
|
|
|
iterations = atoi(argv[1]);
|
|
|
|
max_possible_feerate = 250000;
|
|
|
|
min_possible_feerate = max_possible_feerate + 1 - iterations;
|
|
|
|
|
|
|
|
start = time_now();
|
2019-02-21 04:45:55 +01:00
|
|
|
if (!grind_htlc_tx_fee(&fee, tx, &sig, wscript, 663))
|
|
|
|
abort();
|
2018-04-03 09:20:49 +02:00
|
|
|
end = time_now();
|
2019-02-21 04:45:55 +01:00
|
|
|
assert(amount_sat_eq(fee, AMOUNT_SAT(165750)));
|
2018-04-03 09:20:49 +02:00
|
|
|
printf("%u iterations in %"PRIu64" msec = %"PRIu64" nsec each\n",
|
|
|
|
iterations,
|
|
|
|
time_to_msec(time_between(end, start)),
|
|
|
|
time_to_nsec(time_divide(time_between(end, start), iterations)));
|
|
|
|
|
2020-05-16 00:13:22 +02:00
|
|
|
common_shutdown();
|
2018-04-03 09:20:49 +02:00
|
|
|
return 0;
|
|
|
|
}
|