Browse Source

hooks: Add cltv_expiry_delta to the htlc_accepted hook

Signed-off-by: Christian Decker <decker.christian@gmail.com>
Suggested-by: Corné Plooy <@bitonic-cjp>
htlc_accepted_hook
Christian Decker 6 years ago
committed by Rusty Russell
parent
commit
1561ffaea0
  1. 4
      lightningd/peer_htlcs.c
  2. 5
      lightningd/test/run-find_my_abspath.c
  3. 5
      lightningd/test/run-invoice-select-inchan.c
  4. 17
      wallet/test/run-wallet.c

4
lightningd/peer_htlcs.c

@ -715,6 +715,7 @@ static void htlc_accepted_hook_serialize(struct htlc_accepted_hook_payload *p,
{
const struct route_step *rs = p->route_step;
const struct htlc_in *hin = p->hin;
s32 expiry = hin->cltv_expiry, blockheight = p->ld->topology->tip->height;
json_object_start(s, "onion");
if (rs->hop_data.realm == 0x00) {
@ -732,7 +733,8 @@ static void htlc_accepted_hook_serialize(struct htlc_accepted_hook_payload *p,
json_object_start(s, "htlc");
json_add_amount_msat_only(s, "amount", hin->msat);
json_add_u64(s, "cltv_expiry", hin->cltv_expiry);
json_add_u32(s, "cltv_expiry", expiry);
json_add_s32(s, "cltv_expiry_relative", expiry - blockheight);
json_add_hex(s, "payment_hash", hin->payment_hash.u.u8, sizeof(hin->payment_hash));
json_object_end(s);
}

5
lightningd/test/run-find_my_abspath.c

@ -170,11 +170,6 @@ const char *version(void)
/* Generated stub for wallet_blocks_heights */
void wallet_blocks_heights(struct wallet *w UNNEEDED, u32 def UNNEEDED, u32 *min UNNEEDED, u32 *max UNNEEDED)
{ fprintf(stderr, "wallet_blocks_heights called!\n"); abort(); }
/* Generated stub for wallet_invoice_autoclean */
void wallet_invoice_autoclean(struct wallet * wallet UNNEEDED,
u64 cycle_seconds UNNEEDED,
u64 expired_by UNNEEDED)
{ fprintf(stderr, "wallet_invoice_autoclean called!\n"); abort(); }
/* Generated stub for wallet_network_check */
bool wallet_network_check(struct wallet *w UNNEEDED,
const struct chainparams *chainparams UNNEEDED)

5
lightningd/test/run-invoice-select-inchan.c

@ -478,11 +478,6 @@ bool wallet_htlcs_load_for_channel(struct wallet *wallet UNNEEDED,
struct htlc_in_map *htlcs_in UNNEEDED,
struct htlc_out_map *htlcs_out UNNEEDED)
{ fprintf(stderr, "wallet_htlcs_load_for_channel called!\n"); abort(); }
/* Generated stub for wallet_invoice_autoclean */
void wallet_invoice_autoclean(struct wallet * wallet UNNEEDED,
u64 cycle_seconds UNNEEDED,
u64 expired_by UNNEEDED)
{ fprintf(stderr, "wallet_invoice_autoclean called!\n"); abort(); }
/* Generated stub for wallet_invoice_create */
bool wallet_invoice_create(struct wallet *wallet UNNEEDED,
struct invoice *pinvoice UNNEEDED,

17
wallet/test/run-wallet.c

@ -112,11 +112,6 @@ u32 get_block_height(const struct chain_topology *topo UNNEEDED)
/* Generated stub for get_chainparams */
const struct chainparams *get_chainparams(const struct lightningd *ld UNNEEDED)
{ fprintf(stderr, "get_chainparams called!\n"); abort(); }
/* Generated stub for invoices_autoclean_set */
void invoices_autoclean_set(struct invoices *invoices UNNEEDED,
u64 cycle_seconds UNNEEDED,
u64 expired_by UNNEEDED)
{ fprintf(stderr, "invoices_autoclean_set called!\n"); abort(); }
/* Generated stub for invoices_create */
bool invoices_create(struct invoices *invoices UNNEEDED,
struct invoice *pinvoice UNNEEDED,
@ -255,6 +250,10 @@ void json_add_node_id(struct json_stream *response UNNEEDED,
void json_add_num(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
unsigned int value UNNEEDED)
{ fprintf(stderr, "json_add_num called!\n"); abort(); }
/* Generated stub for json_add_s32 */
void json_add_s32(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
int32_t value UNNEEDED)
{ fprintf(stderr, "json_add_s32 called!\n"); abort(); }
/* Generated stub for json_add_short_channel_id */
void json_add_short_channel_id(struct json_stream *response UNNEEDED,
const char *fieldname UNNEEDED,
@ -271,6 +270,10 @@ void json_add_timeabs(struct json_stream *result UNNEEDED, const char *fieldname
void json_add_txid(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
const struct bitcoin_txid *txid UNNEEDED)
{ fprintf(stderr, "json_add_txid called!\n"); abort(); }
/* Generated stub for json_add_u32 */
void json_add_u32(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
uint32_t value UNNEEDED)
{ fprintf(stderr, "json_add_u32 called!\n"); abort(); }
/* Generated stub for json_add_u64 */
void json_add_u64(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
uint64_t value UNNEEDED)
@ -332,10 +335,6 @@ bool json_to_number(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
/* Generated stub for json_to_preimage */
bool json_to_preimage(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, struct preimage *preimage UNNEEDED)
{ fprintf(stderr, "json_to_preimage called!\n"); abort(); }
/* Generated stub for json_to_pubkey */
bool json_to_pubkey(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
struct pubkey *pubkey UNNEEDED)
{ fprintf(stderr, "json_to_pubkey called!\n"); abort(); }
/* Generated stub for json_to_short_channel_id */
bool json_to_short_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
struct short_channel_id *scid UNNEEDED,

Loading…
Cancel
Save