Remove template matching params from switch-cases in GetOpName() #4260

pull 4tar wants to merge 1 commits into bitcoin:master from 4tar:opname changing 1 files +5 −6
  1. 4tar commented at 3:21 PM on May 30, 2014: contributor

    Several op's name are missed in the GetOpName(), add them back and sort in order.

    Signed-off-by: Huang Le 4tarhl@gmail.com

  2. gavinandresen commented at 3:27 PM on May 30, 2014: contributor

    NAK. In my opinion, GetOpName should return "OP_UNKNOWN" for the template-matching pseudo-opcodes (they are not real opcodes).

    Because GetOpName is used for human-readable decoding of Scripts, and if 0xf9 appears in a Script then it would be less confusing for it to appear as OP_UNKNOWN rather than OP_SMALLDATA.

  3. sipa commented at 3:35 PM on May 30, 2014: member

    Agree with Gavin.

    The fact that we use pseudo opcodes for template matching is an implementation-specific hack.

  4. 4tar commented at 4:04 PM on May 30, 2014: contributor

    @gavinandresen @sipa Got your point. The current code has already give op name for 3 of 5 template matching code (OP_PUBKEYHASH / OP_PUBKEY / OP_SMALLDATA) while leave the other 2 out (OP_PUBKEYS / OP_SMALLINTEGER), do we prefer to change all 5 to be OP_UNKNOWN in GetOpName() or just keep it the current way?

  5. gavinandresen commented at 5:12 PM on May 30, 2014: contributor

    I'd suggest removing the three that are there now and replacing them with a comment:

    // Note: OP_SMALLDATA/etc are not real opcodes. If they appear in real Script data, // let the default: switch case report them as OP_UNKNOWN.

  6. 4tar commented at 5:13 PM on May 30, 2014: contributor

    @gmaxwell Got it. Will re-submit a PR according to your advice soon.

  7. Remove template matching params from GetOpName()
    Since they are not real opcodes, being reported as OP_UNKNOWN is less confusing for human-readable decoding.
    
    Signed-off-by: Huang Le <4tarhl@gmail.com>
    aab2c0fd7e
  8. 4tar restored the branch on May 30, 2014
  9. BitcoinPullTester commented at 5:46 PM on May 30, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/aab2c0fd7e7f629b20192ab9f05b281e5783cacc for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  10. jgarzik commented at 11:08 PM on May 30, 2014: contributor

    ACK [updated^Wrewritten patch]

  11. laanwj commented at 7:49 AM on June 1, 2014: member

    ACK

  12. 4tar renamed this:
    Add missed cases in GetOpName()
    Remove template matching params from switch-cases in GetOpName()
    on Jun 1, 2014
  13. laanwj merged this on Jun 4, 2014
  14. laanwj closed this on Jun 4, 2014

  15. laanwj referenced this in commit d24310d23a on Jun 4, 2014
  16. 4tar deleted the branch on Jun 5, 2014
  17. MarcoFalke locked this on Sep 8, 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-29 03:16 UTC

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