Skip to content

policy: reject tapscript spends exceeding input value#271

Open
kwsantiago wants to merge 4 commits intobitcoinknots:29.x-knotsfrom
privkeyio:policy-tapscript-dust-limit
Open

policy: reject tapscript spends exceeding input value#271
kwsantiago wants to merge 4 commits intobitcoinknots:29.x-knotsfrom
privkeyio:policy-tapscript-dust-limit

Conversation

@kwsantiago
Copy link
Copy Markdown

Add -rejecttapscriptdust option (default: true) that rejects mempool transactions containing tapscript script-path spends where the witness cost at the transaction's feerate exceeds the input value. Key-path spends are exempt, preserving UTXO cleanup capability.

Includes GUI option and functional test coverage.

Closes #63
Closes #113

Comment thread src/policy/policy.h Outdated
Comment thread src/kernel/mempool_options.h Outdated
Comment thread src/validation.cpp Outdated
Comment thread src/qt/optionsdialog.cpp Outdated
Comment thread src/qt/optionsmodel.cpp
Comment thread src/init.cpp Outdated
@kwsantiago kwsantiago force-pushed the policy-tapscript-dust-limit branch from 2d46bc7 to c8ffdbf Compare March 5, 2026 13:51
@kwsantiago kwsantiago requested a review from luke-jr March 5, 2026 14:01
@kwsantiago kwsantiago force-pushed the policy-tapscript-dust-limit branch 3 times, most recently from c9ecfef to de066f3 Compare March 5, 2026 19:44
self.sign_tapscript(tx)

result = self.nodes[0].testmempoolaccept([tx.serialize().hex()])
assert_equal(result[0]["allowed"], False)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Difficult to follow. Where/how is the witness size expressed here? Why are two inputs needed to test this? Why is the fee treated as per-input, instead of calculating the actual cost to spend each (especially the dust) input? Why large margins and ~approximate values instead of testing exact boundaries?

Comment thread src/policy/policy.cpp Outdated
Comment thread src/policy/policy.cpp Outdated
Comment thread src/policy/policy.cpp Outdated
Comment thread src/policy/policy.cpp Outdated
Comment thread src/qt/optionsdialog.cpp Outdated
Comment thread src/qt/optionsdialog.cpp Outdated
Comment thread src/init.cpp Outdated
@kwsantiago kwsantiago force-pushed the policy-tapscript-dust-limit branch from de066f3 to 3376dc7 Compare March 29, 2026 13:04
@kwsantiago kwsantiago requested a review from luke-jr March 29, 2026 13:04
bool permit_bare_multisig{DEFAULT_PERMIT_BAREMULTISIG};
bool reject_parasites{DEFAULT_REJECT_PARASITES};
bool reject_tokens{DEFAULT_REJECT_TOKENS};
bool reject_net_negative_inputs{DEFAULT_REJECT_NET_NEGATIVE_INPUTS};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we lose the underscores in the option name please? :)

Comment thread src/policy/policy.cpp
}
}

if (opts.reject_net_negative_inputs && whichType == TxoutType::WITNESS_V1_TAPROOT) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else if

@luke-jr
Copy link
Copy Markdown
Collaborator

luke-jr commented Mar 30, 2026

PR description ought to be updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New spam filter: Check dust limit on Tapscript *spends* Enforce dust limit on Tapscript spends

3 participants