Redundant code inside validation.cpp #22761

issue janus openend this issue on August 21, 2021
  1. janus commented at 11:47 am on August 21, 2021: none

    This is not an issue at all. But inside validation.cpp some code line might need some clean up. Second block.vtx.empty() is not needed. Check the code below.

    0// Size limits
    1    if (block.vtx.empty() || block.vtx.size() * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT || ::GetSerializeSize(block, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT)
    2        return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-blk-length", "size limits failed");
    3
    4    // First transaction must be coinbase, the rest must not be
    5    if (block.vtx.empty() || !block.vtx[0]->IsCoinBase())
    
  2. janus added the label Bug on Aug 21, 2021
  3. fanquake removed the label Bug on Aug 23, 2021
  4. jadijadi commented at 8:02 am on August 23, 2021: contributor
    It seems the 2nd block.vtx.empty() is not needed. May I send a PR after fixing this and reviewing the file for other duplicates (and fixing them if any)?
  5. janus commented at 8:15 am on August 23, 2021: none
    @jadijadi I found this issue, it would be great if I send the PR. However, I would like to get involved in the code base .
  6. jadijadi commented at 8:50 am on August 23, 2021: contributor

    @jadijadi I found this issue, it would be great if I send the PR. However, I would like to get involved in the code base .

    Yes sure! Please do. I thought you are not going to and just reporting it.

  7. fanquake commented at 9:09 am on August 23, 2021: member
    @janus feel free to open a PR. In general, we don’t need issues opened for things like this.
  8. fanquake closed this on Aug 23, 2021

  9. janus commented at 9:50 am on August 23, 2021: none

    @janus feel free to open a PR. In general, we don’t need issues opened for things like this. @fanquake I won’t report stuff like this again.

  10. DrahtBot locked this on Aug 23, 2022

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: 2024-09-29 04:12 UTC

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