Do not turn OP_1NEGATE in scriptSig into 0x0181 in signing code #13084

pull sipa wants to merge 1 commits into bitcoin:master from sipa:201804_keepnegone changing 1 files +2 −0
  1. sipa commented at 11:50 PM on April 25, 2018: member

    Reported by arubi on IRC.

  2. Do not turn OP_1NEGATE in scriptSig into 0x0181 in signing code 5af7625079
  3. laanwj commented at 6:12 AM on April 26, 2018: member

    Needs a unit test, I think.

  4. laanwj added the label Wallet on Apr 26, 2018
  5. MarcoFalke commented at 12:03 PM on April 26, 2018: member

    Yeah, a test makes sense for this function, since it is not particularly well covered: https://marcofalke.github.io/btc_cov/total.coverage/src/script/sign.cpp.gcov.html

  6. fivepiece commented at 9:32 PM on April 26, 2018: contributor

    ACK on the fix! Many thanks for looking into it :)

    Before :

    $ bitcoin-cli -regtest signrawtransactionwithwallet \
    0200000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000044F024F9CFDFFFFFF01F0B9F505000000002321027777777777777777777777777777777777777777777777777777777777777777AC66030000 \
    '[{"txid":"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","vout":0,"scriptPubKey":"A914AE44AB6E9AA0B71F1CD2B453B69340E9BFBAEF6087","redeemScript":"4F9C","amount":1}]'
    
    {                                                                                             VVVV
      "hex": "0200000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000050181024f9cfdffffff01f0b9f505000000002321027777777777777777777777777777777777777777777777777777777777777777ac66030000",
      "complete": false,
      "errors": [
        {
          "txid": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
          "vout": 0,
          "witness": [
          ],
          "scriptSig": "0181024f9c",
          "sequence": 4294967293,
          "error": "Data push larger than necessary"
        }
      ]
    }
    

    After:

    $ bitcoin-cli -regtest signrawtransactionwithwallet \
    0200000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000044F024F9CFDFFFFFF01F0B9F505000000002321027777777777777777777777777777777777777777777777777777777777777777AC66030000 \
    '[{"txid":"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","vout":0,"scriptPubKey":"A914AE44AB6E9AA0B71F1CD2B453B69340E9BFBAEF6087","redeemScript":"4F9C","amount":1}]' \
    
    {                                                                                             VV
      "hex": "0200000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000044f024f9cfdffffff01f0b9f505000000002321027777777777777777777777777777777777777777777777777777777777777777ac66030000",
      "complete": true
    }
    
  7. laanwj commented at 8:23 AM on April 27, 2018: member

    Thanks for testing @fivepiece

  8. melG81 approved
  9. laanwj commented at 12:56 PM on May 7, 2018: member

    It looks like there is a copy of this function in src/test/transaction_tests.cpp: static CScript PushAll(const std::vector<valtype>& values) used in ReplaceRedeemScript. Does this need update as well?

  10. fanquake commented at 7:48 AM on July 18, 2018: member

    @sipa Would this be good to get into 0.17.0?

  11. DrahtBot closed this on Jul 22, 2018

  12. DrahtBot reopened this on Jul 22, 2018

  13. meshcollider commented at 8:59 AM on November 9, 2018: contributor

    utACK https://github.com/bitcoin/bitcoin/pull/13084/commits/5af76250792b3bc7cedfdc8cd036ba4dcdb844c6 but as @laanwj says, looks like transaction_tests.cpp also needs updating

  14. laanwj commented at 3:24 PM on January 9, 2019: member

    looks like transaction_tests.cpp also needs updating

    Can you please at least comment on this @sipa? If the answer is no that's fine and this can be merged.

  15. DrahtBot closed this on Apr 28, 2019

  16. DrahtBot commented at 7:11 PM on April 28, 2019: member

    <!--5d09a71f8925f3f132321140b44b946d-->The last travis run for this pull request was 279 days ago and is thus outdated. To trigger a fresh travis build, this pull request should be closed and re-opened.

  17. DrahtBot reopened this on Apr 28, 2019

  18. meshcollider commented at 10:59 AM on October 21, 2019: contributor

    Re-opened in #17204

  19. meshcollider closed this on Oct 21, 2019

  20. laanwj referenced this in commit 4d4bd5ed74 on Aug 14, 2020
  21. sidhujag referenced this in commit f593e66ad8 on Aug 16, 2020
  22. DrahtBot locked this on Feb 15, 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: 2026-04-13 18:15 UTC

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