mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 20:09:23 +00:00
resolve null check operator used on a null value issue
because unconfirmed txs have a null blockTime. we could also use currentChainHeight+1, which may be more appropriate.
This commit is contained in:
parent
2be13a89c5
commit
9b93dc78d2
1 changed files with 6 additions and 1 deletions
|
@ -128,7 +128,12 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
|
|||
// 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) => (b.blockTime ?? currentChainHeight)
|
||||
.compareTo((a.blockTime ?? currentChainHeight)));
|
||||
// Null check operator changed to null assignment in order to resolve a
|
||||
// `Null check operator used on a null value` error. currentChainHeight
|
||||
// used in order to sort these unconfirmed outputs as the youngest, but we
|
||||
// could just as well use currentChainHeight + 1.
|
||||
}
|
||||
|
||||
Logging.instance.log("spendableOutputs.length: ${spendableOutputs.length}",
|
||||
|
|
Loading…
Reference in a new issue