mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 18:38:09 +01:00
Update dockerfile.
This commit is contained in:
@@ -211,6 +211,8 @@ def strOfferState(state):
|
||||
def strBidState(state):
|
||||
if state == BidStates.BID_SENT:
|
||||
return 'Sent'
|
||||
if state == BidStates.BID_RECEIVING:
|
||||
return 'Receiving'
|
||||
if state == BidStates.BID_RECEIVED:
|
||||
return 'Received'
|
||||
if state == BidStates.BID_ACCEPTED:
|
||||
@@ -227,6 +229,28 @@ def strBidState(state):
|
||||
return 'Abandoned'
|
||||
if state == BidStates.BID_ERROR:
|
||||
return 'Error'
|
||||
if state == BidStates.XMR_SWAP_SCRIPT_COIN_LOCKED:
|
||||
return 'Script coin locked'
|
||||
if state == BidStates.XMR_SWAP_HAVE_SCRIPT_COIN_SPEND_TX:
|
||||
return 'Script coin spend tx valid'
|
||||
if state == BidStates.XMR_SWAP_NOSCRIPT_COIN_LOCKED:
|
||||
return 'Scriptless coin locked'
|
||||
if state == BidStates.XMR_SWAP_SECRET_SHARED:
|
||||
return 'Secret shared'
|
||||
if state == BidStates.XMR_SWAP_SCRIPT_TX_REDEEMED:
|
||||
return 'Script tx redeemed'
|
||||
if state == BidStates.XMR_SWAP_NOSCRIPT_TX_REDEEMED:
|
||||
return 'Scriptless tx redeemed'
|
||||
if state == BidStates.XMR_SWAP_NOSCRIPT_TX_RECOVERED:
|
||||
return 'Scriptless tx recovered'
|
||||
if state == BidStates.XMR_SWAP_FAILED_REFUNDED:
|
||||
return 'Failed, refunded'
|
||||
if state == BidStates.XMR_SWAP_FAILED_SWIPED:
|
||||
return 'Failed, swiped'
|
||||
if state == BidStates.XMR_SWAP_FAILED:
|
||||
return 'Failed'
|
||||
if state == BidStates.SWAP_DELAYING:
|
||||
return 'Delaying'
|
||||
return 'Unknown'
|
||||
|
||||
|
||||
@@ -2359,7 +2383,7 @@ class BasicSwap(BaseApp):
|
||||
|
||||
found_tx = ci_to.findTxB(xmr_swap.vkbv, xmr_swap.pkbs, bid.amount_to, ci_to.blocks_confirmed, xmr_swap.b_restore_height)
|
||||
if found_tx is not None:
|
||||
|
||||
self.log.debug('Found {} lock tx in chain'.format(ci_to.coin_name()))
|
||||
if bid.xmr_b_lock_tx is None:
|
||||
b_lock_tx_id = bytes.fromhex(found_tx['txid'])
|
||||
bid.xmr_b_lock_tx = SwapTx(
|
||||
@@ -2383,7 +2407,7 @@ class BasicSwap(BaseApp):
|
||||
# Wait for script spend tx to confirm
|
||||
# TODO: Use explorer to get tx / block hash for getrawtransaction
|
||||
pass
|
||||
elif state == BidStates.XMR_SWAP_SCRIPT_TX_REDEEMED:
|
||||
elif state == BidStates.XMR_SWAP_NOSCRIPT_TX_REDEEMED:
|
||||
txid_hex = bid.xmr_b_lock_tx.spend_txid.hex()
|
||||
|
||||
found_tx = ci_to.findTxnByHash(txid_hex)
|
||||
@@ -2741,6 +2765,7 @@ class BasicSwap(BaseApp):
|
||||
|
||||
else:
|
||||
self.log.info('Coin a lock refund spent by unknown tx, bid {}'.format(bid_id.hex()))
|
||||
bid.setState(BidStates.XMR_SWAP_FAILED_SWIPED)
|
||||
|
||||
self.saveBidInSession(bid_id, bid, session, xmr_swap)
|
||||
# Update copy of bid in swaps_in_progress
|
||||
@@ -2835,7 +2860,7 @@ class BasicSwap(BaseApp):
|
||||
try:
|
||||
session = scoped_session(self.session_factory)
|
||||
|
||||
q = session.query(EventQueue).filter(EventQueue.trigger_at >= now)
|
||||
q = session.query(EventQueue).filter(sa.and_(EventQueue.active_ind == 1, EventQueue.trigger_at <= now))
|
||||
for row in q:
|
||||
try:
|
||||
if row.event_type == EventTypes.ACCEPT_BID:
|
||||
@@ -2860,7 +2885,11 @@ class BasicSwap(BaseApp):
|
||||
if self.debug:
|
||||
traceback.print_exc()
|
||||
self.log.error('checkEvents failed: {}'.format(str(ex)))
|
||||
session.delete(row)
|
||||
|
||||
if self.debug:
|
||||
session.execute('UPDATE eventqueue SET active_ind = 2 WHERE trigger_at <= {}'.format(now))
|
||||
else:
|
||||
session.execute('DELETE FROM eventqueue WHERE trigger_at <= {}'.format(now))
|
||||
|
||||
session.commit()
|
||||
finally:
|
||||
@@ -3683,6 +3712,7 @@ class BasicSwap(BaseApp):
|
||||
txid = ci_to.spendBLockTx(address_to, xmr_swap.vkbv, vkbs, bid.amount_to, xmr_offer.b_fee_rate, xmr_swap.b_restore_height)
|
||||
|
||||
bid.xmr_b_lock_tx.spend_txid = txid
|
||||
bid.setState(BidStates.XMR_SWAP_NOSCRIPT_TX_REDEEMED)
|
||||
# TODO: Why does using bid.txns error here?
|
||||
self.saveBidInSession(bid_id, bid, session, xmr_swap)
|
||||
# Update copy of bid in swaps_in_progress
|
||||
|
||||
@@ -198,3 +198,6 @@ class CoinInterface:
|
||||
|
||||
def coin_name(self):
|
||||
return chainparams[self.coin_type()]['name'].capitalize()
|
||||
|
||||
def ticker(self):
|
||||
return chainparams[self.coin_type()]['ticker']
|
||||
|
||||
1
basicswap/contrib/__init__.py
Normal file
1
basicswap/contrib/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
@@ -166,6 +166,8 @@ class XMRInterface(CoinInterface):
|
||||
params = {'out': True, 'pending': True, 'failed': True, 'pool': True, }
|
||||
rv = self.rpc_wallet_cb('get_transfers', params)
|
||||
logging.info('[rm] get_transfers {}'.format(dumpj(rv)))
|
||||
if 'pending' not in rv:
|
||||
break
|
||||
time.sleep(1)
|
||||
|
||||
return tx_hash
|
||||
|
||||
@@ -48,7 +48,7 @@ def setCoinFilter(form_data, field_name):
|
||||
raise ValueError('Unknown Coin Type {}'.format(str(field_name)))
|
||||
|
||||
|
||||
def getTxIdHex(bid, tx_type, prefix):
|
||||
def getTxIdHex(bid, tx_type, suffix):
|
||||
if tx_type == TxTypes.ITX:
|
||||
obj = bid.initiate_tx
|
||||
elif tx_type == TxTypes.PTX:
|
||||
@@ -60,7 +60,7 @@ def getTxIdHex(bid, tx_type, prefix):
|
||||
return 'None'
|
||||
if not obj.txid:
|
||||
return 'None'
|
||||
return obj.txid.hex() + prefix
|
||||
return obj.txid.hex() + suffix
|
||||
|
||||
|
||||
def getTxSpendHex(bid, tx_type):
|
||||
@@ -86,13 +86,10 @@ def listBidStates():
|
||||
|
||||
|
||||
def describeBid(swap_client, bid, offer, edit_bid, show_txns):
|
||||
|
||||
coin_from = Coins(offer.coin_from)
|
||||
coin_to = Coins(offer.coin_to)
|
||||
ci_from = swap_client.ci(coin_from)
|
||||
ci_to = swap_client.ci(coin_to)
|
||||
ticker_from = swap_client.getTicker(coin_from)
|
||||
ticker_to = swap_client.getTicker(coin_to)
|
||||
ci_from = swap_client.ci(Coins(offer.coin_from))
|
||||
ci_to = swap_client.ci(Coins(offer.coin_to))
|
||||
ticker_from = ci_from.ticker()
|
||||
ticker_to = ci_to.ticker()
|
||||
|
||||
if bid.state == BidStates.BID_SENT:
|
||||
state_description = 'Waiting for seller to accept.'
|
||||
|
||||
Reference in New Issue
Block a user