mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-15 07:03:40 +01:00
Require compressed keys in segwit as policy and disable signing with uncompressed keys for segwit scripts
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2016 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -26,6 +26,10 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig,
|
||||
if (!keystore->GetKey(address, key))
|
||||
return false;
|
||||
|
||||
// Signing with uncompressed keys is disabled in witness scripts
|
||||
if (sigversion == SIGVERSION_WITNESS_V0 && !key.IsCompressed())
|
||||
return false;
|
||||
|
||||
uint256 hash = SignatureHash(scriptCode, *txTo, nIn, nHashType, amount, sigversion);
|
||||
if (!key.Sign(hash, vchSig))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user