Ai
1 Star 0 Fork 0

艾鸥科技/go-aiou

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
receipt.go 914 Bytes
Copy Edit Raw Blame History
张卓 authored 2020-05-10 14:55 +08:00 . init
package itest
import (
"gitee.com/aiou-official/go-aiou/common"
"gitee.com/aiou-official/go-aiou/core/tx"
"gitee.com/aiou-official/go-aiou/rpc/pb"
)
// Receipt is the transaction receipt object
type Receipt struct {
*tx.TxReceipt
}
// Success will return whether the receipt is successful
func (r *Receipt) Success() bool {
return r.Status.Code == tx.Success
}
// NewReceiptFromPb returns a new Receipt instance from protobuffer struct.
func NewReceiptFromPb(tr *rpcpb.TxReceipt) *Receipt {
ret := &tx.TxReceipt{
TxHash: common.Base58Decode(tr.TxHash),
GasUsage: int64(tr.GasUsage * 100),
RAMUsage: tr.RamUsage,
Status: &tx.Status{
Message: tr.Message,
Code: tx.StatusCode(tr.StatusCode),
},
Returns: tr.Returns,
}
for _, r := range tr.Receipts {
ret.Receipts = append(ret.Receipts, &tx.Receipt{
FuncName: r.FuncName,
Content: r.Content,
})
}
return &Receipt{ret}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/aiou-official/go-aiou.git
git@gitee.com:aiou-official/go-aiou.git
aiou-official
go-aiou
go-aiou
376a44096468

Search