dao: drop dropNEP17Cache from Cached

It's not used now.
This commit is contained in:
Roman Khimov 2021-07-29 22:47:33 +03:00
parent 49be753850
commit fa7314ea90

View file

@ -15,15 +15,13 @@ type Cached struct {
DAO DAO
balances map[util.Uint160]*state.NEP17TransferInfo balances map[util.Uint160]*state.NEP17TransferInfo
transfers map[util.Uint160]map[uint32]*state.NEP17TransferLog transfers map[util.Uint160]map[uint32]*state.NEP17TransferLog
dropNEP17Cache bool
} }
// NewCached returns new Cached wrapping around given backing store. // NewCached returns new Cached wrapping around given backing store.
func NewCached(d DAO) *Cached { func NewCached(d DAO) *Cached {
balances := make(map[util.Uint160]*state.NEP17TransferInfo) balances := make(map[util.Uint160]*state.NEP17TransferInfo)
transfers := make(map[util.Uint160]map[uint32]*state.NEP17TransferLog) transfers := make(map[util.Uint160]map[uint32]*state.NEP17TransferLog)
return &Cached{d.GetWrapped(), balances, transfers, false} return &Cached{d.GetWrapped(), balances, transfers}
} }
// GetNEP17TransferInfo retrieves NEP17TransferInfo for the acc. // GetNEP17TransferInfo retrieves NEP17TransferInfo for the acc.
@ -87,9 +85,6 @@ func (cd *Cached) Persist() (int, error) {
// usage scenario it should be good enough if cd doesn't modify object // usage scenario it should be good enough if cd doesn't modify object
// caches (accounts/transfer data) in any way. // caches (accounts/transfer data) in any way.
if ok { if ok {
if cd.dropNEP17Cache {
lowerCache.balances = make(map[util.Uint160]*state.NEP17TransferInfo)
}
var simpleCache *Simple var simpleCache *Simple
for simpleCache == nil { for simpleCache == nil {
simpleCache, ok = lowerCache.DAO.(*Simple) simpleCache, ok = lowerCache.DAO.(*Simple)
@ -127,6 +122,5 @@ func (cd *Cached) GetWrapped() DAO {
return &Cached{cd.DAO.GetWrapped(), return &Cached{cd.DAO.GetWrapped(),
cd.balances, cd.balances,
cd.transfers, cd.transfers,
false,
} }
} }