Lower min locktime to 1 hour for easier testing.

Fix blocks confirmed count.
2024-05-20_merge
tecnovert 4 years ago
parent 7bb2cd7d1e
commit cb27fb6c4c
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
  1. 6
      basicswap/basicswap.py
  2. 2
      basicswap/interface_btc.py
  3. 1
      basicswap/templates/bid.html
  4. 7
      basicswap/templates/bid_xmr.html
  5. 2
      basicswap/templates/offer_new.html
  6. 4
      basicswap/ui.py

@ -236,6 +236,8 @@ def strBidState(state):
return 'Sent' return 'Sent'
if state == BidStates.BID_RECEIVING: if state == BidStates.BID_RECEIVING:
return 'Receiving' return 'Receiving'
if state == BidStates.BID_RECEIVING_ACC:
return 'Receiving accept'
if state == BidStates.BID_RECEIVED: if state == BidStates.BID_RECEIVED:
return 'Received' return 'Received'
if state == BidStates.BID_ACCEPTED: if state == BidStates.BID_ACCEPTED:
@ -2624,16 +2626,16 @@ class BasicSwap(BaseApp):
self.logBidEvent(bid, EventLogTypes.LOCK_TX_A_CONFIRMED, '', session) self.logBidEvent(bid, EventLogTypes.LOCK_TX_A_CONFIRMED, '', session)
bid.xmr_a_lock_tx.setState(TxStates.TX_CONFIRMED) bid.xmr_a_lock_tx.setState(TxStates.TX_CONFIRMED)
bid.setState(BidStates.XMR_SWAP_SCRIPT_COIN_LOCKED) bid.setState(BidStates.XMR_SWAP_SCRIPT_COIN_LOCKED)
self.saveBidInSession(bid_id, bid, session, xmr_swap) bid_changed = True
if bid.was_sent: if bid.was_sent:
delay = random.randrange(self.min_delay_event, self.max_delay_event) delay = random.randrange(self.min_delay_event, self.max_delay_event)
self.log.info('Sending xmr swap chain B lock tx for bid %s in %d seconds', bid_id.hex(), delay) self.log.info('Sending xmr swap chain B lock tx for bid %s in %d seconds', bid_id.hex(), delay)
self.createEventInSession(delay, EventTypes.SEND_XMR_SWAP_LOCK_TX_B, bid_id, session) self.createEventInSession(delay, EventTypes.SEND_XMR_SWAP_LOCK_TX_B, bid_id, session)
# bid.setState(BidStates.SWAP_DELAYING) # bid.setState(BidStates.SWAP_DELAYING)
bid_changed = True
if bid_changed: if bid_changed:
self.saveBidInSession(bid_id, bid, session, xmr_swap)
session.commit() session.commit()
elif state == BidStates.XMR_SWAP_SCRIPT_COIN_LOCKED: elif state == BidStates.XMR_SWAP_SCRIPT_COIN_LOCKED:

@ -824,7 +824,7 @@ class BTCInterface(CoinInterface):
continue continue
rv.append({ rv.append({
'depth': 0 if 'height' not in utxo else chain_height - utxo['height'], 'depth': 0 if 'height' not in utxo else (chain_height - utxo['height']) + 1,
'height': 0 if 'height' not in utxo else utxo['height'], 'height': 0 if 'height' not in utxo else utxo['height'],
'amount': utxo['amount'] * COIN, 'amount': utxo['amount'] * COIN,
'txid': utxo['txid'], 'txid': utxo['txid'],

@ -74,7 +74,6 @@
</table> </table>
<p><a href="/">home</a></p> <p><a href="/">home</a></p>
<script> <script>
function confirmPopup() { function confirmPopup() {
confirm("Are you sure?"); confirm("Are you sure?");

@ -48,7 +48,7 @@
{% if data.was_received == 'True' %} {% if data.was_received == 'True' %}
<input name="accept_bid" type="submit" value="Accept Bid"><br/> <input name="accept_bid" type="submit" value="Accept Bid"><br/>
{% endif %} {% endif %}
<input name="abandon_bid" type="submit" value="Abandon Bid"> <input name="abandon_bid" type="submit" value="Abandon Bid" onclick="confirmPopup()">
{% if data.show_txns %} {% if data.show_txns %}
<input name="hide_txns" type="submit" value="Hide Info"> <input name="hide_txns" type="submit" value="Hide Info">
{% else %} {% else %}
@ -77,4 +77,9 @@
</table> </table>
<p><a href="/">home</a></p> <p><a href="/">home</a></p>
<script>
function confirmPopup() {
confirm("Are you sure?");
}
</script>
</body></html> </body></html>

@ -31,7 +31,7 @@
</select> </select>
</td><td>Amount To</td><td><input type="text" name="amt_to"></td></tr> </td><td>Amount To</td><td><input type="text" name="amt_to"></td></tr>
<tr><td>Contract locked (hrs)</td><td><input type="number" name="lockhrs" min="2" max="96" value="48"></td><td colspan=2>Participate txn will be locked for half the time.</td></tr> <tr><td>Contract locked (hrs)</td><td><input type="number" name="lockhrs" min="1" max="64" value="32"></td><td colspan=2>Participate txn will be locked for half the time.</td></tr>
<tr><td>Auto Accept Bids</td><td colspan=3><input type="checkbox" name="autoaccept" value="aa" checked></td></tr> <tr><td>Auto Accept Bids</td><td colspan=3><input type="checkbox" name="autoaccept" value="aa" checked></td></tr>
</table> </table>

@ -154,14 +154,14 @@ def describeBid(swap_client, bid, offer, edit_bid, show_txns):
if bid.xmr_a_lock_tx: if bid.xmr_a_lock_tx:
confirms = None confirms = None
if swap_client.coin_clients[ci_from.coin_type()]['last_height'] and bid.xmr_a_lock_tx.chain_height: if swap_client.coin_clients[ci_from.coin_type()]['last_height'] and bid.xmr_a_lock_tx.chain_height:
confirms = swap_client.coin_clients[ci_from.coin_type()]['last_height'] - bid.xmr_a_lock_tx.chain_height confirms = (swap_client.coin_clients[ci_from.coin_type()]['last_height'] - bid.xmr_a_lock_tx.chain_height) + 1
txns.append({'type': 'Chain A Lock', 'txid': bid.xmr_a_lock_tx.txid.hex(), 'confirms': confirms}) txns.append({'type': 'Chain A Lock', 'txid': bid.xmr_a_lock_tx.txid.hex(), 'confirms': confirms})
if bid.xmr_a_lock_spend_tx: if bid.xmr_a_lock_spend_tx:
txns.append({'type': 'Chain A Lock Spend', 'txid': bid.xmr_a_lock_spend_tx.txid.hex()}) txns.append({'type': 'Chain A Lock Spend', 'txid': bid.xmr_a_lock_spend_tx.txid.hex()})
if bid.xmr_b_lock_tx: if bid.xmr_b_lock_tx:
confirms = None confirms = None
if swap_client.coin_clients[ci_to.coin_type()]['last_height'] and bid.xmr_b_lock_tx.chain_height: if swap_client.coin_clients[ci_to.coin_type()]['last_height'] and bid.xmr_b_lock_tx.chain_height:
confirms = swap_client.coin_clients[ci_to.coin_type()]['last_height'] - bid.xmr_b_lock_tx.chain_height confirms = (swap_client.coin_clients[ci_to.coin_type()]['last_height'] - bid.xmr_b_lock_tx.chain_height) + 1
txns.append({'type': 'Chain B Lock', 'txid': bid.xmr_b_lock_tx.txid.hex(), 'confirms': confirms}) txns.append({'type': 'Chain B Lock', 'txid': bid.xmr_b_lock_tx.txid.hex(), 'confirms': confirms})
if bid.xmr_b_lock_tx and bid.xmr_b_lock_tx.spend_txid: if bid.xmr_b_lock_tx and bid.xmr_b_lock_tx.spend_txid:
txns.append({'type': 'Chain B Lock Spend', 'txid': bid.xmr_b_lock_tx.spend_txid.hex()}) txns.append({'type': 'Chain B Lock Spend', 'txid': bid.xmr_b_lock_tx.spend_txid.hex()})

Loading…
Cancel
Save