Skip to content

Commit

Permalink
fix receipt status bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Musiczombie committed Jan 20, 2020
1 parent 3fb7862 commit 669abd4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion client/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func NewRPCRequest(jsonRpc string, method string, param ...interface{}) *RPCRequ
return r
}

func SendRPCRequest(rpcRequest *RPCRequest) (*gabs.Container, error) {
func sendRPCRequest(rpcRequest *RPCRequest) (*gabs.Container, error) {
host := config.Node.RpcUrl
var buff bytes.Buffer
if err := json.NewEncoder(&buff).Encode(rpcRequest); err != nil {
Expand All @@ -63,6 +63,17 @@ func SendRPCRequest(rpcRequest *RPCRequest) (*gabs.Container, error) {
return jsonParsed, nil
}

func SendRPCRequest(rpcRequest *RPCRequest) (gc *gabs.Container, err error) {
for i := 0; i < 10; i++ {
gc, err := sendRPCRequest(rpcRequest)
if err == nil {
return gc, nil
}
time.Sleep(time.Second * time.Duration(1))
}
return nil, err
}

func SendRPCRequstWithAuth(host string, username string, password string, rpcRequest *RPCRequest) (*gabs.Container, error) {
var buff bytes.Buffer
if err := json.NewEncoder(&buff).Encode(rpcRequest); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion task/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (f *FeeTask) analysisFeeAction(data *types.BlockAndResult, dbTx *sql.Tx) er
gasPrice := big.NewInt(0).Set(tx.GasPrice)
for j, aRs := range receipt.ActionResults {
at := tx.RPCActions[j]
if at.Type == types.IssueAsset {
if at.Type == types.IssueAsset && aRs.Status == types.ReceiptStatusSuccessful {
iActionAsset, err := parsePayload(at)
if err != nil {
ZapLog.Error("parsePayload error: ", zap.Error(err))
Expand Down

0 comments on commit 669abd4

Please sign in to comment.