Skip to content

Fix crash when a claim tx has some non-witness inputs. #446

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

Closed

Conversation

TheBlueMatt
Copy link
Collaborator

The logger which decides what to refer to an on-chain claim tx was
assuming that all inputs would have a witness. While this was fine
for the one-input case, it broke the fuzzer which was connecting a
consensus-invalid transaction. Further, in the case we have multiple
inputs, some may not have a witness, which we shouldn't crash on.

This fixes 9df0250.

The logger which decides what to refer to an on-chain claim tx was
assuming that all inputs would have a witness. While this was fine
for the one-input case, it broke the fuzzer which was connecting a
consensus-invalid transaction. Further, in the case we have multiple
inputs, some may not have a witness, which we shouldn't crash on.

This fixes 9df0250.
Copy link

@ariard ariard left a comment

Choose a reason for hiding this comment

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

You should take this one first, and then I'll rebase on top #447 to use new weight_to_htlctype method here too

for inp in &self.0.input {
if !inp.witness.is_empty() {
if inp.witness.last().unwrap().len() == 133 { write!(f, "preimage tx")?; break }
else if inp.witness.last().unwrap().len() == 138 { write!(f, "timeout tx")?; break }
Copy link

Choose a reason for hiding this comment

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

need to adapter printer here, we may aggregate tx and so a tx may be both preimage + timeout, so "Broadcast onchain preimage-timeout-preimage-... tx", dunno if it's clear enough for reader

@ariard
Copy link

ariard commented Jan 17, 2020

Part of #447

@ariard ariard closed this Jan 17, 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.

2 participants