2018-11-17 06:27:01 +01:00
|
|
|
// next version number
|
2020-11-07 08:38:12 +01:00
|
|
|
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction'
|
2020-01-09 04:34:58 +01:00
|
|
|
import failTxsThat from './fail-tx'
|
2018-11-17 06:27:01 +01:00
|
|
|
|
2020-08-19 18:27:05 +02:00
|
|
|
const version = 29
|
|
|
|
|
2018-11-17 06:27:01 +01:00
|
|
|
// time
|
|
|
|
const seconds = 1000
|
|
|
|
const minutes = 60 * seconds
|
|
|
|
const hours = 60 * minutes
|
|
|
|
const unacceptableDelay = 12 * hours
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
normalizes txParams on unconfirmed txs
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2020-01-09 04:34:58 +01:00
|
|
|
export default {
|
2018-11-17 06:27:01 +01:00
|
|
|
version,
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migrate: failTxsThat(
|
|
|
|
version,
|
|
|
|
'Stuck in approved state for too long.',
|
|
|
|
(txMeta) => {
|
2020-11-07 08:38:12 +01:00
|
|
|
const isApproved = txMeta.status === TRANSACTION_STATUSES.APPROVED
|
2020-11-03 00:41:28 +01:00
|
|
|
const createdTime = txMeta.submittedTime
|
|
|
|
const now = Date.now()
|
|
|
|
return isApproved && now - createdTime > unacceptableDelay
|
|
|
|
},
|
|
|
|
),
|
2018-11-17 06:27:01 +01:00
|
|
|
}
|