Skip to content

Commit fa95a69

Browse files
author
MarcoFalke
committed
doc: Update outdated txnouttype documentation
Also, remove scope of txnouttype in fuzz tests temporarily. The next commit will add scopes to all txnouttype.
1 parent fa58469 commit fa95a69

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

src/script/standard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ std::string GetTxnOutputType(txnouttype t)
5656
case TX_WITNESS_V0_KEYHASH: return "witness_v0_keyhash";
5757
case TX_WITNESS_V0_SCRIPTHASH: return "witness_v0_scripthash";
5858
case TX_WITNESS_UNKNOWN: return "witness_unknown";
59-
}
59+
} // no default case, so the compiler can warn about missing cases
6060
assert(false);
6161
}
6262

src/script/standard.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ extern unsigned nMaxDatacarrierBytes;
116116
*/
117117
static const unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS = SCRIPT_VERIFY_P2SH;
118118

119-
enum txnouttype
120-
{
119+
enum txnouttype {
121120
TX_NONSTANDARD,
122121
// 'standard' transaction types:
123122
TX_PUBKEY,
@@ -212,7 +211,7 @@ typedef boost::variant<CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash,
212211
/** Check whether a CTxDestination is a CNoDestination. */
213212
bool IsValidDestination(const CTxDestination& dest);
214213

215-
/** Get the name of a txnouttype as a C string, or nullptr if unknown. */
214+
/** Get the name of a txnouttype as a string */
216215
std::string GetTxnOutputType(txnouttype t);
217216

218217
/**

src/test/fuzz/key.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,22 +160,22 @@ void test_one_input(const std::vector<uint8_t>& buffer)
160160
txnouttype which_type_tx_pubkey;
161161
const bool is_standard_tx_pubkey = IsStandard(tx_pubkey_script, which_type_tx_pubkey);
162162
assert(is_standard_tx_pubkey);
163-
assert(which_type_tx_pubkey == txnouttype::TX_PUBKEY);
163+
assert(which_type_tx_pubkey == TX_PUBKEY);
164164

165165
txnouttype which_type_tx_multisig;
166166
const bool is_standard_tx_multisig = IsStandard(tx_multisig_script, which_type_tx_multisig);
167167
assert(is_standard_tx_multisig);
168-
assert(which_type_tx_multisig == txnouttype::TX_MULTISIG);
168+
assert(which_type_tx_multisig == TX_MULTISIG);
169169

170170
std::vector<std::vector<unsigned char>> v_solutions_ret_tx_pubkey;
171171
const txnouttype outtype_tx_pubkey = Solver(tx_pubkey_script, v_solutions_ret_tx_pubkey);
172-
assert(outtype_tx_pubkey == txnouttype::TX_PUBKEY);
172+
assert(outtype_tx_pubkey == TX_PUBKEY);
173173
assert(v_solutions_ret_tx_pubkey.size() == 1);
174174
assert(v_solutions_ret_tx_pubkey[0].size() == 33);
175175

176176
std::vector<std::vector<unsigned char>> v_solutions_ret_tx_multisig;
177177
const txnouttype outtype_tx_multisig = Solver(tx_multisig_script, v_solutions_ret_tx_multisig);
178-
assert(outtype_tx_multisig == txnouttype::TX_MULTISIG);
178+
assert(outtype_tx_multisig == TX_MULTISIG);
179179
assert(v_solutions_ret_tx_multisig.size() == 3);
180180
assert(v_solutions_ret_tx_multisig[0].size() == 1);
181181
assert(v_solutions_ret_tx_multisig[1].size() == 33);

src/test/script_standard_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE(script_standard_Solver_failure)
163163
s << OP_RETURN << std::vector<unsigned char>({75}) << OP_ADD;
164164
BOOST_CHECK_EQUAL(Solver(s, solutions), TX_NONSTANDARD);
165165

166-
// TX_WITNESS with incorrect program size
166+
// TX_WITNESS_UNKNOWN with incorrect program size
167167
s.clear();
168168
s << OP_0 << std::vector<unsigned char>(19, 0x01);
169169
BOOST_CHECK_EQUAL(Solver(s, solutions), TX_NONSTANDARD);
@@ -227,7 +227,7 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestination)
227227
BOOST_CHECK(ExtractDestination(s, address));
228228
BOOST_CHECK(boost::get<WitnessV0ScriptHash>(&address) && *boost::get<WitnessV0ScriptHash>(&address) == scripthash);
229229

230-
// TX_WITNESS with unknown version
230+
// TX_WITNESS_UNKNOWN with unknown version
231231
s.clear();
232232
s << OP_1 << ToByteVector(pubkey);
233233
BOOST_CHECK(ExtractDestination(s, address));

0 commit comments

Comments
 (0)