Skip to content

Feature Request: testmempoolaccept with an argument to ignore nLocktime/nSequence time-locking #32142

Open

Description

@oren-z0

Please describe the feature you'd like to see added.

Execute testmempoolaccept in a way that will ignore the time/block-height validations of the transactions' nSequence and nLocktime.

Is your feature related to a problem, if so please describe it.

testmempoolaccept is a very useful tool to verify transactions that aren't supposed to be broadcasted immediately - for example, for emergency recovery in case the seed is lost.
nLocktime is also useful in such case, to prevent the recovery transaction from being broadcasted too early. However, after signing a transaction with a future nLocktime, I couldn't be sure that it is indeed valid: testmempoolaccept considers this transaction as non-final because of its future nLocktime, without explaining whether it has other problems (i.e. invalid signatures etc.).

Describe the solution you'd like

A third optional parameter to testmempoolaccept (after rawtxs and maxfeerate) called ignoretimelocks, that will be a boolean.

Describe any alternatives you've considered

I've tried writing code that would parse the transaction and, given the current mempool utxos, verify its scripts. This becomes complicated to implement in multisig and segwit transactions, and doesn't give me the guarantees that I want for such long-term transaction.

Another suggestion is that testmempoolaccept will accumulate all the reasons a transaction is unacceptable, and not exit after the first reason.

Please leave any additional context

nSequence is a bitfield with multiple purposes, like RBF, and possibly other features in the future. My suggestion only regards BIP-68 validations of nSequence and not other features.

Activity

  1. darosior commented on Mar 26, 2025

    @darosior
    Member

    Have you seen the discussion about this at #25434?

  2. oren-z0 commented on Mar 27, 2025

    @oren-z0
    Author

    Thanks @darosior , no I did not see that discussion before (only searched for related issues, not related PRs).
    In the other discussion, the main use case for the feature is to simplify the development of L2 layers - which use scripts with pre-known structure.
    In my use case, I'm building a service that could broadcast future recovery-transactions uploaded by customers, and I want to verify in advance that these transactions could indeed be broadcasted when the time comes (unless, of course, the customer has spent the UTXOs after uploading the recovery-transactions). In this case the transaction could theoretically use any script that the customer wants.

    I understand the worry that the code of testmempoolaccept will diverge from the code of sendrawtransaction and some bug will cause an invalid transaction to appear as accepted by testmempoolaccept. A more generic alternative could be that testmempoolaccept will collect all the reasons a transaction appears to be invalid, without breaking on the first reason (unless this is a very basic failure like invalid transaction structure, that make the other verifications irrelevant).

    Therefore I would like to keep this issue open for debate.

  3. Sjors commented on Jan 5, 2026

    @Sjors
    Member

    This idea bubbled up again on the mailinglist recently: https://groups.google.com/g/bitcoindev/c/K1NpJp9_BYk/m/6PknOXFPBAAJ

    I think it's useful for users to be able to reassure themselves that their pre-signed time/height locked transaction will indeed be valid in the future. RPC methods like walletcreatefundedpsbt are able to create such transactions.

    I would suggest requiring a specific height / MTP argument, rather ignoring it. That lets you catch accidental timelock mixing.

    An additional place where this might be useful is on an offline signing node, which might not be synced to the tip (though you'll have to sync it eventually if you want to spend change).

    I vibe-coded an implementation in https://github.com/Sjors/bitcoin/commits/2026/01/timelock/ but it needs polishing. I don't have time for it now, so consider it up for grabs.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions