Merge pull request #498 from tecnovert/refactor2

refactor: add haveSignedLockRefundTx
This commit is contained in:
tecnovert
2026-06-10 18:09:06 +00:00
committed by GitHub
3 changed files with 21 additions and 3 deletions
+1 -2
View File
@@ -7938,8 +7938,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
return rv return rv
else: # not XMR_SWAP_A_LOCK_REFUND in bid.txns else: # not XMR_SWAP_A_LOCK_REFUND in bid.txns
if ( if (
len(xmr_swap.al_lock_refund_tx_sig) > 0 ci_from.haveSignedLockRefundTx(xmr_swap)
and len(xmr_swap.af_lock_refund_tx_sig) > 0
and bid.xmr_a_lock_tx is not None and bid.xmr_a_lock_tx is not None
and ci_from.isCsvLockMature( and ci_from.isCsvLockMature(
offer.lock_type, offer.lock_type,
+15 -1
View File
@@ -192,9 +192,23 @@ class AdaptorSigInterface:
def getScriptLockRefundSwipeTxDummyWitness(self, script: bytes) -> List[bytes]: def getScriptLockRefundSwipeTxDummyWitness(self, script: bytes) -> List[bytes]:
return [bytes(72), b"", bytes(len(script))] return [bytes(72), b"", bytes(len(script))]
def getLockRefundVout(self, lock_refund_tx_data: bytes, vbkv: bytes): def getLockRefundVout(self, lock_refund_tx_data: bytes, vbkv: bytes) -> int:
return 0 return 0
def haveSignedLockRefundTx(self, xmr_swap) -> bool:
if xmr_swap.a_lock_refund_tx is None:
return False
if (
xmr_swap.al_lock_refund_tx_sig is None
or xmr_swap.af_lock_refund_tx_sig is None
):
return False
return (
len(xmr_swap.al_lock_refund_tx_sig) > 0
and len(xmr_swap.af_lock_refund_tx_sig) > 0
)
class Secp256k1Interface(CoinInterface, AdaptorSigInterface): class Secp256k1Interface(CoinInterface, AdaptorSigInterface):
def __init__(self, **kwargs): def __init__(self, **kwargs):
+5
View File
@@ -1198,3 +1198,8 @@ class BCHInterface(BTCInterface):
txHex = tx.serialize_without_witness() txHex = tx.serialize_without_witness()
return self.signTxWithWallet(txHex) return self.signTxWithWallet(txHex)
def haveSignedLockRefundTx(self, xmr_swap) -> bool:
if xmr_swap.a_lock_refund_tx is None:
return False
return True