aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-09-26 12:27:22 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-09-26 12:27:37 +0200
commit67879b7c443144e479c763f64abb9c1ed7e44eaa (patch)
tree49d2b2a41279c49fe5b1771120cf54e51d53684b /src
parent8cf88b4aaeaf4f7446fea6dc6d2402a9cc9368eb (diff)
parent28d4542a0ac77a30a242d0568e580a5b437f53fa (diff)
downloadbitcoin-67879b7c443144e479c763f64abb9c1ed7e44eaa.tar.xz
Merge #11377: Disallow uncompressed pubkeys in bitcoin-tx [multisig] output adds
28d4542 Disallow uncompressed pubkeys in bitcoin-tx [multisig] output adds (Matt Corallo) Pull request description: Does what it says on the tin. Tree-SHA512: 324b8da8a9f9a35d3ade74f6c587f981894a085dfea9d64f78de745d5e6ec05c3a7bced487e9aad9c8a48151cd14969a0806f30f80b621edfce0da082fe6f4be
Diffstat (limited to 'src')
-rw-r--r--src/bitcoin-tx.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
index d8d7934bf6..e4f44435ba 100644
--- a/src/bitcoin-tx.cpp
+++ b/src/bitcoin-tx.cpp
@@ -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);
}