mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Disallow uncompressed pubkeys in bitcoin-tx [multisig] output adds
This commit is contained in:
@@ -310,6 +310,9 @@ static void MutateTxAddOutPubKey(CMutableTransaction& tx, const std::string& str
|
||||
}
|
||||
|
||||
if (bSegWit) {
|
||||
if (!pubkey.IsCompressed()) {
|
||||
throw std::runtime_error("Uncompressed pubkeys are not useable for SegWit outputs");
|
||||
}
|
||||
// Call GetScriptForWitness() to build a P2WSH scriptPubKey
|
||||
scriptPubKey = GetScriptForWitness(scriptPubKey);
|
||||
}
|
||||
@@ -375,6 +378,11 @@ static void MutateTxAddOutMultiSig(CMutableTransaction& tx, const std::string& s
|
||||
CScript scriptPubKey = GetScriptForMultisig(required, pubkeys);
|
||||
|
||||
if (bSegWit) {
|
||||
for (CPubKey& pubkey : pubkeys) {
|
||||
if (!pubkey.IsCompressed()) {
|
||||
throw std::runtime_error("Uncompressed pubkeys are not useable for SegWit outputs");
|
||||
}
|
||||
}
|
||||
// Call GetScriptForWitness() to build a P2WSH scriptPubKey
|
||||
scriptPubKey = GetScriptForWitness(scriptPubKey);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user