mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
fix: avoid UIH2 fingerprint in payjoin receiver input selection (#3304)
Co-authored-by: Konstantin Ullrich <konstantin@cakewallet.com>
This commit is contained in:
co-authored by
Konstantin Ullrich
parent
29684affc2
commit
874d724c67
@@ -179,7 +179,17 @@ class PayjoinReceiverWorker {
|
||||
final unspent = listUnspent as List<UtxoWithPrivateKey>;
|
||||
if (unspent.isEmpty) throw RecoverableError('No unspent outputs available');
|
||||
|
||||
final selectedUtxo = await _inputPairFromUtxo(unspent[0]);
|
||||
final candidateInputs =
|
||||
await Future.wait(unspent.map(_inputPairFromUtxo));
|
||||
|
||||
// Prefer a UTXO that avoids the Unnecessary Input Heuristic (UIH2);
|
||||
// fall back to the first candidate if none preserves privacy.
|
||||
InputPair selectedUtxo = candidateInputs.first;
|
||||
try {
|
||||
selectedUtxo =
|
||||
await pj5.tryPreservingPrivacy(candidateInputs: candidateInputs);
|
||||
} catch (_) {}
|
||||
|
||||
final pj6 = await pj5.contributeInputs(replacementInputs: [selectedUtxo]);
|
||||
final pj7 = await pj6.commitInputs();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user