diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-05-30 10:23:21 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-06-21 06:40:33 -0400 |
commit | fa95a694c492b267e4038674fd3f338dd215ab48 (patch) | |
tree | 5e4e4dbb1c6cdbb9760a6b2816cb4398a7532241 /src | |
parent | fa58469c770d8c935a86462634e4e8cd806aa6e3 (diff) | |
download | bitcoin-fa95a694c492b267e4038674fd3f338dd215ab48.tar.xz |
doc: Update outdated txnouttype documentation
Also, remove scope of txnouttype in fuzz tests temporarily. The next
commit will add scopes to all txnouttype.
Diffstat (limited to 'src')
-rw-r--r-- | src/script/standard.cpp | 2 | ||||
-rw-r--r-- | src/script/standard.h | 5 | ||||
-rw-r--r-- | src/test/fuzz/key.cpp | 8 | ||||
-rw-r--r-- | src/test/script_standard_tests.cpp | 4 |
4 files changed, 9 insertions, 10 deletions
diff --git a/src/script/standard.cpp b/src/script/standard.cpp index 2adf6ce56d..35794deafa 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -56,7 +56,7 @@ std::string GetTxnOutputType(txnouttype t) case TX_WITNESS_V0_KEYHASH: return "witness_v0_keyhash"; case TX_WITNESS_V0_SCRIPTHASH: return "witness_v0_scripthash"; case TX_WITNESS_UNKNOWN: return "witness_unknown"; - } + } // no default case, so the compiler can warn about missing cases assert(false); } diff --git a/src/script/standard.h b/src/script/standard.h index 4baed6da6e..1dbae9d568 100644 --- a/src/script/standard.h +++ b/src/script/standard.h @@ -116,8 +116,7 @@ extern unsigned nMaxDatacarrierBytes; */ static const unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS = SCRIPT_VERIFY_P2SH; -enum txnouttype -{ +enum txnouttype { TX_NONSTANDARD, // 'standard' transaction types: TX_PUBKEY, @@ -212,7 +211,7 @@ typedef boost::variant<CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, /** Check whether a CTxDestination is a CNoDestination. */ bool IsValidDestination(const CTxDestination& dest); -/** Get the name of a txnouttype as a C string, or nullptr if unknown. */ +/** Get the name of a txnouttype as a string */ std::string GetTxnOutputType(txnouttype t); /** diff --git a/src/test/fuzz/key.cpp b/src/test/fuzz/key.cpp index 1919a5f881..b8541fd037 100644 --- a/src/test/fuzz/key.cpp +++ b/src/test/fuzz/key.cpp @@ -160,22 +160,22 @@ void test_one_input(const std::vector<uint8_t>& buffer) txnouttype which_type_tx_pubkey; const bool is_standard_tx_pubkey = IsStandard(tx_pubkey_script, which_type_tx_pubkey); assert(is_standard_tx_pubkey); - assert(which_type_tx_pubkey == txnouttype::TX_PUBKEY); + assert(which_type_tx_pubkey == TX_PUBKEY); txnouttype which_type_tx_multisig; const bool is_standard_tx_multisig = IsStandard(tx_multisig_script, which_type_tx_multisig); assert(is_standard_tx_multisig); - assert(which_type_tx_multisig == txnouttype::TX_MULTISIG); + assert(which_type_tx_multisig == TX_MULTISIG); std::vector<std::vector<unsigned char>> v_solutions_ret_tx_pubkey; const txnouttype outtype_tx_pubkey = Solver(tx_pubkey_script, v_solutions_ret_tx_pubkey); - assert(outtype_tx_pubkey == txnouttype::TX_PUBKEY); + assert(outtype_tx_pubkey == TX_PUBKEY); assert(v_solutions_ret_tx_pubkey.size() == 1); assert(v_solutions_ret_tx_pubkey[0].size() == 33); std::vector<std::vector<unsigned char>> v_solutions_ret_tx_multisig; const txnouttype outtype_tx_multisig = Solver(tx_multisig_script, v_solutions_ret_tx_multisig); - assert(outtype_tx_multisig == txnouttype::TX_MULTISIG); + assert(outtype_tx_multisig == TX_MULTISIG); assert(v_solutions_ret_tx_multisig.size() == 3); assert(v_solutions_ret_tx_multisig[0].size() == 1); assert(v_solutions_ret_tx_multisig[1].size() == 33); diff --git a/src/test/script_standard_tests.cpp b/src/test/script_standard_tests.cpp index b185d3b4ac..05b76e5979 100644 --- a/src/test/script_standard_tests.cpp +++ b/src/test/script_standard_tests.cpp @@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE(script_standard_Solver_failure) s << OP_RETURN << std::vector<unsigned char>({75}) << OP_ADD; BOOST_CHECK_EQUAL(Solver(s, solutions), TX_NONSTANDARD); - // TX_WITNESS with incorrect program size + // TX_WITNESS_UNKNOWN with incorrect program size s.clear(); s << OP_0 << std::vector<unsigned char>(19, 0x01); BOOST_CHECK_EQUAL(Solver(s, solutions), TX_NONSTANDARD); @@ -227,7 +227,7 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestination) BOOST_CHECK(ExtractDestination(s, address)); BOOST_CHECK(boost::get<WitnessV0ScriptHash>(&address) && *boost::get<WitnessV0ScriptHash>(&address) == scripthash); - // TX_WITNESS with unknown version + // TX_WITNESS_UNKNOWN with unknown version s.clear(); s << OP_1 << ToByteVector(pubkey); BOOST_CHECK(ExtractDestination(s, address)); |