Browse Source

proto.eth.tx.bump: fix file ext; tx.tx_proxy: error handling

The MMGen Project 7 months ago
parent
commit
cfdd10dc60
2 changed files with 13 additions and 7 deletions
  1. 5 2
      mmgen/proto/eth/tx/bump.py
  2. 8 5
      mmgen/tx/tx_proxy.py

+ 5 - 2
mmgen/proto/eth/tx/bump.py

@@ -18,6 +18,7 @@ from ....tx import bump as TxBase
 from .completed import Completed, TokenCompleted
 from .new import TokenNew
 from .new_swap import NewSwap
+from .unsigned import AutomountUnsigned, TokenAutomountUnsigned
 
 class Bump(Completed, NewSwap, TxBase.Bump):
 	desc = 'fee-bumped transaction'
@@ -39,7 +40,9 @@ class TokenBump(TokenCompleted, TokenNew, Bump):
 	desc = 'fee-bumped transaction'
 
 class AutomountBump(Bump):
-	pass
+	ext       = AutomountUnsigned.ext
+	automount = AutomountUnsigned.automount
 
 class TokenAutomountBump(TokenBump):
-	pass
+	ext       = TokenAutomountUnsigned.ext
+	automount = TokenAutomountUnsigned.automount

+ 8 - 5
mmgen/tx/tx_proxy.py

@@ -164,11 +164,14 @@ class EtherscanTxProxyClient(TxProxyClient):
 		from ..obj import CoinTxID, is_coin_txid
 		form = self.get_form_element(result_text)
 		json_text = form.find('div/div/div')[1].tail
-		txid = json.loads(json_text)['result'].removeprefix('0x')
-		if is_coin_txid(txid):
-			return CoinTxID(txid)
-		else:
-			return False
+		txid = None
+		try:
+			txid = json.loads(json_text)['result'].removeprefix('0x')
+		except json.JSONDecodeError:
+			msg(json_text)
+		except Exception as e:
+			msg(f'{type(e).__name__}: {e}')
+		return CoinTxID(txid) if is_coin_txid(txid) else False
 
 def send_tx(cfg, txhex):