mirror of
https://github.com/basicswap/basicswap.git
synced 2025-03-21 14:48:57 +00:00
Fix missing events, show seconds delayed.
This commit is contained in:
parent
3cfc7d1437
commit
ed22fe7d12
5 changed files with 19 additions and 19 deletions
18
.travis.yml
18
.travis.yml
|
@ -7,17 +7,17 @@ stages:
|
||||||
- test
|
- test
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- TEST_PREPARE_PATH: ~/test_basicswap-prepare
|
- TEST_PREPARE_PATH=~/test_basicswap-prepare
|
||||||
- TEST_DIR=~/test_basicswap2
|
- TEST_DIR=${HOME}/test_basicswap2
|
||||||
- TEST_RELOAD_PATH=~/test_basicswap1
|
- TEST_RELOAD_PATH=~/test_basicswap1
|
||||||
- BIN_DIRS=~/cached_bin
|
- BIN_DIR=~/cached_bin
|
||||||
- PARTICL_BINDIR=${BIN_DIRS}/particl
|
- PARTICL_BINDIR=${BIN_DIR}/particl
|
||||||
- BITCOIN_BINDIR=${BIN_DIRS}/bitcoin
|
- BITCOIN_BINDIR=${BIN_DIR}/bitcoin
|
||||||
- LITECOIN_BINDIR=${BIN_DIRS}/litecoin
|
- LITECOIN_BINDIR=${BIN_DIR}/litecoin
|
||||||
- XMR_BINDIR=${BIN_DIRS}/monero
|
- XMR_BINDIR=${BIN_DIR}/monero
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- "$BIN_DIRS"
|
- "$BIN_DIR"
|
||||||
before_install:
|
before_install:
|
||||||
- sudo apt-get install -y wget python3-pip gnupg unzip protobuf-compiler automake libtool pkg-config
|
- sudo apt-get install -y wget python3-pip gnupg unzip protobuf-compiler automake libtool pkg-config
|
||||||
install:
|
install:
|
||||||
|
@ -30,7 +30,7 @@ before_script:
|
||||||
script:
|
script:
|
||||||
- cd $TRAVIS_BUILD_DIR
|
- cd $TRAVIS_BUILD_DIR
|
||||||
- python3 setup.py install
|
- 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}"
|
- export DATADIRS="${TEST_DIR}"
|
||||||
- mkdir -p "${DATADIRS}/bin"
|
- mkdir -p "${DATADIRS}/bin"
|
||||||
- cp -r ${BIN_DIR} "${DATADIRS}/bin"
|
- cp -r ${BIN_DIR} "${DATADIRS}/bin"
|
||||||
|
|
|
@ -1725,9 +1725,8 @@ class BasicSwap(BaseApp):
|
||||||
query_str = 'SELECT created_at, trigger_at FROM eventqueue ' + \
|
query_str = 'SELECT created_at, trigger_at FROM eventqueue ' + \
|
||||||
'WHERE active_ind = 1 AND linked_id = x\'{}\' '.format(bid_id.hex())
|
'WHERE active_ind = 1 AND linked_id = x\'{}\' '.format(bid_id.hex())
|
||||||
q = session.execute(query_str)
|
q = session.execute(query_str)
|
||||||
events = []
|
|
||||||
for row in q:
|
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
|
return events
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import time
|
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
from .util import (
|
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)
|
ci_to = self.server.swap_client.ci(o.coin_to)
|
||||||
rv.append({
|
rv.append({
|
||||||
'offer_id': o.offer_id.hex(),
|
'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_from': ci_from.coin_name(),
|
||||||
'coin_to': ci_to.coin_name(),
|
'coin_to': ci_to.coin_name(),
|
||||||
'amount_from': ci_from.format_amount(o.amount_from),
|
'amount_from': ci_from.format_amount(o.amount_from),
|
||||||
|
|
|
@ -4,10 +4,9 @@
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
from .util import (
|
from .util import (
|
||||||
make_int,
|
make_int,
|
||||||
|
format_timestamp,
|
||||||
)
|
)
|
||||||
from .chainparams import (
|
from .chainparams import (
|
||||||
Coins,
|
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(),
|
'offer_id': bid.offer_id.hex(),
|
||||||
'addr_from': bid.bid_addr,
|
'addr_from': bid.bid_addr,
|
||||||
'addr_fund_proof': bid.proof_address,
|
'addr_fund_proof': bid.proof_address,
|
||||||
'created_at': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(bid.created_at)),
|
'created_at': format_timestamp(bid.created_at, with_seconds=True),
|
||||||
'expired_at': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(bid.expire_at)),
|
'expired_at': format_timestamp(bid.expire_at, with_seconds=True),
|
||||||
'was_sent': 'True' if bid.was_sent else 'False',
|
'was_sent': 'True' if bid.was_sent else 'False',
|
||||||
'was_received': 'True' if bid.was_received else 'False',
|
'was_received': 'True' if bid.was_received else 'False',
|
||||||
'initiate_tx': getTxIdHex(bid, TxTypes.ITX, ' ' + ticker_from),
|
'initiate_tx': getTxIdHex(bid, TxTypes.ITX, ' ' + ticker_from),
|
||||||
|
|
|
@ -306,8 +306,11 @@ def format_amount(i, display_scale, scale=None):
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
|
|
||||||
def format_timestamp(value):
|
def format_timestamp(value, with_seconds=False):
|
||||||
return time.strftime('%Y-%m-%d %H:%M', time.localtime(value))
|
str_format = '%Y-%m-%d %H:%M'
|
||||||
|
if with_seconds:
|
||||||
|
str_format += ':%S'
|
||||||
|
return time.strftime(str_format, time.localtime(value))
|
||||||
|
|
||||||
|
|
||||||
def getP2SHScriptForHash(p2sh):
|
def getP2SHScriptForHash(p2sh):
|
||||||
|
|
Loading…
Reference in a new issue