Fix missing events, show seconds delayed.

This commit is contained in:
tecnovert 2021-01-12 08:48:40 +02:00
parent 3cfc7d1437
commit ed22fe7d12
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
5 changed files with 19 additions and 19 deletions

View file

@ -7,17 +7,17 @@ stages:
- test
env:
global:
- TEST_PREPARE_PATH: ~/test_basicswap-prepare
- TEST_DIR=~/test_basicswap2
- TEST_PREPARE_PATH=~/test_basicswap-prepare
- TEST_DIR=${HOME}/test_basicswap2
- TEST_RELOAD_PATH=~/test_basicswap1
- BIN_DIRS=~/cached_bin
- PARTICL_BINDIR=${BIN_DIRS}/particl
- BITCOIN_BINDIR=${BIN_DIRS}/bitcoin
- LITECOIN_BINDIR=${BIN_DIRS}/litecoin
- XMR_BINDIR=${BIN_DIRS}/monero
- BIN_DIR=~/cached_bin
- PARTICL_BINDIR=${BIN_DIR}/particl
- BITCOIN_BINDIR=${BIN_DIR}/bitcoin
- LITECOIN_BINDIR=${BIN_DIR}/litecoin
- XMR_BINDIR=${BIN_DIR}/monero
cache:
directories:
- "$BIN_DIRS"
- "$BIN_DIR"
before_install:
- sudo apt-get install -y wget python3-pip gnupg unzip protobuf-compiler automake libtool pkg-config
install:
@ -30,7 +30,7 @@ before_script:
script:
- cd $TRAVIS_BUILD_DIR
- python3 setup.py install
- basicswap-prepare --bindir=${BIN_DIRS} --preparebinonly --withcoins=particl,bitcoin,litecoin,monero
- basicswap-prepare --bindir=${BIN_DIR} --preparebinonly --withcoins=particl,bitcoin,litecoin,monero
- export DATADIRS="${TEST_DIR}"
- mkdir -p "${DATADIRS}/bin"
- cp -r ${BIN_DIR} "${DATADIRS}/bin"

View file

@ -1725,9 +1725,8 @@ class BasicSwap(BaseApp):
query_str = 'SELECT created_at, trigger_at FROM eventqueue ' + \
'WHERE active_ind = 1 AND linked_id = x\'{}\' '.format(bid_id.hex())
q = session.execute(query_str)
events = []
for row in q:
events.append({'at': row[0], 'desc': 'Delaying until: {}'.format(format_timestamp(row[1]))})
events.append({'at': row[0], 'desc': 'Delaying until: {}'.format(format_timestamp(row[1], with_seconds=True))})
return events

View file

@ -5,7 +5,6 @@
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import json
import time
import urllib.parse
from .util import (
@ -84,7 +83,7 @@ def js_offers(self, url_split, post_string, sent=False):
ci_to = self.server.swap_client.ci(o.coin_to)
rv.append({
'offer_id': o.offer_id.hex(),
'created_at': time.strftime('%Y-%m-%d %H:%M', time.localtime(o.created_at)),
'created_at': format_timestamp(o.created_at),
'coin_from': ci_from.coin_name(),
'coin_to': ci_to.coin_name(),
'amount_from': ci_from.format_amount(o.amount_from),

View file

@ -4,10 +4,9 @@
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import time
from .util import (
make_int,
format_timestamp,
)
from .chainparams import (
Coins,
@ -133,8 +132,8 @@ def describeBid(swap_client, bid, xmr_swap, offer, xmr_offer, bid_events, edit_b
'offer_id': bid.offer_id.hex(),
'addr_from': bid.bid_addr,
'addr_fund_proof': bid.proof_address,
'created_at': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(bid.created_at)),
'expired_at': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(bid.expire_at)),
'created_at': format_timestamp(bid.created_at, with_seconds=True),
'expired_at': format_timestamp(bid.expire_at, with_seconds=True),
'was_sent': 'True' if bid.was_sent else 'False',
'was_received': 'True' if bid.was_received else 'False',
'initiate_tx': getTxIdHex(bid, TxTypes.ITX, ' ' + ticker_from),

View file

@ -306,8 +306,11 @@ def format_amount(i, display_scale, scale=None):
return rv
def format_timestamp(value):
return time.strftime('%Y-%m-%d %H:%M', time.localtime(value))
def format_timestamp(value, with_seconds=False):
str_format = '%Y-%m-%d %H:%M'
if with_seconds:
str_format += ':%S'
return time.strftime(str_format, time.localtime(value))
def getP2SHScriptForHash(p2sh):