Skip to content

Correct htlc witness size calculations - #815

Merged
t-bast merged 4 commits into
lightning:masterfrom
halseth:htlc-witness-size
Dec 7, 2020
Merged

t-bast merged 4 commits into
lightning:masterfrom
halseth:htlc-witness-size

Conversation

@halseth

@halseth halseth commented Nov 11, 2020

Copy link
Copy Markdown
Contributor

I noticed a few inconsistencies in the weight constants.

I guess implementations just use the hardcoded constants for HTLC-timeout and HTLC-success when doing tx constructions (this is what lnd does), so I added a note here that we should continue using this value even though it is off by one.

@halseth halseth changed the title Htlc witness size Correct htlc witness size calculations Nov 11, 2020
@TheBlueMatt

Copy link
Copy Markdown
Collaborator

Is this an artifact of signature size variation? I mean there is no "right" answer after you sign things vary a byte or two, but is the limit wrong because we didn't account for low-S implying signatures are never max size?

@halseth

halseth commented Nov 12, 2020

Copy link
Copy Markdown
Contributor Author

We always assume they are the worst case size (73). Are you saying signatures never actually get that large? Interesting.

@t-bast

t-bast commented Nov 12, 2020

Copy link
Copy Markdown
Collaborator

Wow good catch, I don't understand why we considered this cltv_expiry to be encoded with 3 bytes (and how the success_witness turned out to be incorrect...). Time for some git speleology

@t-bast t-bast mentioned this pull request Nov 16, 2020
5 of 14 tasks
Comment thread 03-transactions.md Outdated
663 (HTLC-timeout) (666 with with option_anchor_outputs))
703 (HTLC-success) (706 with with option_anchor_outputs))
703 (HTLC-success) (706 with with option_anchor_outputs))
- (reeeally 702 and 705, but we use these numbers for historical reasons)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

@t-bast

t-bast commented Nov 24, 2020

Copy link
Copy Markdown
Collaborator

I re-did the calculations and I agree with what you found.
Can someone else check again to keep me honest?

Comment thread 03-transactions.md Outdated

663 (HTLC-timeout) (666 with with option_anchor_outputs))
703 (HTLC-success) (706 with with option_anchor_outputs))
703 (HTLC-success) (706 with with option_anchor_outputs))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with with is probably a typo, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most certainly

@t-bast t-bast left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 2a8da1a

@t-bast
t-bast merged commit d0c8385 into lightning:master Dec 7, 2020
halseth added a commit to halseth/lightning-rfc that referenced this pull request Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants