Use watched addresses from direct indexing params by default while serving statediff APIs #262

Merged
prathamesh0 merged 3 commits from pm-default-watchedadddresses into v1.10.19-statediff-v4 2022-07-25 12:40:10 +00:00
Showing only changes of commit 9ce278e4c1 - Show all commits

View File

@ -483,7 +483,7 @@ func (sds *Service) StateDiffAt(blockNumber uint64, params Params) (*Payload, er
log.Info("sending state diff", "block height", blockNumber)
// use watched addresses from statediffing write loop if not provided
if params.WatchedAddresses == nil {
if params.WatchedAddresses == nil && writeLoopParams.WatchedAddresses != nil {
writeLoopParams.RLock()
params.WatchedAddresses = make([]common.Address, len(writeLoopParams.WatchedAddresses))
copy(params.WatchedAddresses, writeLoopParams.WatchedAddresses)
@ -506,7 +506,7 @@ func (sds *Service) StateDiffFor(blockHash common.Hash, params Params) (*Payload
log.Info("sending state diff", "block hash", blockHash)
// use watched addresses from statediffing write loop if not provided
if params.WatchedAddresses == nil {
if params.WatchedAddresses == nil && writeLoopParams.WatchedAddresses != nil {
writeLoopParams.RLock()
params.WatchedAddresses = make([]common.Address, len(writeLoopParams.WatchedAddresses))
copy(params.WatchedAddresses, writeLoopParams.WatchedAddresses)
@ -799,7 +799,7 @@ func (sds *Service) WriteStateDiffAt(blockNumber uint64, params Params) error {
log.Info("writing state diff at", "block height", blockNumber)
// use watched addresses from statediffing write loop if not provided
if params.WatchedAddresses == nil {
if params.WatchedAddresses == nil && writeLoopParams.WatchedAddresses != nil {
writeLoopParams.RLock()
params.WatchedAddresses = make([]common.Address, len(writeLoopParams.WatchedAddresses))
copy(params.WatchedAddresses, writeLoopParams.WatchedAddresses)
@ -824,7 +824,7 @@ func (sds *Service) WriteStateDiffFor(blockHash common.Hash, params Params) erro
log.Info("writing state diff for", "block hash", blockHash)
// use watched addresses from statediffing write loop if not provided
if params.WatchedAddresses == nil {
if params.WatchedAddresses == nil && writeLoopParams.WatchedAddresses != nil {
writeLoopParams.RLock()
params.WatchedAddresses = make([]common.Address, len(writeLoopParams.WatchedAddresses))
copy(params.WatchedAddresses, writeLoopParams.WatchedAddresses)