Still something doesn’t sit right. So if a coin is discarded because of max_ancestors we give this error message, but if it’s discarded by the filter max_ancestors/2 we just say insufficient funds when the coins are there they just don’t meet the filters
no, those coins will be added to the last non-customizable filter which has max_ancestors-1
and max_descendants-1
.
There are also other reasons when the coins are discarded, for example unsafe utxos. Even you enable unsafe utxos, we don’t allow any chains at all
The unsafe UTXO filter is just redundant, we are currently filtering unsafe UTXO inside the coins fetching process (AvailableCoins
).
In other words, when m_include_unsafe_inputs=false
no unsafe UTXO arrives at Coin Selection.
Why give detailed error message in one case and not the other? Maybe we should just count all discarded coins and generalize the error message a bit?
The process is already counting all discarded coins and returning early if their exclusion make the available amount go below the target. It’s currently returning an “Insufficient Funds”, but could say something different too.
I made the too-long-mempool-chain error an special case because this error, alike the untrusted coins that the user can see in a different balance (the unconfirmed/untrusted one), is hidden to the user as it depends on inner mempool policies.
It’s not enough for the user to set a flag to spend the unsafe coins, it needs to set another one to craft the tx with an unconfirmed output that surpasses the max descendants policy.