[bitcoin/bitcoin] Accurately determine the use of SIGHASH_SINGLE in signing (#13357)

We should use exactly the same code to determine the use of SIGHASH_SINGLE, in both validation and signing.

The existing signing code is safe because SIGHASH is restricted to 6 types. However, if further types are introduced (e.g. SIGHASH_NOINPUT) and we forget to make changes here, people might accidentally sign with SIGHASH_SINGLE when there is no corresponding output and lose money. So it’s better to fix it when we still remember
You can view, comment on, or merge this pull request online at:

https://github.com/bitcoin/bitcoin/pull/13357

— Commit Summary —

* Accurately determine the use of SIGHASH_SINGLE in signing

— File Changes —

M src/bitcoin-tx.cpp (2)
M src/rpc/rawtransaction.cpp (2)

— Patch Links —

https://github.com/bitcoin/bitcoin/pull/13357.patch
https://github.com/bitcoin/bitcoin/pull/13357.diff

Запись редактировалась последний раз: May 31, 2018, 1:21 pm