fix: use global []byte slice to avoid conversions in loop (#595)

Co-authored-by: Muggle-Du <adudu@CNMAC0342.local>
This commit is contained in:
Adu
2021-09-28 08:03:08 +02:00
committed by GitHub
co-authored by Muggle-Du
parent bbb54a6d17
commit fdb92ee788
+3 -1
View File
@@ -67,6 +67,8 @@ type Backend interface {
var _ Backend = (*EVMBackend)(nil)
var bAttributeKeyEthereumBloom = []byte(evmtypes.AttributeKeyEthereumBloom)
// EVMBackend implements the Backend interface
type EVMBackend struct {
ctx context.Context
@@ -205,7 +207,7 @@ func (e *EVMBackend) BlockBloom(height *int64) (ethtypes.Bloom, error) {
}
for _, attr := range event.Attributes {
if bytes.Equal(attr.Key, []byte(evmtypes.AttributeKeyEthereumBloom)) {
if bytes.Equal(attr.Key, bAttributeKeyEthereumBloom) {
return ethtypes.BytesToBloom(attr.Value), nil
}
}