Skip to content

wallet: don't back-date locktime when spending unconfirmed UTXOs #26527

@0xB10C

Description

@0xB10C

As mentioned in #26451 (comment) example 3:

If we do anti-fee sniping, the Bitcoin Core wallet has a 10% chance to back-date the locktime of a transaction to up to 100 blocks. Electrum has similar behavior.

// Secondly occasionally randomly pick a nLockTime even further back, so
// that transactions that are delayed after signing for whatever reason,
// e.g. high-latency mix networks and some CoinJoin implementations, have
// better privacy.
if (rng_fast.randrange(10) == 0) {
tx.nLockTime = std::max(0, int(tx.nLockTime) - int(rng_fast.randrange(100)));
}

When spending an unconfirmed UTXO, it can happen that we back-date the locktime of our transaction to a locktime before the locktime of the unconfirmed parent. In this case, the "transaction signed earlier but only broadcast now" is unrealistic I think (please correct me if you think there is a protocol where this makes sense). This is a fingerprint that we are a Bitcoin Core or Electrum wallet.

related #26526
electrum issue: spesmilo/electrum#8073

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