support rosetta tracer

pull/4065/head
Lutty 3 years ago
parent d86ac24fc1
commit ecb93a9882
  1. 14
      rosetta/services/block.go

@ -291,10 +291,10 @@ func init() {
func (s *BlockAPI) getTransactionTrace( func (s *BlockAPI) getTransactionTrace(
ctx context.Context, blk *hmytypes.Block, txInfo *transactionInfo, ctx context.Context, blk *hmytypes.Block, txInfo *transactionInfo,
) ([]*tracers.RosettaLogItem, *types.Error) { ) ([]*tracers.RosettaLogItem, *types.Error) {
//cacheKey := blk.Hash().String() + txInfo.tx.Hash().String() cacheKey := blk.Hash().String() + txInfo.tx.Hash().String()
//if value, ok := s.txTraceCache.Get(cacheKey); ok { if value, ok := s.txTraceCache.Get(cacheKey); ok {
// return value.([]*tracers.RosettaLogItem), nil return value.([]*tracers.RosettaLogItem), nil
//} }
lock := &sync.Mutex{} lock := &sync.Mutex{}
if ok, _ := ttLock.ContainsOrAdd(blk.Hash().String(), lock); ok { if ok, _ := ttLock.ContainsOrAdd(blk.Hash().String(), lock); ok {
@ -310,9 +310,9 @@ func (s *BlockAPI) getTransactionTrace(
defer lock.Unlock() defer lock.Unlock()
} }
//if value, ok := s.txTraceCache.Get(cacheKey); ok { if value, ok := s.txTraceCache.Get(cacheKey); ok {
// return value.([]*tracers.RosettaLogItem), nil return value.([]*tracers.RosettaLogItem), nil
//} }
var blockError *types.Error var blockError *types.Error
var foundResult []*tracers.RosettaLogItem var foundResult []*tracers.RosettaLogItem

Loading…
Cancel
Save