Fixes for tx logs master (#2064)

* Fixes for tx logs

* Remove interface

* Missed empty method

Co-authored-by: Rongjian Lan <rongjian@harmony.one>
pull/2097/head
flicker-harmony 5 years ago committed by Rongjian Lan
parent df9f7b8bdd
commit 124358f2c1
  1. 18
      hmy/api_backend.go

@ -138,14 +138,24 @@ func (b *APIBackend) ProtocolVersion() int {
// GetLogs ...
func (b *APIBackend) GetLogs(ctx context.Context, blockHash common.Hash) ([][]*types.Log, error) {
// TODO(ricl): implement
return nil, nil
receipts := b.hmy.blockchain.GetReceiptsByHash(blockHash)
if receipts == nil {
return nil, errors.New("Missing receipts")
}
logs := make([][]*types.Log, len(receipts))
for i, receipt := range receipts {
logs[i] = receipt.Logs
}
return logs, nil
}
// HeaderByHash ...
func (b *APIBackend) HeaderByHash(ctx context.Context, blockHash common.Hash) (*block.Header, error) {
// TODO(ricl): implement
return nil, nil
header := b.hmy.blockchain.GetHeaderByHash(blockHash)
if header == nil {
return nil, errors.New("Header is not found")
}
return header, nil
}
// ServiceFilter ...

Loading…
Cancel
Save