1.在运行部署在ganache1.1.0上的合约中的某个函数时,出现了这样的问题,之前部署在geth上时并没有这样的问题
userdeMacBook-Pro:test-ethers user$ node test-index.js
CreateAndBuyToken error :Error: Transaction hash mismatch from Provider.sendTransaction. (expectedHash="0x211f260dbb90994afc634271d596bde5ddc17da85c24abca30691c1193f39f1b", returnedHash="0x8e0223f1a8627ed6b9677e0fb09bd02cda5f1cea0e19edebda44c771803bc697", version=4.0.)
发现这好像是ganache版本的问题:
I experienced the same issue with ganache-cli@6.2. paired with ethers@4.0.. Downgrading to ganache-cli@6.1. fixed the issue.
所以后面打算还是使用geth
2.
Error: gas required exceeds allowance or always failing transaction
在运行合约函数时加上{gasLimit : 500000}即可,因为eth_estimateGas得出了infinite的结果