The policy BIP-125 specifies two ways a transaction can signal that it is replaceable.
Explicit signaling: A transaction is considered to have opted in to allowing replacement of itself if any of its inputs have an nSequence number less than (0xffffffff - 1).
Inherited signaling: Transactions that don't explicitly signal replaceability are replaceable under this policy for as long as any one of their ancestors signals replaceability and remains unconfirmed.
Implementation Details
The initial implementation expected in Bitcoin Core 0.12.0 uses the following rules:
One or more transactions currently in the mempool (original transactions) will be replaced by a new transaction (replacement transaction) that spends one or more of the same inputs if,
The original transactions signal replaceability explicitly or through inheritance as described in the above Summary section.
The replacement transaction may only include an unconfirmed input if that input was included in one of the original transactions. (An unconfirmed input spends an output from a currently-unconfirmed transaction.)
The replacement transaction pays an absolute fee of at least the sum paid by the original transactions.
The replacement transaction must also pay for its own bandwidth at or above the rate set by the node's minimum relay fee setting. For example, if the minimum relay fee is 1 satoshi/byte and the replacement transaction is 500 bytes total, then the replacement must pay a fee at least 500 satoshis higher than the sum of the originals.
The number of original transactions to be replaced and their descendant transactions which will be evicted from the mempool must not exceed a total of 100 transactions.The initial implementation may be seen in Bitcoin Core PR#6871 and specifically the master branch commits from 5891f870d68d90408aa5ce5b597fb574f2d2cbca to 16a2f93629f75d182871f288f0396afe6cdc8504 (inclusive).
I am not sure if I have understood this correctly. Can someone from the devs explain this to me in more detail? How was this implemented in the current bitcoin core versions? Does this mean that you can replace a transaction at most 100x?
Is this related to this maxDescendantsToVisit value or is this something completely different and not in the context of BIP-125?
src/main.cpp:
[...]
const int maxDescendantsToVisit = 100;
[...]
I wasn't able to find this directive in the /src folder of Bitcoin Core. Any insight to this much appreciated. What's the limit and how does eviction works? Thank you in advance.