|
|
@@ -372,7 +372,12 @@ class ArbitrageProcess:
|
|
|
# 调用链上客户端执行买入交易
|
|
|
signed_tx = web3._sign(self.tx, self.gas_limit_multiplier)
|
|
|
self.chain_tx_hash = web3.w3.to_hex(signed_tx.hash)
|
|
|
- web3.w3.eth.send_raw_transaction(signed_tx.raw_transaction)
|
|
|
+ try:
|
|
|
+ web3.w3.eth.send_raw_transaction(signed_tx.raw_transaction)
|
|
|
+ except Exception as e:
|
|
|
+ msg = f"据反饋說链上买入失败:{e}, 交易哈希:{self.chain_tx_hash}"
|
|
|
+ logger.error(msg)
|
|
|
+ add_state_flow_entry(self.process_item, self.current_state, msg, "fail")
|
|
|
|
|
|
# 交易成功后刷新全局nonce
|
|
|
with self.core_lock:
|
|
|
@@ -387,12 +392,12 @@ class ArbitrageProcess:
|
|
|
}
|
|
|
|
|
|
# 交易成功
|
|
|
- msg = f"链上买入交易已发送, 交易哈希:{self.chain_tx_hash}"
|
|
|
+ msg = f"再次確認交易是否上鏈:{self.chain_tx_hash}"
|
|
|
logger.info(msg)
|
|
|
add_state_flow_entry(self.process_item, self.current_state, msg, "success")
|
|
|
self._set_state(self.STATE_WAITING_CHAIN_CONFIRM)
|
|
|
except Exception as e:
|
|
|
- msg = f"据反饋說链上买入失败:{e}, 交易哈希:{self.chain_tx_hash}"
|
|
|
+ msg = f"鏈上買入未處理的錯誤:{e}, 交易哈希:{self.chain_tx_hash}"
|
|
|
logger.error(msg)
|
|
|
add_state_flow_entry(self.process_item, self.current_state, msg, "fail")
|
|
|
self._set_state(self.STATE_WAITING_CHAIN_CONFIRM)
|