sipa / bitcoin

Bitcoin integration/staging tree
http://www.bitcoin.org
MIT License
88 stars 21 forks source link

test: bypass the protection with importaddress #105

Closed jl2012 closed 5 years ago

jl2012 commented 7 years ago

What I'm trying to do:

  1. For P2PK and Multisig, if SIGVERSION_WITNESS_V0, check the key size and return ISMINE_NO if an uncompressed key is found
  2. For P2PKH, if SIGVERSION_WITNESS_V0 and the address is solvable, check the key size and return ISMINE_NO if an uncompressed key is found
  3. P2SH or P2WSH will return ISMINE_NO if the subscript is ISMINE_NO
  4. addwitnessaddress will only return an address for P2WSH if it is at least solvable (I don't think my test covers this)
jl2012 commented 7 years ago

The objective is to:

  1. Not to allow any watch only segwit uncompressed scripts
  2. addwitnessaddress not to return a P2SH-P2WSH address if the address is not solvable (potentially unspendable)
jl2012 commented 7 years ago

The key size check in HaveKey becomes redundant now. Made another version without that: https://github.com/jl2012/bitcoin/commits/badwitnesscheck-1012