|
1 | | -// Copyright (c) 2011-2015 The Bitcoin Core developers |
| 1 | +// Copyright (c) 2011-2016 The Bitcoin Core developers |
2 | 2 | // Distributed under the MIT software license, see the accompanying |
3 | 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
4 | 4 |
|
@@ -55,7 +55,8 @@ static std::map<string, unsigned int> mapFlagNames = boost::assign::map_list_of |
55 | 55 | (string("CHECKLOCKTIMEVERIFY"), (unsigned int)SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY) |
56 | 56 | (string("CHECKSEQUENCEVERIFY"), (unsigned int)SCRIPT_VERIFY_CHECKSEQUENCEVERIFY) |
57 | 57 | (string("WITNESS"), (unsigned int)SCRIPT_VERIFY_WITNESS) |
58 | | - (string("DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM"), (unsigned int)SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM); |
| 58 | + (string("DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM"), (unsigned int)SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM) |
| 59 | + (string("WITNESS_PUBKEYTYPE"), (unsigned int)SCRIPT_VERIFY_WITNESS_PUBKEYTYPE); |
59 | 60 |
|
60 | 61 | unsigned int ParseScriptFlags(string strFlags) |
61 | 62 | { |
@@ -429,7 +430,7 @@ BOOST_AUTO_TEST_CASE(test_big_witness_transaction) { |
429 | 430 | mtx.nVersion = 1; |
430 | 431 |
|
431 | 432 | CKey key; |
432 | | - key.MakeNewKey(false); |
| 433 | + key.MakeNewKey(true); // Need to use compressed keys in segwit or the signing will fail |
433 | 434 | CBasicKeyStore keystore; |
434 | 435 | keystore.AddKeyPubKey(key, key.GetPubKey()); |
435 | 436 | CKeyID hash = key.GetPubKey().GetID(); |
@@ -625,30 +626,13 @@ BOOST_AUTO_TEST_CASE(test_witness) |
625 | 626 | CheckWithFlag(output1, input2, SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_P2SH, false); |
626 | 627 | CheckWithFlag(output1, input2, STANDARD_SCRIPT_VERIFY_FLAGS, false); |
627 | 628 |
|
628 | | - // Witness pay-to-uncompressed-pubkey (v1). |
629 | | - CreateCreditAndSpend(keystore, GetScriptForWitness(scriptPubkey1L), output1, input1); |
630 | | - CreateCreditAndSpend(keystore, GetScriptForWitness(scriptPubkey2L), output2, input2); |
631 | | - CheckWithFlag(output1, input1, 0, true); |
632 | | - CheckWithFlag(output1, input1, SCRIPT_VERIFY_P2SH, true); |
633 | | - CheckWithFlag(output1, input1, SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_P2SH, true); |
634 | | - CheckWithFlag(output1, input1, STANDARD_SCRIPT_VERIFY_FLAGS, true); |
635 | | - CheckWithFlag(output1, input2, 0, true); |
636 | | - CheckWithFlag(output1, input2, SCRIPT_VERIFY_P2SH, true); |
637 | | - CheckWithFlag(output1, input2, SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_P2SH, false); |
638 | | - CheckWithFlag(output1, input2, STANDARD_SCRIPT_VERIFY_FLAGS, false); |
| 629 | + // Signing disabled for witness pay-to-uncompressed-pubkey (v1). |
| 630 | + CreateCreditAndSpend(keystore, GetScriptForWitness(scriptPubkey1L), output1, input1, false); |
| 631 | + CreateCreditAndSpend(keystore, GetScriptForWitness(scriptPubkey2L), output2, input2, false); |
639 | 632 |
|
640 | | - // P2SH witness pay-to-uncompressed-pubkey (v1). |
641 | | - CreateCreditAndSpend(keystore, GetScriptForDestination(CScriptID(GetScriptForWitness(scriptPubkey1L))), output1, input1); |
642 | | - CreateCreditAndSpend(keystore, GetScriptForDestination(CScriptID(GetScriptForWitness(scriptPubkey2L))), output2, input2); |
643 | | - ReplaceRedeemScript(input2.vin[0].scriptSig, GetScriptForWitness(scriptPubkey1L)); |
644 | | - CheckWithFlag(output1, input1, 0, true); |
645 | | - CheckWithFlag(output1, input1, SCRIPT_VERIFY_P2SH, true); |
646 | | - CheckWithFlag(output1, input1, SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_P2SH, true); |
647 | | - CheckWithFlag(output1, input1, STANDARD_SCRIPT_VERIFY_FLAGS, true); |
648 | | - CheckWithFlag(output1, input2, 0, true); |
649 | | - CheckWithFlag(output1, input2, SCRIPT_VERIFY_P2SH, true); |
650 | | - CheckWithFlag(output1, input2, SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_P2SH, false); |
651 | | - CheckWithFlag(output1, input2, STANDARD_SCRIPT_VERIFY_FLAGS, false); |
| 633 | + // Signing disabled for P2SH witness pay-to-uncompressed-pubkey (v1). |
| 634 | + CreateCreditAndSpend(keystore, GetScriptForDestination(CScriptID(GetScriptForWitness(scriptPubkey1L))), output1, input1, false); |
| 635 | + CreateCreditAndSpend(keystore, GetScriptForDestination(CScriptID(GetScriptForWitness(scriptPubkey2L))), output2, input2, false); |
652 | 636 |
|
653 | 637 | // Normal 2-of-2 multisig |
654 | 638 | CreateCreditAndSpend(keystore, scriptMulti, output1, input1, false); |
|
0 commit comments