Incorrect or duplicate assertion in key.cpp signing code #15286

issue maaku opened this issue on January 29, 2019
  1. maaku commented at 7:49 PM on January 29, 2019: contributor

    The following assertion seems redundant. Is it a mistake? Two lines prior the same assertion is made, and the value being asserted doesn't appear to change in-between. However the next line asserts a condition on a different variable which differs by only one letter. Is the referenced line a duplicate assertion of ret and therefore redundant, or is it supposed to be assert(rec)?

    https://github.com/bitcoin/bitcoin/blob/7275365c9bc7e7ebd6bbf7dcb251946aac44b5de/src/key.cpp#L247-L251

  2. sipa commented at 8:29 PM on January 29, 2019: member

    Thanks for pointing this out. It looks like the line is redundant indeed. rec can take any value from 0 to 3 inclusive, so assert(rec) would be wrong.

  3. promag commented at 3:03 PM on January 31, 2019: member

    I think ret must be updated in L249. If that's the case a fix is in #15299.

  4. laanwj closed this on Jan 31, 2019

  5. laanwj referenced this in commit 4b6673d382 on Jan 31, 2019
  6. PastaPastaPasta referenced this in commit 15840af8b7 on Jun 27, 2021
  7. PastaPastaPasta referenced this in commit 924794db7a on Jun 28, 2021
  8. PastaPastaPasta referenced this in commit 5d1d202bc0 on Jun 28, 2021
  9. PastaPastaPasta referenced this in commit 8846f79220 on Jun 29, 2021
  10. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me