fix: use global []byte slice to avoid conversions in loop (#595)
Co-authored-by: Muggle-Du <adudu@CNMAC0342.local>
This commit is contained in:
parent
bbb54a6d17
commit
fdb92ee788
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user