Skip to content

Commit

Permalink
channeld: wip: be able to handle the update htlc by handling the endo…
Browse files Browse the repository at this point in the history
…rsed field

Signed-off-by: Vincenzo Palazzo <[email protected]>
  • Loading branch information
vincenzopalazzo committed Oct 4, 2023
1 parent 2c24def commit d15c4c8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion channeld/channeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,7 @@ static void handle_peer_add_htlc(struct peer *peer, const u8 *msg)
add_err = channel_add_htlc(peer->channel, REMOTE, id, amount,
cltv_expiry, &payment_hash,
onion_routing_packet, tlvs->blinding_point, &htlc, NULL,
tlvs->endorsed,
/* We don't immediately fail incoming htlcs,
* instead we wait and fail them after
* they've been committed */
Expand Down Expand Up @@ -5270,7 +5271,7 @@ static void handle_offer_htlc(struct peer *peer, const u8 *inmsg)
e = channel_add_htlc(peer->channel, LOCAL, peer->htlc_id,
amount, cltv_expiry, &payment_hash,
onion_routing_packet, take(blinding), NULL,
&htlc_fee, true);
&htlc_fee, false, true);
status_debug("Adding HTLC %"PRIu64" amount=%s cltv=%u gave %s",
peer->htlc_id,
type_to_string(tmpctx, struct amount_msat, &amount),
Expand Down
1 change: 1 addition & 0 deletions channeld/full_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,7 @@ enum channel_add_err channel_add_htlc(struct channel *channel,
const struct pubkey *blinding TAKES,
struct htlc **htlcp,
struct amount_sat *htlc_fee,
const bool endorsed,
bool err_immediate_failures)
{
enum htlc_state state;
Expand Down
1 change: 1 addition & 0 deletions channeld/full_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ enum channel_add_err channel_add_htlc(struct channel *channel,
const struct pubkey *blinding TAKES,
struct htlc **htlcp,
struct amount_sat *htlc_fee,
const bool endorsed,
bool err_immediate_failures);

/**
Expand Down
4 changes: 2 additions & 2 deletions channeld/test/run-full_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static const struct htlc **include_htlcs(struct channel *channel, enum side side
memset(&preimage, i, sizeof(preimage));
sha256(&hash, &preimage, sizeof(preimage));
e = channel_add_htlc(channel, sender, i, msatoshi, 500+i, &hash,
dummy_routing, NULL, NULL, NULL, true);
dummy_routing, NULL, NULL, NULL, false, true);
assert(e == CHANNEL_ERR_ADD_OK);
htlcs[i] = channel_get_htlc(channel, sender, i);
}
Expand Down Expand Up @@ -260,7 +260,7 @@ static void send_and_fulfill_htlc(struct channel *channel,
sha256(&rhash, &r, sizeof(r));

assert(channel_add_htlc(channel, sender, 1337, msatoshi, 900, &rhash,
dummy_routing, NULL, NULL, NULL, true)
dummy_routing, NULL, NULL, NULL, false, true)
== CHANNEL_ERR_ADD_OK);
htlc = channel_get_htlc(channel, sender, 1337);
assert(htlc);
Expand Down

0 comments on commit d15c4c8

Please sign in to comment.