zero conf possible null fix

This commit is contained in:
julian 2023-04-17 15:44:50 -06:00
parent da8972e27b
commit 9974f60b4c

View file

@ -2413,7 +2413,15 @@ class BitcoinCashWallet extends CoinServiceAPI
// don't care about sorting if using all utxos
if (!coinControl) {
// sort spendable by age (oldest first)
spendableOutputs.sort((a, b) => b.blockTime!.compareTo(a.blockTime!));
spendableOutputs.sort((a, b) {
if (a.blockTime != null && b.blockTime != null) {
return b.blockTime!.compareTo(a.blockTime!);
} else if (a.blockTime != null) {
return -1;
} else {
return 1;
}
});
}
Logging.instance.log("spendableOutputs.length: ${spendableOutputs.length}",