This commit is contained in:
Eduard S
2021-02-18 10:24:54 +01:00
parent bb8d81c3aa
commit 5ccea68905
4 changed files with 244 additions and 10 deletions

View File

@@ -275,7 +275,8 @@ func (s *StateDB) GetAccount(idx common.Idx) (*common.Account, error) {
return GetAccountInTreeDB(s.db.DB(), idx)
}
func accountsIter(db db.Storage, fn func(a *common.Account) (bool, error)) error {
// AccountsIter iterates over all the accounts in db, calling fn for each one
func AccountsIter(db db.Storage, fn func(a *common.Account) (bool, error)) error {
idxDB := db.WithPrefix(PrefixKeyIdx)
if err := idxDB.Iterate(func(k []byte, v []byte) (bool, error) {
idx, err := common.IdxFromBytes(k)