|
|
@ -373,7 +373,7 @@ class XMRInterface(CoinInterface): |
|
|
|
|
|
|
|
return None |
|
|
|
|
|
|
|
def spendBLockTx(self, chain_b_lock_txid, address_to, kbv, kbs, cb_swap_value, b_fee_rate, restore_height): |
|
|
|
def spendBLockTx(self, chain_b_lock_txid, address_to, kbv, kbs, cb_swap_value, b_fee_rate, restore_height, spend_actual_balance=False): |
|
|
|
with self._mx_wallet: |
|
|
|
Kbv = self.getPubkey(kbv) |
|
|
|
Kbs = self.getPubkey(kbs) |
|
|
@ -403,6 +403,7 @@ class XMRInterface(CoinInterface): |
|
|
|
|
|
|
|
self.rpc_wallet_cb('refresh') |
|
|
|
rv = self.rpc_wallet_cb('get_balance') |
|
|
|
|
|
|
|
if rv['balance'] < cb_swap_value: |
|
|
|
self._log.warning('Balance is too low, checking for existing spend.') |
|
|
|
txns = self.rpc_wallet_cb('get_transfers', {'out': True})['out'] |
|
|
@ -414,7 +415,13 @@ class XMRInterface(CoinInterface): |
|
|
|
return bytes.fromhex(txid) |
|
|
|
|
|
|
|
self._log.error('wallet {} balance {}, expected {}'.format(wallet_filename, rv['balance'], cb_swap_value)) |
|
|
|
raise TemporaryError('Invalid balance') |
|
|
|
|
|
|
|
if not spend_actual_balance: |
|
|
|
raise TemporaryError('Invalid balance') |
|
|
|
|
|
|
|
if spend_actual_balance and rv['balance'] != cb_swap_value: |
|
|
|
self._log.warning('Spending actual balance {}, not swap value {}.'.format(rv['balance'], cb_swap_value)) |
|
|
|
cb_swap_value = rv['balance'] |
|
|
|
if rv['unlocked_balance'] < cb_swap_value: |
|
|
|
self._log.error('wallet {} balance {}, expected {}, blocks_to_unlock {}'.format(wallet_filename, rv['unlocked_balance'], cb_swap_value, rv['blocks_to_unlock'])) |
|
|
|
raise TemporaryError('Invalid unlocked_balance') |
|
|
|