[rpc][tracers] return nil if block not exists

pull/3640/head
peekpi 4 years ago
parent 9ae6819539
commit 6aff71e293
  1. 2
      hmy/tracers/internal/tracers/assets.go
  2. 2
      hmy/tracers/internal/tracers/block_tracer.js
  3. 2
      rpc/tracerParity.go

File diff suppressed because one or more lines are too long

@ -286,7 +286,7 @@
type: sortType,
action: action,
result: call.error ? undefined : result,
error: call.error ? "revert" : undefined
error: call.error ? "Reverted" : undefined
};
for (var key in sorted) {
if (sorted[key] === undefined) {

@ -17,7 +17,7 @@ type PublicParityTracerService struct {
func (s *PublicParityTracerService) Block(ctx context.Context, number rpc.BlockNumber) (interface{}, error) {
block := s.hmy.BlockChain.GetBlockByNumber(uint64(number))
if block == nil {
return block, errors.New("block not exist")
return nil, nil
}
traceJs := "blockTracer"
results, err := s.hmy.TraceBlock(ctx, block, &hmy.TraceConfig{Tracer: &traceJs})

Loading…
Cancel
Save