dao: rename transfers to nep5transfers
This commit is contained in:
parent
e135719c38
commit
49f9c4ad7e
1 changed files with 13 additions and 13 deletions
|
@ -20,7 +20,7 @@ type Cached struct {
|
||||||
contracts map[util.Uint160]*state.Contract
|
contracts map[util.Uint160]*state.Contract
|
||||||
unspents map[util.Uint256]*state.UnspentCoin
|
unspents map[util.Uint256]*state.UnspentCoin
|
||||||
balances map[util.Uint160]*state.NEP5Balances
|
balances map[util.Uint160]*state.NEP5Balances
|
||||||
transfers map[util.Uint160]map[uint32]*state.NEP5TransferLog
|
nep5transfers map[util.Uint160]map[uint32]*state.NEP5TransferLog
|
||||||
storage *itemCache
|
storage *itemCache
|
||||||
|
|
||||||
dropNEP5Cache bool
|
dropNEP5Cache bool
|
||||||
|
@ -32,7 +32,7 @@ func NewCached(d DAO) *Cached {
|
||||||
ctrs := make(map[util.Uint160]*state.Contract)
|
ctrs := make(map[util.Uint160]*state.Contract)
|
||||||
unspents := make(map[util.Uint256]*state.UnspentCoin)
|
unspents := make(map[util.Uint256]*state.UnspentCoin)
|
||||||
balances := make(map[util.Uint160]*state.NEP5Balances)
|
balances := make(map[util.Uint160]*state.NEP5Balances)
|
||||||
transfers := make(map[util.Uint160]map[uint32]*state.NEP5TransferLog)
|
nep5transfers := make(map[util.Uint160]map[uint32]*state.NEP5TransferLog)
|
||||||
st := newItemCache()
|
st := newItemCache()
|
||||||
dao := d.GetWrapped()
|
dao := d.GetWrapped()
|
||||||
if cd, ok := dao.(*Cached); ok {
|
if cd, ok := dao.(*Cached); ok {
|
||||||
|
@ -42,7 +42,7 @@ func NewCached(d DAO) *Cached {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &Cached{dao, accs, ctrs, unspents, balances, transfers, st, false}
|
return &Cached{dao, accs, ctrs, unspents, balances, nep5transfers, st, false}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAccountStateOrNew retrieves Account from cache or underlying store
|
// GetAccountStateOrNew retrieves Account from cache or underlying store
|
||||||
|
@ -122,7 +122,7 @@ func (cd *Cached) PutNEP5Balances(acc util.Uint160, bs *state.NEP5Balances) erro
|
||||||
|
|
||||||
// GetNEP5TransferLog retrieves NEP5TransferLog for the acc.
|
// GetNEP5TransferLog retrieves NEP5TransferLog for the acc.
|
||||||
func (cd *Cached) GetNEP5TransferLog(acc util.Uint160, index uint32) (*state.NEP5TransferLog, error) {
|
func (cd *Cached) GetNEP5TransferLog(acc util.Uint160, index uint32) (*state.NEP5TransferLog, error) {
|
||||||
ts := cd.transfers[acc]
|
ts := cd.nep5transfers[acc]
|
||||||
if ts != nil && ts[index] != nil {
|
if ts != nil && ts[index] != nil {
|
||||||
return ts[index], nil
|
return ts[index], nil
|
||||||
}
|
}
|
||||||
|
@ -131,10 +131,10 @@ func (cd *Cached) GetNEP5TransferLog(acc util.Uint160, index uint32) (*state.NEP
|
||||||
|
|
||||||
// PutNEP5TransferLog saves NEP5TransferLog for the acc.
|
// PutNEP5TransferLog saves NEP5TransferLog for the acc.
|
||||||
func (cd *Cached) PutNEP5TransferLog(acc util.Uint160, index uint32, bs *state.NEP5TransferLog) error {
|
func (cd *Cached) PutNEP5TransferLog(acc util.Uint160, index uint32, bs *state.NEP5TransferLog) error {
|
||||||
ts := cd.transfers[acc]
|
ts := cd.nep5transfers[acc]
|
||||||
if ts == nil {
|
if ts == nil {
|
||||||
ts = make(map[uint32]*state.NEP5TransferLog, 2)
|
ts = make(map[uint32]*state.NEP5TransferLog, 2)
|
||||||
cd.transfers[acc] = ts
|
cd.nep5transfers[acc] = ts
|
||||||
}
|
}
|
||||||
ts[index] = bs
|
ts[index] = bs
|
||||||
return nil
|
return nil
|
||||||
|
@ -265,7 +265,7 @@ func (cd *Cached) Persist() (int, error) {
|
||||||
}
|
}
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
}
|
}
|
||||||
for acc, ts := range cd.transfers {
|
for acc, ts := range cd.nep5transfers {
|
||||||
for ind, lg := range ts {
|
for ind, lg := range ts {
|
||||||
err := cd.DAO.PutNEP5TransferLog(acc, ind, lg)
|
err := cd.DAO.PutNEP5TransferLog(acc, ind, lg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -283,7 +283,7 @@ func (cd *Cached) GetWrapped() DAO {
|
||||||
cd.contracts,
|
cd.contracts,
|
||||||
cd.unspents,
|
cd.unspents,
|
||||||
cd.balances,
|
cd.balances,
|
||||||
cd.transfers,
|
cd.nep5transfers,
|
||||||
cd.storage,
|
cd.storage,
|
||||||
false,
|
false,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue