implement database.StorageSlot()
This commit is contained in:
parent
8754278d18
commit
ede0af3c26
13
database.go
13
database.go
@ -3,9 +3,10 @@ package ipld_eth_statedb
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
|
||||
"github.com/VictoriaMetrics/fastcache"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
@ -103,5 +104,13 @@ func (sd *stateDatabase) StateAccount(address common.Address) (*types.StateAccou
|
||||
}
|
||||
|
||||
func (sd *stateDatabase) StorageSlot(addressHash, slotHash common.Hash) ([]byte, error) {
|
||||
panic("implement me")
|
||||
res := StorageSlotResult{}
|
||||
if err := sd.pgdb.QueryRow(context.Background(), GetStorageSlot, addressHash.Hex(), slotHash.Hex()).Scan(&res); err != nil {
|
||||
return nil, errNotFound
|
||||
}
|
||||
if res.Removed {
|
||||
// TODO: check expected behavior for deleted/non existing accounts
|
||||
return nil, nil
|
||||
}
|
||||
return res.Value, nil
|
||||
}
|
||||
|
4
sql.go
4
sql.go
@ -28,8 +28,8 @@ const (
|
||||
|
||||
// StorageSlotResult struct for unpacking GetStorageSlot result
|
||||
type StorageSlotResult struct {
|
||||
Value string `db:"val"`
|
||||
Removed bool `db:"removed"`
|
||||
Value []byte `db:"val"`
|
||||
Removed bool `db:"removed"`
|
||||
}
|
||||
|
||||
// StateAccountResult struct for unpacking GetStateAccount result
|
||||
|
Loading…
Reference in New Issue
Block a user