Skip to content

Commit e61cfff

Browse files
committed
Diff-minimise
1 parent 734576e commit e61cfff

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

src/policy/policy.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ bool IsDust(const CTxOut& txout, const CFeeRate& dustRelayFeeIn)
7272
* Note this must assign whichType even if returning false, in case
7373
* IsStandardTx ignores the "scriptpubkey" rejection.
7474
*/
75-
bool IsStandard(const CScript& scriptPubKey, const kernel::MemPoolOptions& opts, TxoutType& whichType)
75+
bool IsStandard(const CScript& scriptPubKey, const std::optional<unsigned>& max_datacarrier_bytes, TxoutType& whichType)
7676
{
7777
std::vector<std::vector<unsigned char> > vSolutions;
7878
whichType = Solver(scriptPubKey, vSolutions);
@@ -88,7 +88,7 @@ bool IsStandard(const CScript& scriptPubKey, const kernel::MemPoolOptions& opts,
8888
if (m < 1 || m > n)
8989
return false;
9090
} else if (whichType == TxoutType::NULL_DATA) {
91-
if (!opts.max_datacarrier_bytes || scriptPubKey.size() > *opts.max_datacarrier_bytes) {
91+
if (!max_datacarrier_bytes || scriptPubKey.size() > *max_datacarrier_bytes) {
9292
return false;
9393
}
9494
}
@@ -149,7 +149,7 @@ bool IsStandardTx(const CTransaction& tx, const kernel::MemPoolOptions& opts, st
149149
unsigned int nDataOut = 0;
150150
TxoutType whichType;
151151
for (const CTxOut& txout : tx.vout) {
152-
if (!::IsStandard(txout.scriptPubKey, opts, whichType)) {
152+
if (!::IsStandard(txout.scriptPubKey, opts.max_datacarrier_bytes, whichType)) {
153153
if (whichType == TxoutType::WITNESS_UNKNOWN) {
154154
MaybeReject("scriptpubkey-unknown-witnessversion");
155155
} else {

src/policy/policy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ CAmount GetDustThreshold(const CTxOut& txout, const CFeeRate& dustRelayFee);
132132

133133
bool IsDust(const CTxOut& txout, const CFeeRate& dustRelayFee);
134134

135-
bool IsStandard(const CScript& scriptPubKey, const kernel::MemPoolOptions& opts, TxoutType& whichType);
135+
bool IsStandard(const CScript& scriptPubKey, const std::optional<unsigned>& max_datacarrier_bytes, TxoutType& whichType);
136136

137137

138138
// Changing the default transaction version requires a two step process: first

src/test/fuzz/key.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <chainparams.h>
6-
#include <kernel/mempool_options.h>
76
#include <key.h>
87
#include <key_io.h>
98
#include <outputtype.h>
@@ -150,12 +149,12 @@ FUZZ_TARGET(key, .init = initialize_key)
150149
assert(fillable_signing_provider_pub.HaveKey(pubkey.GetID()));
151150

152151
TxoutType which_type_tx_pubkey;
153-
const bool is_standard_tx_pubkey = IsStandard(tx_pubkey_script, kernel::MemPoolOptions{}, which_type_tx_pubkey);
152+
const bool is_standard_tx_pubkey = IsStandard(tx_pubkey_script, std::nullopt, which_type_tx_pubkey);
154153
assert(is_standard_tx_pubkey);
155154
assert(which_type_tx_pubkey == TxoutType::PUBKEY);
156155

157156
TxoutType which_type_tx_multisig;
158-
const bool is_standard_tx_multisig = IsStandard(tx_multisig_script, kernel::MemPoolOptions{.permit_bare_multisig = true}, which_type_tx_multisig);
157+
const bool is_standard_tx_multisig = IsStandard(tx_multisig_script, std::nullopt, which_type_tx_multisig);
159158
assert(is_standard_tx_multisig);
160159
assert(which_type_tx_multisig == TxoutType::MULTISIG);
161160

src/test/fuzz/script.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <compressor.h>
77
#include <core_io.h>
88
#include <core_memusage.h>
9-
#include <kernel/mempool_options.h>
109
#include <key_io.h>
1110
#include <policy/policy.h>
1211
#include <pubkey.h>
@@ -54,7 +53,7 @@ FUZZ_TARGET(script, .init = initialize_script)
5453
}
5554

5655
TxoutType which_type;
57-
bool is_standard_ret = IsStandard(script, kernel::MemPoolOptions{}, which_type);
56+
bool is_standard_ret = IsStandard(script, std::nullopt, which_type);
5857
if (!is_standard_ret) {
5958
assert(which_type == TxoutType::NONSTANDARD ||
6059
which_type == TxoutType::NULL_DATA ||

src/test/multisig_tests.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
#include <kernel/mempool_options.h>
65
#include <key.h>
76
#include <policy/policy.h>
87
#include <script/interpreter.h>
@@ -144,7 +143,7 @@ BOOST_AUTO_TEST_CASE(multisig_IsStandard)
144143

145144
const auto is_standard{[](const CScript& spk) {
146145
TxoutType type;
147-
bool res{::IsStandard(spk, kernel::MemPoolOptions{.max_datacarrier_bytes = std::nullopt}, type)};
146+
bool res{::IsStandard(spk, std::nullopt, type)};
148147
if (res) {
149148
BOOST_CHECK_EQUAL(type, TxoutType::MULTISIG);
150149
}

0 commit comments

Comments
 (0)