mirror of
https://github.com/basicswap/basicswap.git
synced 2026-06-11 05:21:40 +02:00
Merge pull request #498 from tecnovert/refactor2
refactor: add haveSignedLockRefundTx
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -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):
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user