Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
8 participants
@sipa
Copy link
Member

sipa commented Apr 25, 2018

Reported by arubi on IRC.

@laanwj

This comment has been minimized.

Copy link
Member

laanwj commented Apr 26, 2018

Needs a unit test, I think.

@laanwj laanwj added the Wallet label Apr 26, 2018

@MarcoFalke

This comment has been minimized.

Copy link
Member

MarcoFalke commented Apr 26, 2018

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

@fivepiece

This comment has been minimized.

Copy link
Contributor

fivepiece commented Apr 26, 2018

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
}
@laanwj

This comment has been minimized.

Copy link
Member

laanwj commented Apr 27, 2018

Thanks for testing @fivepiece

@melG81

melG81 approved these changes Apr 27, 2018

@laanwj

This comment has been minimized.

Copy link
Member

laanwj commented May 7, 2018

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?

@fanquake

This comment has been minimized.

Copy link
Member

fanquake commented Jul 18, 2018

@sipa Would this be good to get into 0.17.0?

@DrahtBot DrahtBot closed this Jul 22, 2018

@DrahtBot

This comment has been minimized.

Copy link
Contributor

DrahtBot commented Jul 22, 2018

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

@DrahtBot DrahtBot reopened this Jul 22, 2018

@MeshCollider

This comment has been minimized.

Copy link
Member

MeshCollider commented Nov 9, 2018

utACK 5af7625 but as @laanwj says, looks like transaction_tests.cpp also needs updating

@laanwj

This comment has been minimized.

Copy link
Member

laanwj commented Jan 9, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.