8 Commits

Author SHA1 Message Date
tecnovert
4545c2b147 Merge pull request #413 from nahuhh/bitcoin_v29.2
bitcoin: bump to 29.2
2026-01-05 21:17:22 +00:00
tecnovert
b14a77af3d Merge pull request #414 from basicswap/dependabot/pip/dev/python-gnupg-0.5.6
build(deps): bump python-gnupg from 0.5.5 to 0.5.6
2026-01-05 21:17:06 +00:00
tecnovert
eb450e04e0 Merge pull request #415 from tecnovert/db
simplify db, remove state_note
2026-01-05 21:16:06 +00:00
tecnovert
c0a5d0e31d simplify db, remove state_note 2026-01-05 21:20:02 +02:00
dependabot[bot]
e6dca30009 build(deps): bump python-gnupg from 0.5.5 to 0.5.6
Bumps [python-gnupg](https://github.com/vsajip/python-gnupg) from 0.5.5 to 0.5.6.
- [Release notes](https://github.com/vsajip/python-gnupg/releases)
- [Changelog](https://github.com/vsajip/python-gnupg/blob/master/release)
- [Commits](https://github.com/vsajip/python-gnupg/compare/0.5.5...0.5.6)

---
updated-dependencies:
- dependency-name: python-gnupg
  dependency-version: 0.5.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-05 07:14:49 +00:00
nahuhh
ed6ad637a0 bitcoin: bump to 29.2 2026-01-03 00:15:44 +00:00
tecnovert
339d52f114 Merge pull request #412 from tecnovert/logging
fix duplicate bid id in coin b lock tx submit msg, use logIDT consistently
2026-01-02 17:40:07 +00:00
tecnovert
d1d20e855b fix duplicate bid id in coin b lock tx submit msg, use logIDT consistently 2026-01-02 19:16:41 +02:00
8 changed files with 90 additions and 89 deletions

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2019-2024 tecnovert # Copyright (c) 2019-2024 tecnovert
# Copyright (c) 2024-2025 The Basicswap developers # Copyright (c) 2024-2026 The Basicswap developers
# 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.
@@ -1919,8 +1919,15 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
self.activateBid(cursor, bid) self.activateBid(cursor, bid)
except Exception as ex: except Exception as ex:
self.logException(f"Failed to activate bid! Error: {ex}") self.logException(f"Failed to activate bid! Error: {ex}")
self.logEvent(
Concepts.BID,
bid.bid_id,
EventLogTypes.ERROR,
"Failed to activate",
cursor,
)
try: try:
bid.setState(BidStates.BID_ERROR, "Failed to activate") bid.setState(BidStates.BID_ERROR)
offer = self.queryOne( offer = self.queryOne(
Offer, cursor, {"offer_id": bid.offer_id} Offer, cursor, {"offer_id": bid.offer_id}
@@ -3194,12 +3201,13 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
raise ValueError("Must specify offer for save_in_progress") raise ValueError("Must specify offer for save_in_progress")
self.swaps_in_progress[bid_id] = (bid, save_in_progress) # (bid, offer) self.swaps_in_progress[bid_id] = (bid, save_in_progress) # (bid, offer)
def saveBid(self, bid_id: bytes, bid, xmr_swap=None) -> None: def saveBid(self, bid_id: bytes, bid, xmr_swap=None, cursor=None) -> None:
cursor = self.openDB()
try: try:
self.saveBidInSession(bid_id, bid, cursor, xmr_swap) use_cursor = self.openDB(cursor)
self.saveBidInSession(bid_id, bid, use_cursor, xmr_swap)
finally: finally:
self.closeDB(cursor) if cursor is None:
self.closeDB(use_cursor)
def createActionInSession( def createActionInSession(
self, delay: int, action_type: int, linked_id: bytes, cursor self, delay: int, action_type: int, linked_id: bytes, cursor
@@ -3848,7 +3856,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
txid = ci_from.publishTx(bytes.fromhex(txn)) txid = ci_from.publishTx(bytes.fromhex(txn))
self.log.debug( self.log.debug(
f"Submitted initiate txn {txid} to {ci_from.coin_name()} chain for bid {self.log.id(bid_id)}", f"Submitted initiate txn {self.logIDT(txid)} to {ci_from.coin_name()} chain for bid {self.log.id(bid_id)}",
) )
bid.initiate_tx = SwapTx( bid.initiate_tx = SwapTx(
bid_id=bid_id, bid_id=bid_id,
@@ -5002,13 +5010,19 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
self.deactivateBidForReason(bid_id, BidStates.SWAP_TIMEDOUT, cursor=cursor) self.deactivateBidForReason(bid_id, BidStates.SWAP_TIMEDOUT, cursor=cursor)
def setBidError( def setBidError(
self, bid_id: bytes, bid, error_str: str, save_bid: bool = True, xmr_swap=None self,
bid_id: bytes,
bid,
error_str: str,
save_bid: bool = True,
xmr_swap=None,
cursor=None,
) -> None: ) -> None:
self.log.error(f"Bid {self.log.id(bid_id)} - Error: {error_str}") self.log.error(f"Bid {self.log.id(bid_id)} - Error: {error_str}")
self.logEvent(Concepts.BID, bid_id, EventLogTypes.ERROR, error_str, cursor)
bid.setState(BidStates.BID_ERROR) bid.setState(BidStates.BID_ERROR)
bid.state_note = "error msg: " + error_str
if save_bid: if save_bid:
self.saveBid(bid_id, bid, xmr_swap=xmr_swap) self.saveBid(bid_id, bid, xmr_swap=xmr_swap, cursor=cursor)
def createInitiateTxn( def createInitiateTxn(
self, coin_type, bid_id: bytes, bid, initiate_script, prefunded_tx=None self, coin_type, bid_id: bytes, bid, initiate_script, prefunded_tx=None
@@ -5514,7 +5528,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
txn = self.createParticipateTxn(bid_id, bid, offer, participate_script) txn = self.createParticipateTxn(bid_id, bid, offer, participate_script)
txid = ci_to.publishTx(bytes.fromhex(txn)) txid = ci_to.publishTx(bytes.fromhex(txn))
self.log.debug( self.log.debug(
f"Submitted participate tx {self.log.id(txid)} to {ci_to.coin_name()} chain for bid {self.log.id(bid_id)}" f"Submitted participate tx {self.logIDT(txid)} to {ci_to.coin_name()} chain for bid {self.log.id(bid_id)}"
) )
bid.setPTxState(TxStates.TX_SENT) bid.setPTxState(TxStates.TX_SENT)
self.logEvent( self.logEvent(
@@ -5622,7 +5636,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
txn = self.createRedeemTxn(ci_to.coin_type(), bid) txn = self.createRedeemTxn(ci_to.coin_type(), bid)
txid = ci_to.publishTx(bytes.fromhex(txn)) txid = ci_to.publishTx(bytes.fromhex(txn))
self.log.debug( self.log.debug(
f"Submitted participate redeem tx {self.log.id(txid)} to {ci_to.coin_name()} chain for bid {self.log.id(bid_id)}." f"Submitted participate redeem tx {self.logIDT(txid)} to {ci_to.coin_name()} chain for bid {self.log.id(bid_id)}."
) )
self.logEvent( self.logEvent(
Concepts.BID, bid.bid_id, EventLogTypes.PTX_REDEEM_PUBLISHED, "", None Concepts.BID, bid.bid_id, EventLogTypes.PTX_REDEEM_PUBLISHED, "", None
@@ -5908,7 +5922,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
) )
self.log.info( self.log.info(
f"Submitted coin a lock refund spend tx for bid {self.log.id(bid_id)}, txid {self.log.id(txid_str)}" f"Submitted coin a lock refund spend tx for bid {self.log.id(bid_id)}, txid {self.logIDT(txid_str)}"
) )
bid.txns[TxTypes.XMR_SWAP_A_LOCK_REFUND_SPEND] = SwapTx( bid.txns[TxTypes.XMR_SWAP_A_LOCK_REFUND_SPEND] = SwapTx(
bid_id=bid_id, bid_id=bid_id,
@@ -5983,7 +5997,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
txid=bytes.fromhex(txid_hex), txid=bytes.fromhex(txid_hex),
) )
self.log.info( self.log.info(
f"Submitted mercy tx for bid {self.log.id(bid_id)}, txid {self.log.id(txid_hex)}" f"Submitted mercy tx for bid {self.log.id(bid_id)}, txid {self.logIDT(txid_hex)}"
) )
self.logBidEvent( self.logBidEvent(
bid_id, bid_id,
@@ -6670,7 +6684,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
try: try:
txid = ci_to.publishTx(bid.participate_txn_refund) txid = ci_to.publishTx(bid.participate_txn_refund)
self.log.debug( self.log.debug(
f"Submitted participate refund txn {self.log.id(txid)} to {ci_to.coin_name()} chain for bid {self.log.id(bid_id)}." f"Submitted participate refund txn {self.logIDT(txid)} to {ci_to.coin_name()} chain for bid {self.log.id(bid_id)}."
) )
self.logEvent( self.logEvent(
Concepts.BID, Concepts.BID,
@@ -6726,7 +6740,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
def removeWatchedTransaction(self, coin_type, bid_id: bytes, txid_hex: str) -> None: def removeWatchedTransaction(self, coin_type, bid_id: bytes, txid_hex: str) -> None:
# Remove all for bid if txid is None # Remove all for bid if txid is None
self.log.debug( self.log.debug(
f"Removing watched transaction {Coins(coin_type).name} {self.log.id(bid_id)} {self.log.id(txid_hex)}" f"Removing watched transaction {Coins(coin_type).name} {self.log.id(bid_id)} {self.logIDT(txid_hex)}"
) )
watched = self.coin_clients[coin_type]["watched_transactions"] watched = self.coin_clients[coin_type]["watched_transactions"]
old_len = len(watched) old_len = len(watched)
@@ -6735,7 +6749,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
if wo.bid_id == bid_id and (txid_hex is None or wo.txid_hex == txid_hex): if wo.bid_id == bid_id and (txid_hex is None or wo.txid_hex == txid_hex):
del watched[i] del watched[i]
self.log.debug( self.log.debug(
f"Removed watched transaction {Coins(coin_type).name} {self.log.id(bid_id)} {self.log.id(wo.txid_hex)}" f"Removed watched transaction {Coins(coin_type).name} {self.log.id(bid_id)} {self.logIDT(wo.txid_hex)}"
) )
def addWatchedOutput( def addWatchedOutput(
@@ -6756,7 +6770,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
def removeWatchedOutput(self, coin_type, bid_id: bytes, txid_hex: str) -> None: def removeWatchedOutput(self, coin_type, bid_id: bytes, txid_hex: str) -> None:
# Remove all for bid if txid is None # Remove all for bid if txid is None
self.log.debug( self.log.debug(
f"Removing watched output {Coins(coin_type).name} {self.log.id(bid_id)} {self.log.id(txid_hex)}" f"Removing watched output {Coins(coin_type).name} {self.log.id(bid_id)} {self.logIDT(txid_hex)}"
) )
watched = self.coin_clients[coin_type]["watched_outputs"] watched = self.coin_clients[coin_type]["watched_outputs"]
old_len = len(watched) old_len = len(watched)
@@ -6765,7 +6779,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
if wo.bid_id == bid_id and (txid_hex is None or wo.txid_hex == txid_hex): if wo.bid_id == bid_id and (txid_hex is None or wo.txid_hex == txid_hex):
del watched[i] del watched[i]
self.log.debug( self.log.debug(
f"Removed watched output {Coins(coin_type).name} {self.log.id(bid_id)} {self.log.id(wo.txid_hex)}" f"Removed watched output {Coins(coin_type).name} {self.log.id(bid_id)} {self.logIDT(wo.txid_hex)}"
) )
def addWatchedScript( def addWatchedScript(
@@ -7020,6 +7034,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
bid, bid,
"Unexpected txn spent coin a lock tx: {}".format(spend_txid_hex), "Unexpected txn spent coin a lock tx: {}".format(spend_txid_hex),
save_bid=False, save_bid=False,
cursor=use_cursor,
) )
self.saveBidInSession( self.saveBidInSession(
@@ -7729,12 +7744,11 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
self.logException(err_msg) self.logException(err_msg)
bid_id = linked_id bid_id = linked_id
# Failing to accept a bid should not set an error state as the bid has not begun yet
if accepting_bid:
self.logEvent( self.logEvent(
Concepts.BID, bid_id, EventLogTypes.ERROR, err_msg, cursor Concepts.BID, bid_id, EventLogTypes.ERROR, err_msg, cursor
) )
# Failing to accept a bid should not set an error state as the bid has not begun yet
if accepting_bid:
# If delaying with no (further) queued actions reset state # If delaying with no (further) queued actions reset state
if self.countQueuedActions(cursor, bid_id, None) < 2: if self.countQueuedActions(cursor, bid_id, None) < 2:
bid, offer = self.getBidAndOffer(bid_id, cursor) bid, offer = self.getBidAndOffer(bid_id, cursor)
@@ -7754,7 +7768,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
else: else:
bid = self.getBid(bid_id, cursor) bid = self.getBid(bid_id, cursor)
if bid: if bid:
bid.setState(BidStates.BID_ERROR, err_msg) bid.setState(BidStates.BID_ERROR)
self.saveBidInSession(bid_id, bid, cursor) self.saveBidInSession(bid_id, bid, cursor)
query: str = "DELETE FROM actions WHERE trigger_at <= :now" query: str = "DELETE FROM actions WHERE trigger_at <= :now"
@@ -7845,7 +7859,14 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
self.log.debug( self.log.debug(
f"Expiring partially received {bid_type}: {self.log.id(bid.bid_id)}." f"Expiring partially received {bid_type}: {self.log.id(bid.bid_id)}."
) )
bid.setState(BidStates.BID_ERROR, "Timed out") self.logEvent(
Concepts.BID,
bid.bid_id,
EventLogTypes.ERROR,
"Timed out (partially received bid)",
cursor,
)
bid.setState(BidStates.BID_ERROR)
self.updateDB( self.updateDB(
bid, bid,
cursor, cursor,
@@ -9408,7 +9429,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
xmr_swap.a_lock_tx, xmr_swap.a_lock_tx_script xmr_swap.a_lock_tx, xmr_swap.a_lock_tx_script
) )
self.log.debug( self.log.debug(
f"Submitted lock tx {self.log.id(txid_hex)} to {ci_from.coin_name()} chain for bid {self.log.id(bid_id)}.", f"Submitted lock tx {self.logIDT(txid_hex)} to {ci_from.coin_name()} chain for bid {self.log.id(bid_id)}.",
) )
if bid.xmr_a_lock_tx is None: if bid.xmr_a_lock_tx is None:
@@ -9548,7 +9569,11 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
) )
else: else:
self.setBidError( self.setBidError(
bid_id, bid, "publishBLockTx failed: " + str(ex), save_bid=False bid_id,
bid,
"publishBLockTx failed: " + str(ex),
save_bid=False,
cursor=cursor,
) )
self.saveBidInSession( self.saveBidInSession(
bid_id, bid, cursor, xmr_swap, save_in_progress=offer bid_id, bid, cursor, xmr_swap, save_in_progress=offer
@@ -9560,7 +9585,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
return return
self.log.debug( self.log.debug(
f"Submitted lock txn {self.log.id(bid_id)} to {ci_to.coin_name()} chain for bid {self.log.id(bid_id)}." f"Submitted lock txn {self.logIDT(b_lock_tx_id)} to {ci_to.coin_name()} chain for bid {self.log.id(bid_id)}."
) )
bid.xmr_b_lock_tx = SwapTx( bid.xmr_b_lock_tx = SwapTx(
bid_id=bid_id, bid_id=bid_id,
@@ -9733,7 +9758,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
txid = bytes.fromhex(ci_from.publishTx(xmr_swap.a_lock_spend_tx)) txid = bytes.fromhex(ci_from.publishTx(xmr_swap.a_lock_spend_tx))
self.log.debug( self.log.debug(
f"Submitted lock spend txn {self.log.id(txid)} to {ci_from.coin_name()} chain for bid {self.log.id(bid_id)}." f"Submitted lock spend txn {self.logIDT(txid)} to {ci_from.coin_name()} chain for bid {self.log.id(bid_id)}."
) )
self.logBidEvent( self.logBidEvent(
bid.bid_id, EventLogTypes.LOCK_TX_A_SPEND_TX_PUBLISHED, "", cursor bid.bid_id, EventLogTypes.LOCK_TX_A_SPEND_TX_PUBLISHED, "", cursor
@@ -9843,7 +9868,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
lock_tx_vout=lock_tx_vout, lock_tx_vout=lock_tx_vout,
) )
self.log.debug( self.log.debug(
f"Submitted lock B spend txn {self.log.id(txid)} to {ci_to.coin_name()} chain for bid {self.log.id(bid_id)}." f"Submitted lock B spend txn {self.logIDT(txid)} to {ci_to.coin_name()} chain for bid {self.log.id(bid_id)}."
) )
self.logBidEvent( self.logBidEvent(
bid.bid_id, EventLogTypes.LOCK_TX_B_SPEND_TX_PUBLISHED, "", cursor bid.bid_id, EventLogTypes.LOCK_TX_B_SPEND_TX_PUBLISHED, "", cursor
@@ -9871,7 +9896,11 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
) )
else: else:
self.setBidError( self.setBidError(
bid_id, bid, "spendBLockTx failed: " + str(ex), save_bid=False bid_id,
bid,
"spendBLockTx failed: " + str(ex),
save_bid=False,
cursor=cursor,
) )
self.saveBidInSession( self.saveBidInSession(
bid_id, bid, cursor, xmr_swap, save_in_progress=offer bid_id, bid, cursor, xmr_swap, save_in_progress=offer
@@ -9958,7 +9987,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
), ),
) )
self.log.debug( self.log.debug(
f"Submitted lock B refund txn {self.log.id(txid)} to {ci_to.coin_name()} chain for bid {self.log.id(bid_id)}." f"Submitted lock B refund txn {self.logIDT(txid)} to {ci_to.coin_name()} chain for bid {self.log.id(bid_id)}."
) )
self.logBidEvent( self.logBidEvent(
bid.bid_id, EventLogTypes.LOCK_TX_B_REFUND_TX_PUBLISHED, "", cursor bid.bid_id, EventLogTypes.LOCK_TX_B_REFUND_TX_PUBLISHED, "", cursor
@@ -9990,6 +10019,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
bid, bid,
"spendBLockTx for refund failed: " + str(ex), "spendBLockTx for refund failed: " + str(ex),
save_bid=False, save_bid=False,
cursor=cursor,
) )
self.saveBidInSession( self.saveBidInSession(
bid_id, bid, cursor, xmr_swap, save_in_progress=offer bid_id, bid, cursor, xmr_swap, save_in_progress=offer

View File

@@ -55,7 +55,7 @@ PARTICL_VERSION = os.getenv("PARTICL_VERSION", "27.2.3.0")
PARTICL_VERSION_TAG = os.getenv("PARTICL_VERSION_TAG", "") PARTICL_VERSION_TAG = os.getenv("PARTICL_VERSION_TAG", "")
PARTICL_LINUX_EXTRA = os.getenv("PARTICL_LINUX_EXTRA", "nousb") PARTICL_LINUX_EXTRA = os.getenv("PARTICL_LINUX_EXTRA", "nousb")
BITCOIN_VERSION = os.getenv("BITCOIN_VERSION", "28.0") BITCOIN_VERSION = os.getenv("BITCOIN_VERSION", "29.2")
BITCOIN_VERSION_TAG = os.getenv("BITCOIN_VERSION_TAG", "") BITCOIN_VERSION_TAG = os.getenv("BITCOIN_VERSION_TAG", "")
LITECOIN_VERSION = os.getenv("LITECOIN_VERSION", "0.21.4") LITECOIN_VERSION = os.getenv("LITECOIN_VERSION", "0.21.4")

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2019-2024 tecnovert # Copyright (c) 2019-2024 tecnovert
# Copyright (c) 2024-2025 The Basicswap developers # Copyright (c) 2024-2026 The Basicswap developers
# 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.
@@ -13,7 +13,7 @@ from enum import IntEnum, auto
from typing import Optional from typing import Optional
CURRENT_DB_VERSION = 32 CURRENT_DB_VERSION = 33
CURRENT_DB_DATA_VERSION = 7 CURRENT_DB_DATA_VERSION = 7
@@ -135,6 +135,20 @@ class Index:
self.column_3 = column_3 self.column_3 = column_3
class StateRows:
state = Column("integer")
state_time = Column("integer") # Timestamp of last state change
states = Column("blob") # Packed states and times
def setState(self, new_state, state_time=None):
now = int(time.time()) if state_time is None else state_time
self.state = new_state
if self.isSet("states") is False:
self.states = pack_state(new_state, now)
else:
self.states += pack_state(new_state, now)
class DBKVInt(Table): class DBKVInt(Table):
__tablename__ = "kv_int" __tablename__ = "kv_int"
@@ -149,7 +163,7 @@ class DBKVString(Table):
value = Column("string") value = Column("string")
class Offer(Table): class Offer(Table, StateRows):
__tablename__ = "offers" __tablename__ = "offers"
offer_id = Column("blob", primary_key=True) offer_id = Column("blob", primary_key=True)
@@ -197,19 +211,8 @@ class Offer(Table):
bid_reversed = Column("bool") bid_reversed = Column("bool")
smsg_payload_version = Column("integer") smsg_payload_version = Column("integer")
state = Column("integer")
states = Column("blob") # Packed states and times
def setState(self, new_state): class Bid(Table, StateRows):
now = int(time.time())
self.state = new_state
if self.isSet("states") is False:
self.states = pack_state(new_state, now)
else:
self.states += pack_state(new_state, now)
class Bid(Table):
__tablename__ = "bids" __tablename__ = "bids"
bid_id = Column("blob", primary_key=True) bid_id = Column("blob", primary_key=True)
@@ -244,11 +247,7 @@ class Bid(Table):
participate_txn_refund = Column("blob") participate_txn_refund = Column("blob")
in_progress = Column("integer") in_progress = Column("integer")
state = Column("integer")
state_time = Column("integer") # Timestamp of last state change
states = Column("blob") # Packed states and times
state_note = Column("string")
was_sent = Column("bool") # Sent by node was_sent = Column("bool") # Sent by node
was_received = Column("bool") was_received = Column("bool")
contract_count = Column("integer") contract_count = Column("integer")
@@ -287,25 +286,13 @@ class Bid(Table):
if self.isSet("participate_tx"): if self.isSet("participate_tx"):
self.participate_tx.setState(new_state) self.participate_tx.setState(new_state)
def setState(self, new_state, state_note=None):
now = int(time.time())
self.state = new_state
self.state_time = now
if self.isSet("state_note"):
self.state_note = state_note
if self.isSet("states") is False:
self.states = pack_state(new_state, now)
else:
self.states += pack_state(new_state, now)
def getLockTXBVout(self): def getLockTXBVout(self):
if self.isSet("xmr_b_lock_tx"): if self.isSet("xmr_b_lock_tx"):
return self.xmr_b_lock_tx.vout return self.xmr_b_lock_tx.vout
return None return None
class SwapTx(Table): class SwapTx(Table, StateRows):
__tablename__ = "transactions" __tablename__ = "transactions"
bid_id = Column("blob") bid_id = Column("blob")
@@ -328,21 +315,8 @@ class SwapTx(Table):
block_height = Column("integer") block_height = Column("integer")
block_time = Column("integer") block_time = Column("integer")
state = Column("integer")
states = Column("blob") # Packed states and times
primary_key = PrimaryKeyConstraint("bid_id", "tx_type") primary_key = PrimaryKeyConstraint("bid_id", "tx_type")
def setState(self, new_state):
if self.state == new_state:
return
self.state = new_state
now: int = int(time.time())
if self.isSet("states") is False:
self.states = pack_state(new_state, now)
else:
self.states += pack_state(new_state, now)
class PrefundedTx(Table): class PrefundedTx(Table):
__tablename__ = "prefunded_transactions" __tablename__ = "prefunded_transactions"

View File

@@ -130,10 +130,7 @@ def redeemITx(self, bid_id: bytes, cursor):
bid.initiate_tx.spend_txid = bytes.fromhex(txid) bid.initiate_tx.spend_txid = bytes.fromhex(txid)
self.log.debug( self.log.debug(
"Submitted initiate redeem txn %s to %s chain for bid %s", f"Submitted initiate redeem txn {self.logIDT(txid)} to {ci_from.coin_name()} chain for bid {self.logIDB(bid_id)}"
txid,
ci_from.coin_name(),
bid_id.hex(),
) )
self.logEvent(Concepts.BID, bid_id, EventLogTypes.ITX_REDEEM_PUBLISHED, "", cursor) self.logEvent(Concepts.BID, bid_id, EventLogTypes.ITX_REDEEM_PUBLISHED, "", cursor)

View File

@@ -119,7 +119,7 @@ def recoverNoScriptTxnWithKey(self, bid_id: bytes, encoded_key, cursor=None):
lock_tx_vout=lock_tx_vout, lock_tx_vout=lock_tx_vout,
) )
self.log.debug( self.log.debug(
f"Submitted lock B spend txn {self.log.id(txid)} to {ci_follower.coin_name()} chain for bid {self.log.id(bid_id)}." f"Submitted lock B spend txn {self.logIDT(txid)} to {ci_follower.coin_name()} chain for bid {self.log.id(bid_id)}."
) )
self.logBidEvent( self.logBidEvent(
bid.bid_id, bid.bid_id,

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2020-2024 tecnovert # Copyright (c) 2020-2024 tecnovert
# Copyright (c) 2024-2025 The Basicswap developers # Copyright (c) 2024-2026 The Basicswap developers
# 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.
@@ -251,7 +251,7 @@ def describeBid(
elif bid.state == BidStates.BID_ABANDONED: elif bid.state == BidStates.BID_ABANDONED:
state_description = "Bid abandoned" state_description = "Bid abandoned"
elif bid.state == BidStates.BID_ERROR: elif bid.state == BidStates.BID_ERROR:
state_description = bid.state_note state_description = "Bid error"
elif offer.swap_type == SwapTypes.XMR_SWAP: elif offer.swap_type == SwapTypes.XMR_SWAP:
if bid.state == BidStates.BID_SENT: if bid.state == BidStates.BID_SENT:
state_description = "Waiting for offerer to accept" state_description = "Waiting for offerer to accept"

View File

@@ -1,5 +1,5 @@
pyzmq==27.1.0 pyzmq==27.1.0
python-gnupg==0.5.5 python-gnupg==0.5.6
Jinja2==3.1.6 Jinja2==3.1.6
pycryptodome==3.23.0 pycryptodome==3.23.0
PySocks==1.7.1 PySocks==1.7.1

View File

@@ -122,9 +122,9 @@ pysocks==1.7.1 \
--hash=sha256:2725bd0a9925919b9b51739eea5f9e2bae91e83288108a9ad338b2e3a4435ee5 \ --hash=sha256:2725bd0a9925919b9b51739eea5f9e2bae91e83288108a9ad338b2e3a4435ee5 \
--hash=sha256:3f8804571ebe159c380ac6de37643bb4685970655d3bba243530d6558b799aa0 --hash=sha256:3f8804571ebe159c380ac6de37643bb4685970655d3bba243530d6558b799aa0
# via -r requirements.in # via -r requirements.in
python-gnupg==0.5.5 \ python-gnupg==0.5.6 \
--hash=sha256:3fdcaf76f60a1b948ff8e37dc398d03cf9ce7427065d583082b92da7a4ff5a63 \ --hash=sha256:5743e96212d38923fc19083812dc127907e44dbd3bcf0db4d657e291d3c21eac \
--hash=sha256:51fa7b8831ff0914bc73d74c59b99c613de7247b91294323c39733bb85ac3fc1 --hash=sha256:b5050a55663d8ab9fcc8d97556d229af337a87a3ebebd7054cbd8b7e2043394a
# via -r requirements.in # via -r requirements.in
pyzmq==27.1.0 \ pyzmq==27.1.0 \
--hash=sha256:01c0e07d558b06a60773744ea6251f769cd79a41a97d11b8bf4ab8f034b0424d \ --hash=sha256:01c0e07d558b06a60773744ea6251f769cd79a41a97d11b8bf4ab8f034b0424d \