Skip to content

Commit 7a321c8

Browse files
committed
Add external cache usage for full tx retrieval which is used in batchDecorate
1 parent a3d40e1 commit 7a321c8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

stores/utxo/aerospike/get.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,17 @@ func (s *Store) GetTxFromExternalStore(ctx context.Context, previousTxHash chain
13161316
tracing.WithHistogram(prometheusTxMetaAerospikeMapGetExternal),
13171317
)
13181318

1319+
if s.externalTxCache != nil {
1320+
return s.externalTxCache.GetOrSet(previousTxHash, func() (*bt.Tx, bool, error) {
1321+
tx, err := s.getExternalTransaction(ctx, previousTxHash)
1322+
if err != nil {
1323+
return nil, false, err
1324+
}
1325+
1326+
return tx, true, nil
1327+
})
1328+
}
1329+
13191330
return s.getExternalTransaction(ctx, previousTxHash)
13201331
}
13211332

0 commit comments

Comments
 (0)