Skip to content

Conversation

whitslack
Copy link
Collaborator

Change amount can vary slightly. Exact comparisons cause test flakiness.

Sometimes I get an AssertionError because the change output is 15586 sat instead of the expected 15579 sat. Maybe this is due to a shorter-than-usual signature encoding. Use pytest.approx to allow the actual change amount to be within 7 sat of 15579 sat. (If the discrepancy is indeed due to a short signature encoding, then this could still be too strict, with a probability of 1 in 256, as theoretically a signature component could have a value arbitrarily close to zero.)

Checklist

Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:

  • The changelog has been updated in the relevant commit(s) according to the guidelines.
  • Tests have been added or modified to reflect the changes.
  • Documentation has been reviewed and updated as needed.
  • Related issues have been listed and linked, including any that this PR closes. None found.

Change amount can vary slightly. Exact comparisons cause test flakiness.

Changelog-None
@rustyrussell
Copy link
Contributor

But we are supposed to detect short sigs and skip this test! I've been meaning to diagnose why that doesn't work...

@whitslack
Copy link
Collaborator Author

Something has been bugging me about this. Isn't there a chicken-or-egg situation here? How can the value of a change output vary depending on the length of a signature encoding if the signature covers that change output? Is the signature here a SIGHASH_NONE or SIGHASH_SINGLE rather than a SIGHASH_ALL, such that the signature can be computed before we've decided on the change amount?

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