Expired transaction after bugfix (#121)

* other minor fixes

* reedemable transaction expiry fix
This commit is contained in:
Fabio Cigliano 2018-06-13 01:15:58 +12:00 committed by Josh Harvey
parent 25030fab2a
commit 63e0782e32
3 changed files with 13 additions and 3 deletions

View file

@ -103,8 +103,14 @@ function getMachines (info) {
} }
function sendRadar (data) { function sendRadar (data) {
const url = _.get(['coinAtmRadar', 'url'], options)
if (_.isEmpty(url)) {
return Promise.reject(new Error('Missing coinAtmRadar url!'))
}
const config = { const config = {
url: options.coinAtmRadar.url, url,
method: 'post', method: 'post',
data, data,
timeout: TIMEOUT, timeout: TIMEOUT,

View file

@ -6,7 +6,7 @@ const T = require('./time')
const BN = require('./bn') const BN = require('./bn')
const settingsLoader = require('./settings-loader') const settingsLoader = require('./settings-loader')
const TRANSACTION_EXPIRATION = 2 * T.days const TRANSACTION_EXPIRATION = T.day
function httpError (msg, code) { function httpError (msg, code) {
const err = new Error(msg) const err = new Error(msg)
@ -49,7 +49,7 @@ function toCashOutTx (row) {
function fetchPhoneTx (phone) { function fetchPhoneTx (phone) {
const sql = `select * from cash_out_txs const sql = `select * from cash_out_txs
where phone=$1 and dispense=$2 where phone=$1 and dispense=$2
and (extract(epoch from (coalesce(confirmed_at, now()) - created))) * 1000 < $3` and (extract(epoch from (now() - created))) * 1000 < $3`
const values = [phone, false, TRANSACTION_EXPIRATION] const values = [phone, false, TRANSACTION_EXPIRATION]

View file

@ -138,6 +138,10 @@ function authorizeZeroConf (settings, tx, machineId) {
const plugin = cryptoConfig.zeroConf const plugin = cryptoConfig.zeroConf
const zeroConfLimit = machineConfig.zeroConfLimit const zeroConfLimit = machineConfig.zeroConfLimit
if (!_.isObject(tx.fiat)) {
return Promise.reject(new Error('tx.fiat is undefined!'))
}
if (plugin === 'no-zero-conf' || tx.fiat.gt(zeroConfLimit)) { if (plugin === 'no-zero-conf' || tx.fiat.gt(zeroConfLimit)) {
return Promise.resolve(false) return Promise.resolve(false)
} }