Skip to content

Commit

Permalink
Merge pull request #51 from getamis/develop
Browse files Browse the repository at this point in the history
Release v0.2.4
  • Loading branch information
bailantaotao authored Jul 13, 2018
2 parents d35d5c8 + f516938 commit a940d7b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ import (
"github.com/getamis/sirius/log"
)

const (
emptyEventName = "NA"
)

// IsLatestBlock returns true if blockNumber < 0 and false otherwise.
func IsLatestBlock(blockNumber int64) bool {
return blockNumber < 0
Expand Down Expand Up @@ -163,11 +167,16 @@ func Receipt(b *types.Block, receipt *types.Receipt) (*model.Receipt, error) {
log.Error("Invalid topic length", "hash", receipt.TxHash.Hex(), "len", len(l.Topics))
return nil, ErrInvalidReceiptLog
}

eventName := []byte(emptyEventName)
if len(l.Topics) > 0 {
eventName = l.Topics[0].Bytes()
}
log := &model.Log{
TxHash: r.TxHash,
BlockNumber: r.BlockNumber,
ContractAddress: l.Address.Bytes(),
EventName: l.Topics[0].Bytes(),
EventName: eventName,
Data: l.Data,
}
for i := 1; i < len(l.Topics); i++ {
Expand Down

0 comments on commit a940d7b

Please sign in to comment.