From 273da833db83e536b939e99fdaff8167e501fbc0 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Thu, 14 Nov 2024 15:30:09 +0200 Subject: [PATCH] Bump version. --- basicswap/__init__.py | 2 +- basicswap/basicswap.py | 13 ++++++++----- basicswap/interface/base.py | 4 ++++ basicswap/interface/btc.py | 4 +++- doc/release-notes.md | 10 ++++++++++ 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/basicswap/__init__.py b/basicswap/__init__.py index 3e250ea..31a8c69 100644 --- a/basicswap/__init__.py +++ b/basicswap/__init__.py @@ -1,3 +1,3 @@ name = "basicswap" -__version__ = "0.14.1" +__version__ = "0.14.2" diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index 5bd1b9c..22c47bb 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -3883,12 +3883,15 @@ class BasicSwap(BaseApp): session.commit() if self.isBchXmrSwap(offer): - for_ed25519: bool = True if ci_to.curve_type() == Curves.ed25519 else False - kbsf = self.getPathKey(ci_from.coin_type(), ci_to.coin_type(), bid.created_at, xmr_swap.contract_count, KeyTypes.KBSF, for_ed25519) + if ci_from.altruistic(): + for_ed25519: bool = True if ci_to.curve_type() == Curves.ed25519 else False + kbsf = self.getPathKey(ci_from.coin_type(), ci_to.coin_type(), bid.created_at, xmr_swap.contract_count, KeyTypes.KBSF, for_ed25519) - mercy_tx = ci_from.createMercyTx(xmr_swap.a_lock_refund_swipe_tx, h2b(txid), xmr_swap.a_lock_refund_tx_script, kbsf) - txid = ci_from.publishTx(mercy_tx) - self.log.info('Submitted mercy tx for bid %s, txid %s', bid_id.hex(), txid) + mercy_tx = ci_from.createMercyTx(xmr_swap.a_lock_refund_swipe_tx, h2b(txid), xmr_swap.a_lock_refund_tx_script, kbsf) + txid = ci_from.publishTx(mercy_tx) + self.log.info('Submitted mercy tx for bid {}, txid {}'.format(bid_id.hex(), txid)) + else: + self.log.info('Not sending mercy tx for bid {}'.format(bid_id.hex())) except Exception as ex: self.log.debug('Trying to publish coin a lock refund swipe tx: %s', str(ex)) diff --git a/basicswap/interface/base.py b/basicswap/interface/base.py index 6c4afac..42cd123 100644 --- a/basicswap/interface/base.py +++ b/basicswap/interface/base.py @@ -52,6 +52,7 @@ class CoinInterface: self.setDefaults() self._network = network self._mx_wallet = threading.Lock() + self._altruistic = True def setDefaults(self): self._unknown_wallet_seed = True @@ -166,6 +167,9 @@ class CoinInterface: def checkWallets(self) -> int: return 1 + def altruistic(self) -> bool: + return self._altruistic + class AdaptorSigInterface(): def getScriptLockTxDummyWitness(self, script: bytes): diff --git a/basicswap/interface/btc.py b/basicswap/interface/btc.py index 469490b..3daea8a 100644 --- a/basicswap/interface/btc.py +++ b/basicswap/interface/btc.py @@ -627,9 +627,11 @@ class BTCInterface(Secp256k1Interface): tx.vout.append(self.txoType()(locked_coin, self.getScriptForPubkeyHash(pkh_dest))) - if self._altruistic and kbsf: + if self.altruistic() and kbsf: # Add mercy_keyshare tx.vout.append(self.txoType()(0, CScript([OP_RETURN, b'XBSW', kbsf]))) + else: + self._log.debug('Not attaching mercy output, have kbsf {}.'.format('true' if kbsf else 'false')) dummy_witness_stack = self.getScriptLockRefundSwipeTxDummyWitness(script_lock_refund) witness_bytes = self.getWitnessStackSerialisedLength(dummy_witness_stack) diff --git a/doc/release-notes.md b/doc/release-notes.md index 06a1fba..cc2cead 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -1,3 +1,13 @@ + +0.14.2 +============== + +- BCH support. +- Mercy outputs on swipe txns of BTC descended coins. + - Disable by setting 'altruistic' to false in basicswap.json + + + 0.13.2 ==============