@@ -82,7 +82,7 @@ func New(
8282 // For cases where the EVM Gateway is run in an index-mode,
8383 // there is no need to release any keys, since transaction
8484 // submission is not allowed.
85- if ks .size > 0 {
85+ if ! ks .config . IndexOnly {
8686 go ks .processLockedKeys (ctx )
8787 }
8888
@@ -115,6 +115,15 @@ func (k *KeyStore) Take() (*AccountKey, error) {
115115
116116// NotifyTransaction unlocks a key after use and puts it back into the pool.
117117func (k * KeyStore ) NotifyTransaction (txID flowsdk.Identifier ) {
118+ // For cases where the EVM Gateway is run in an index-mode,
119+ // there is no need to release any keys, since transaction
120+ // submission is not allowed. We return early here, to avoid
121+ // any unnecessary steps such as lock acquisition and unlocking
122+ // keys.
123+ if k .config .IndexOnly {
124+ return
125+ }
126+
118127 k .keyMu .Lock ()
119128 defer k .keyMu .Unlock ()
120129
@@ -124,6 +133,16 @@ func (k *KeyStore) NotifyTransaction(txID flowsdk.Identifier) {
124133// NotifyBlock is called to notify the KeyStore of a newly ingested block.
125134// Pending transactions older than a threshold number of blocks are removed.
126135func (k * KeyStore ) NotifyBlock (blockHeader flowsdk.BlockHeader ) {
136+ // For cases where the EVM Gateway is run in an index-mode,
137+ // there is no need to release any keys, since transaction
138+ // submission is not allowed. We return early here, to avoid
139+ // blocking forever on writes to `k.blockChan`, because the
140+ // `k.processLockedKeys()` function won't perform any reads
141+ // from `k.blockChan`.
142+ if k .config .IndexOnly {
143+ return
144+ }
145+
127146 select {
128147 case <- k .done :
129148 k .logger .Warn ().Msg (
0 commit comments