Use watched addresses from direct indexing params by default while serving statediff APIs #262
@ -483,7 +483,7 @@ func (sds *Service) StateDiffAt(blockNumber uint64, params Params) (*Payload, er
|
|||||||
log.Info("sending state diff", "block height", blockNumber)
|
log.Info("sending state diff", "block height", blockNumber)
|
||||||
|
|
||||||
// use watched addresses from statediffing write loop if not provided
|
// use watched addresses from statediffing write loop if not provided
|
||||||
if params.WatchedAddresses == nil {
|
if params.WatchedAddresses == nil && writeLoopParams.WatchedAddresses != nil {
|
||||||
writeLoopParams.RLock()
|
writeLoopParams.RLock()
|
||||||
params.WatchedAddresses = make([]common.Address, len(writeLoopParams.WatchedAddresses))
|
params.WatchedAddresses = make([]common.Address, len(writeLoopParams.WatchedAddresses))
|
||||||
copy(params.WatchedAddresses, 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)
|
log.Info("sending state diff", "block hash", blockHash)
|
||||||
|
|
||||||
// use watched addresses from statediffing write loop if not provided
|
// use watched addresses from statediffing write loop if not provided
|
||||||
if params.WatchedAddresses == nil {
|
if params.WatchedAddresses == nil && writeLoopParams.WatchedAddresses != nil {
|
||||||
writeLoopParams.RLock()
|
writeLoopParams.RLock()
|
||||||
params.WatchedAddresses = make([]common.Address, len(writeLoopParams.WatchedAddresses))
|
params.WatchedAddresses = make([]common.Address, len(writeLoopParams.WatchedAddresses))
|
||||||
copy(params.WatchedAddresses, 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)
|
log.Info("writing state diff at", "block height", blockNumber)
|
||||||
|
|
||||||
// use watched addresses from statediffing write loop if not provided
|
// use watched addresses from statediffing write loop if not provided
|
||||||
if params.WatchedAddresses == nil {
|
if params.WatchedAddresses == nil && writeLoopParams.WatchedAddresses != nil {
|
||||||
writeLoopParams.RLock()
|
writeLoopParams.RLock()
|
||||||
params.WatchedAddresses = make([]common.Address, len(writeLoopParams.WatchedAddresses))
|
params.WatchedAddresses = make([]common.Address, len(writeLoopParams.WatchedAddresses))
|
||||||
copy(params.WatchedAddresses, 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)
|
log.Info("writing state diff for", "block hash", blockHash)
|
||||||
|
|
||||||
// use watched addresses from statediffing write loop if not provided
|
// use watched addresses from statediffing write loop if not provided
|
||||||
if params.WatchedAddresses == nil {
|
if params.WatchedAddresses == nil && writeLoopParams.WatchedAddresses != nil {
|
||||||
writeLoopParams.RLock()
|
writeLoopParams.RLock()
|
||||||
params.WatchedAddresses = make([]common.Address, len(writeLoopParams.WatchedAddresses))
|
params.WatchedAddresses = make([]common.Address, len(writeLoopParams.WatchedAddresses))
|
||||||
copy(params.WatchedAddresses, writeLoopParams.WatchedAddresses)
|
copy(params.WatchedAddresses, writeLoopParams.WatchedAddresses)
|
||||||
|
Loading…
Reference in New Issue
Block a user