Avoid showing pending transactions, when latestBlock is not defined

pull/2/head
Michael Scoff 7 years ago
parent d1b62eedb5
commit 1b639c9893
  1. 9
      Trust/Transactions/ViewModels/TransactionCellViewModel.swift

@ -15,17 +15,18 @@ struct TransactionCellViewModel {
self.transaction = transaction
self.chainState = chainState
}
var confirmations: Int {
return max(chainState.latestBlock - Int(transaction.blockNumber), 0)
}
private var state: TransactionState {
if confirmations == 0 {
return .pending
}
var state: TransactionState {
if transaction.isError {
return .error
}
if confirmations == 0 && chainState.latestBlock >= transaction.blockNumber {
return .pending
}
return .completed
}

Loading…
Cancel
Save