@@ -11,6 +11,7 @@ import "C" //nolint:typecheck
1111
1212import (
1313 "encoding/json"
14+ "fmt"
1415 "sync"
1516 "unsafe"
1617
@@ -147,7 +148,7 @@ func (ccc *CircuitCapacityChecker) ApplyBlock(traces *types.BlockTrace) (*types.
147148}
148149
149150// CheckTxNum compares whether the tx_count in ccc match the expected
150- func (ccc * CircuitCapacityChecker ) CheckTxNum (expected int ) (bool , unit64 , error ) {
151+ func (ccc * CircuitCapacityChecker ) CheckTxNum (expected int ) (bool , uint64 , error ) {
151152 ccc .Lock ()
152153 defer ccc .Unlock ()
153154
@@ -159,14 +160,12 @@ func (ccc *CircuitCapacityChecker) CheckTxNum(expected int) (bool, unit64, error
159160 log .Debug ("ccc get_tx_num end" , "id" , ccc .ID )
160161
161162 result := & WrappedTxNum {}
162- if err = json .Unmarshal ([]byte (C .GoString (rawResult )), result ); err != nil {
163- log .Error ("fail to json unmarshal get_tx_num result" , "id" , ccc .ID , "err" , err )
164- return false , 0 , ErrUnknown
163+ if err := json .Unmarshal ([]byte (C .GoString (rawResult )), result ); err != nil {
164+ return false , 0 , fmt .Errorf ("fail to json unmarshal get_tx_num result, id: %d, err: %w" , ccc .ID , err )
165165 }
166166 if result .Error != "" {
167- log .Error ("fail to get_tx_num in CircuitCapacityChecker" , "id" , ccc .ID , "err" , result .Error )
168- return false , 0 , ErrUnknown
167+ return false , 0 , fmt .Errorf ("fail to get_tx_num in CircuitCapacityChecker, id: %d, err: %w" , ccc .ID , result .Error )
169168 }
170169
171- return result .TxNum == unit64 (expected ), result .TxNum , nil
170+ return result .TxNum == uint64 (expected ), result .TxNum , nil
172171}
0 commit comments