Skip to content

Commit 4d021e6

Browse files
Retropexluke-jr
authored andcommitted
add -rejectparasites option
Github-Pull: knots#78 Rebased-From: 18cd7b0
1 parent 93fd7cc commit 4d021e6

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

src/init.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ void SetupServerArgs(ArgsManager& argsman)
664664
OptionsCategory::NODE_RELAY);
665665
argsman.AddArg("-minrelaytxfee=<amt>", strprintf("Fees (in %s/kvB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)",
666666
CURRENCY_UNIT, FormatMoney(DEFAULT_MIN_RELAY_TX_FEE)), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
667+
argsman.AddArg("-rejectparasites", strprintf("Refuse to relay or mine parasitic overlay protocols (default: %u)", DEFAULT_REJECT_PARASITES), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
667668
argsman.AddArg("-rejecttokens",
668669
strprintf("Refuse to relay or mine transactions involving non-bitcoin tokens (default: %u)",
669670
DEFAULT_REJECT_TOKENS),

src/kernel/mempool_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ struct MemPoolOptions {
6363
bool datacarrier_fullcount{DEFAULT_DATACARRIER_FULLCOUNT};
6464
bool permit_bare_pubkey{DEFAULT_PERMIT_BAREPUBKEY};
6565
bool permit_bare_multisig{DEFAULT_PERMIT_BAREMULTISIG};
66+
bool reject_parasites{DEFAULT_REJECT_PARASITES};
6667
bool reject_tokens{DEFAULT_REJECT_TOKENS};
6768
bool accept_non_std_datacarrier{DEFAULT_ACCEPT_NON_STD_DATACARRIER};
6869
bool require_standard{true};

src/node/mempool_args.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ util::Result<void> ApplyArgsManOptions(const ArgsManager& argsman, const CChainP
8585

8686
mempool_opts.permit_bare_multisig = argsman.GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG);
8787

88+
mempool_opts.reject_parasites = argsman.GetBoolArg("-rejectparasites", DEFAULT_REJECT_PARASITES);
89+
8890
mempool_opts.reject_tokens = argsman.GetBoolArg("-rejecttokens", DEFAULT_REJECT_TOKENS);
8991

9092
if (argsman.GetBoolArg("-datacarrier", DEFAULT_ACCEPT_DATACARRIER)) {

src/policy/policy.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ bool IsStandardTx(const CTransaction& tx, const kernel::MemPoolOptions& opts, st
129129
MaybeReject("tx-size");
130130
}
131131

132+
if (tx.nLockTime == 21 && opts.reject_parasites) {
133+
MaybeReject("parasite-cat21");
134+
}
135+
132136
for (const CTxIn& txin : tx.vin)
133137
{
134138
// Biggest 'standard' txin involving only keys is a 15-of-15 P2SH

src/policy/policy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ static constexpr bool DEFAULT_REJECT_TOKENS{false};
5656
static constexpr bool DEFAULT_PERMIT_BAREPUBKEY{true};
5757
/** Default for -permitbaremultisig */
5858
static constexpr bool DEFAULT_PERMIT_BAREMULTISIG{true};
59+
/** Default for -rejectparasites */
60+
static constexpr bool DEFAULT_REJECT_PARASITES{false};
5961
/** The maximum number of witness stack items in a standard P2WSH script */
6062
static constexpr unsigned int MAX_STANDARD_P2WSH_STACK_ITEMS{100};
6163
/** The maximum size in bytes of each witness stack item in a standard P2WSH script */

0 commit comments

Comments
 (0)