-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
channeld: remove dead HTLCs from htable and free them (eventually) #5882
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -266,14 +266,16 @@ static void send_and_fulfill_htlc(struct channel *channel, | |||||||
struct sha256 rhash; | ||||||||
u8 *dummy_routing = tal_arr(channel, u8, TOTAL_PACKET_SIZE); | ||||||||
bool ret; | ||||||||
const struct htlc **changed_htlcs; | ||||||||
const struct htlc *htlc, **changed_htlcs; | ||||||||
|
||||||||
memset(&r, 0, sizeof(r)); | ||||||||
sha256(&rhash, &r, sizeof(r)); | ||||||||
|
||||||||
assert(channel_add_htlc(channel, sender, 1337, msatoshi, 900, &rhash, | ||||||||
dummy_routing, NULL, NULL, NULL) | ||||||||
== CHANNEL_ERR_ADD_OK); | ||||||||
htlc = channel_get_htlc(channel, sender, 1337); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please make 1337 a variable and use it everywhere |
||||||||
assert(htlc); | ||||||||
|
||||||||
changed_htlcs = tal_arr(channel, const struct htlc *, 0); | ||||||||
|
||||||||
|
@@ -297,8 +299,7 @@ static void send_and_fulfill_htlc(struct channel *channel, | |||||||
assert(ret); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
ret = channel_rcvd_revoke_and_ack(channel, &changed_htlcs); | ||||||||
assert(!ret); | ||||||||
assert(channel_get_htlc(channel, sender, 1337)->state | ||||||||
== RCVD_REMOVE_ACK_REVOCATION); | ||||||||
assert(htlc->state == RCVD_REMOVE_ACK_REVOCATION); | ||||||||
} else { | ||||||||
ret = channel_rcvd_commit(channel, &changed_htlcs); | ||||||||
assert(ret); | ||||||||
|
@@ -318,9 +319,9 @@ static void send_and_fulfill_htlc(struct channel *channel, | |||||||
assert(ret); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
ret = channel_sending_revoke_and_ack(channel); | ||||||||
assert(!ret); | ||||||||
assert(channel_get_htlc(channel, sender, 1337)->state | ||||||||
== SENT_REMOVE_ACK_REVOCATION); | ||||||||
assert(htlc->state == SENT_REMOVE_ACK_REVOCATION); | ||||||||
} | ||||||||
assert(!channel_get_htlc(channel, sender, 1337)); | ||||||||
} | ||||||||
|
||||||||
static void update_feerate(struct channel *channel, u32 feerate) | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe drop a short comment on what dead precisely means for safety-of-deletion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe whoever named the function originally should write the comment. I almost deleted the function entirely since it's an implementation detail that doesn't belong in the public interface (i.e., the header file), but I left it there to minimize the diff.