@@ -10,6 +10,8 @@ import (
1010 "github.com/onflow/flow-go-sdk/access"
1111 "github.com/onflow/flow-go/model/flow"
1212 "github.com/rs/zerolog"
13+ "google.golang.org/grpc/codes"
14+ "google.golang.org/grpc/status"
1315)
1416
1517var ErrNoKeysAvailable = fmt .Errorf ("no signing keys available" )
@@ -69,7 +71,7 @@ func New(
6971 // `KeyStore.NotifyBlock` is called for each new Flow block,
7072 // so we use a buffered channel to write the new block headers
7173 // to the `blockChan`, and read them through `processLockedKeys`.
72- blockChan : make (chan flowsdk.BlockHeader , 100 ),
74+ blockChan : make (chan flowsdk.BlockHeader , 200 ),
7375 logger : logger ,
7476 done : make (chan struct {}),
7577 }
@@ -153,6 +155,12 @@ func (k *KeyStore) NotifyBlock(blockHeader flowsdk.BlockHeader) {
153155 "received `NotifyBlock` for block with ID: %s" ,
154156 blockHeader .ID ,
155157 )
158+ default :
159+ // In this case, we only release the account keys which were last
160+ // locked more than or equal to `accountKeyBlockExpiration` blocks
161+ // in the past, in order to avoid slowing down the EVM event
162+ // ingestion engine.
163+ k .releasekeys (blockHeader .Height , nil )
156164 }
157165}
158166
@@ -198,11 +206,11 @@ func (k *KeyStore) processLockedKeys(ctx context.Context) {
198206 continue
199207 }
200208
201- txResults := []* flowsdk.TransactionResult {}
209+ var txResults []* flowsdk.TransactionResult
202210 var err error
203211 if k .config .COATxLookupEnabled {
204212 txResults , err = k .client .GetTransactionResultsByBlockID (ctx , blockHeader .ID )
205- if err != nil {
213+ if err != nil && status . Code ( err ) != codes . Canceled {
206214 k .logger .Error ().Err (err ).Msgf (
207215 "failed to get transaction results for block ID: %s" ,
208216 blockHeader .ID .Hex (),
0 commit comments