diff options
author | Matt Corallo <git@bluematt.me> | 2017-09-20 20:19:14 -0400 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2017-09-20 23:29:59 -0400 |
commit | 28d4542a0ac77a30a242d0568e580a5b437f53fa (patch) | |
tree | f21f03c770beb8586aef0fede0d18e089471882c /src/bitcoin-tx.cpp | |
parent | 98212745c8acb5cc4e688bbb3979bfd46b25f98a (diff) |
Disallow uncompressed pubkeys in bitcoin-tx [multisig] output adds
Diffstat (limited to 'src/bitcoin-tx.cpp')
-rw-r--r-- | src/bitcoin-tx.cpp | 8 |
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); } |