2

关于合约函数请求异常的疑问求解

 2 years ago
source link: https://learnblockchain.cn/question/2938
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

关于合约函数请求异常的疑问求解

对某一个合约函数进行请求遇到过两种异常,

第一种就是 函数直接返回错误信息,这种异常是不上链的,没有gas费产生.我是用c#的 web3库,表现出的是exception,

另一种情况是交易也经过pending之后上链,最终报错,并且在区块链浏览器上有感叹号记录,也有gas费产生.

这两种情况都会有可能出现,请问两种结果分别是在什么情况下会产生呢 还是随机出现的

最佳答案 1天前

第一个是在提交交易的时候,就检查出来无法执行,比如你没有权限执行,输入参数不对。

第二个是在提交交易时,可以执行,但是真正打包时,由于有时间差引起的状态变化导致交易无法执行。比如, 在进行兑换的时候,价格变化了,不满足提交时的价格要求

Tiny熊 - 布道者
擅长:智能合约,以太坊 | 采纳率 40% | 回答于 1天前

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK