From f954822d74b117b38a301c7a2dca31402ece9ec8 Mon Sep 17 00:00:00 2001
From: tecnovert <tecnovert@tecnovert.net>
Date: Tue, 1 Oct 2024 19:37:28 +0200
Subject: [PATCH] Remove spurious error in debug ui mode.

---
 basicswap/basicswap.py | 10 +++++-----
 basicswap/ui/util.py   |  9 +++++----
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py
index daf4aee..0f06e6f 100644
--- a/basicswap/basicswap.py
+++ b/basicswap/basicswap.py
@@ -1880,12 +1880,12 @@ class BasicSwap(BaseApp):
 
         return self.grindForEd25519Key(coin_type, evkey, key_path_base)
 
-    def getPathKey(self, coin_from, coin_to, offer_created_at: int, contract_count: int, key_no: int, for_ed25519: bool = False) -> bytes:
+    def getPathKey(self, coin_from, coin_to, bid_created_at: int, contract_count: int, key_no: int, for_ed25519: bool = False) -> bytes:
         evkey = self.callcoinrpc(Coins.PART, 'extkey', ['account', 'default', 'true'])['evkey']
         ci = self.ci(coin_to)
 
-        days = offer_created_at // 86400
-        secs = offer_created_at - days * 86400
+        days = bid_created_at // 86400
+        secs = bid_created_at - days * 86400
         key_path_base = '44445555h/999999/{}/{}/{}/{}/{}/{}'.format(int(coin_from), int(coin_to), days, secs, contract_count, key_no)
 
         if not for_ed25519:
@@ -1917,7 +1917,7 @@ class BasicSwap(BaseApp):
         pubkey = self.callcoinrpc(Coins.PART, 'extkey', ['info', extkey])['key_info']['pubkey']
         return bytes.fromhex(pubkey)
 
-    def getContractPrivkey(self, date, contract_count):
+    def getContractPrivkey(self, date: dt.datetime, contract_count: int) -> bytes:
         # Derive an address to use for a contract
         evkey = self.callcoinrpc(Coins.PART, 'extkey', ['account', 'default', 'true'])['evkey']
 
@@ -1932,7 +1932,7 @@ class BasicSwap(BaseApp):
             raw = raw[:32]
         return raw
 
-    def getContractSecret(self, date, contract_count):
+    def getContractSecret(self, date: dt.datetime, contract_count: int) -> bytes:
         # Derive a key to use for a contract secret
         evkey = self.callcoinrpc(Coins.PART, 'extkey', ['account', 'default', 'true'])['evkey']
 
diff --git a/basicswap/ui/util.py b/basicswap/ui/util.py
index 19e1c02..3434f79 100644
--- a/basicswap/ui/util.py
+++ b/basicswap/ui/util.py
@@ -1,12 +1,11 @@
 # -*- coding: utf-8 -*-
 
-# Copyright (c) 2020-2023 tecnovert
+# Copyright (c) 2020-2024 tecnovert
 # Distributed under the MIT software license, see the accompanying
 # file LICENSE or http://www.opensource.org/licenses/mit-license.php.
 
 import json
 import struct
-import traceback
 from basicswap.util import (
     make_int,
     format_timestamp,
@@ -330,12 +329,14 @@ def describeBid(swap_client, bid, xmr_swap, offer, xmr_offer, bid_events, edit_b
             if swap_client.debug_ui:
                 try:
                     data['xmr_b_half_privatekey'] = getChainBSplitKey(swap_client, bid, xmr_swap, offer)
-
+                except Exception as e:
+                    swap_client.log.debug('Unable to get xmr_b_half_privatekey for bid: {}'.format(bid.bid_id.hex()))
+                try:
                     remote_split_key = getChainBRemoteSplitKey(swap_client, bid, xmr_swap, offer)
                     if remote_split_key:
                         data['xmr_b_half_privatekey_remote'] = remote_split_key
                 except Exception as e:
-                    swap_client.log.error(traceback.format_exc())
+                    swap_client.log.debug('Unable to get xmr_b_half_privatekey_remote for bid: {}'.format(bid.bid_id.hex()))
 
             if show_lock_transfers:
                 if xmr_swap.pkbs: