2018-11-17 06:27:01 +01:00
|
|
|
// next version number
|
2021-02-04 19:15:23 +01:00
|
|
|
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
|
|
|
import failTxsThat from './fail-tx';
|
2018-11-17 06:27:01 +01:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
const version = 29;
|
2020-08-19 18:27:05 +02:00
|
|
|
|
2018-11-17 06:27:01 +01:00
|
|
|
// time
|
2021-02-04 19:15:23 +01:00
|
|
|
const seconds = 1000;
|
|
|
|
const minutes = 60 * seconds;
|
|
|
|
const hours = 60 * minutes;
|
|
|
|
const unacceptableDelay = 12 * hours;
|
2018-11-17 06:27:01 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
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) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
const isApproved = txMeta.status === TRANSACTION_STATUSES.APPROVED;
|
|
|
|
const createdTime = txMeta.submittedTime;
|
|
|
|
const now = Date.now();
|
|
|
|
return isApproved && now - createdTime > unacceptableDelay;
|
2020-11-03 00:41:28 +01:00
|
|
|
},
|
|
|
|
),
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|