Coin selection for BTC/LTC sends walks unspentCoins in a fixed, predictable order, which acts as a wallet fingerprint.
unspentCoins is built address by address, in allAddresses order (the wallet's address generation order). Within a single address, fetchUnspent resolves coins concurrently, but with a warm cache they complete in the order the server returned them, listunspent is blockchain order, i.e. by block height ≈ oldest first. So the pool order is: address generation order, then coin age.
the greedy selection in _createUTXOS (electrum_wallet.dart) accumulates over that pool in order, so the input set is deterministic: coins from earlier addresses and older coins are always spent first. An analyst who clusters the wallet's addresses can predict/recognize its selection pattern. The only randomization today is network jitter on cold fetches, accidental and gone once the cache warms.
selection should be deliberately non-deterministic (e.g. single random draw, as in Core/bdk), ideally with branch-and-bound for changeless exact matches.
Coin selection for BTC/LTC sends walks
unspentCoinsin a fixed, predictable order, which acts as a wallet fingerprint.unspentCoinsis built address by address, inallAddressesorder (the wallet's address generation order). Within a single address,fetchUnspentresolves coins concurrently, but with a warm cache they complete in the order the server returned them,listunspentis blockchain order, i.e. by block height ≈ oldest first. So the pool order is: address generation order, then coin age.the greedy selection in _createUTXOS (electrum_wallet.dart) accumulates over that pool in order, so the input set is deterministic: coins from earlier addresses and older coins are always spent first. An analyst who clusters the wallet's addresses can predict/recognize its selection pattern. The only randomization today is network jitter on cold fetches, accidental and gone once the cache warms.
selection should be deliberately non-deterministic (e.g. single random draw, as in Core/bdk), ideally with branch-and-bound for changeless exact matches.