我正在尝试检测合同上的交易还原。我使用 sendRawTransaction 签署并发送 rawTX。之后,我使用从 sendRawTransaction 获得的 TX 哈希调用以下函数。
try:
receipt = self.w3.eth.waitForTransactionReceipt(tx, timeout=6000)
return receipt
except exceptions.SolidityError as error:
print(error)
但是,当 TX 回滚时,上面并没有产生异常,而是返回了收据。
我的代码的目标是尝试获取还原原因,根据此问题: https ://github.com/ethereum/web3.py/issues/941 根据此更新已修复: https://web3py .readthedocs.io/en/stable/releases.html?highlight=exceptions#id15
任何关于如何做到这一点的建议将不胜感激!:)