2015-07-07 02:54:22 +02:00
|
|
|
// Copyright 2015 The go-ethereum Authors
|
2015-07-22 18:48:40 +02:00
|
|
|
// This file is part of the go-ethereum library.
|
2015-07-07 02:54:22 +02:00
|
|
|
//
|
2015-07-23 18:35:11 +02:00
|
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
2015-07-07 02:54:22 +02:00
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
2015-07-22 18:48:40 +02:00
|
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
2015-07-07 02:54:22 +02:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-07-22 18:48:40 +02:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2015-07-07 02:54:22 +02:00
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
2015-07-22 18:48:40 +02:00
|
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
2015-07-07 02:54:22 +02:00
|
|
|
|
2015-02-28 20:52:10 +01:00
|
|
|
package trie
|
|
|
|
|
2015-07-06 01:19:48 +02:00
|
|
|
import (
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
2021-09-28 10:48:07 +02:00
|
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
|
|
"github.com/ethereum/go-ethereum/rlp"
|
2023-05-09 15:11:04 +08:00
|
|
|
"github.com/ethereum/go-ethereum/trie/trienode"
|
2024-02-13 21:49:53 +08:00
|
|
|
"github.com/ethereum/go-ethereum/triedb/database"
|
2015-07-06 01:19:48 +02:00
|
|
|
)
|
2015-03-24 15:14:03 +01:00
|
|
|
|
2022-08-04 16:13:18 +02:00
|
|
|
// SecureTrie is the old name of StateTrie.
|
|
|
|
// Deprecated: use StateTrie.
|
|
|
|
type SecureTrie = StateTrie
|
|
|
|
|
|
|
|
// NewSecure creates a new StateTrie.
|
|
|
|
// Deprecated: use NewStateTrie.
|
2024-02-13 21:49:53 +08:00
|
|
|
func NewSecure(stateRoot common.Hash, owner common.Hash, root common.Hash, db database.Database) (*SecureTrie, error) {
|
cmd, core, eth, les, light: track deleted nodes (#25757)
* cmd, core, eth, les, light: track deleted nodes
* trie: add docs
* trie: address comments
* cmd, core, eth, les, light, trie: trie id
* trie: add tests
* trie, core: updates
* trie: fix imports
* trie: add utility print-method for nodeset
* trie: import err
* trie: fix go vet warnings
Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-09-27 16:01:02 +08:00
|
|
|
id := &ID{
|
|
|
|
StateRoot: stateRoot,
|
|
|
|
Owner: owner,
|
|
|
|
Root: root,
|
|
|
|
}
|
|
|
|
return NewStateTrie(id, db)
|
2022-08-04 16:13:18 +02:00
|
|
|
}
|
|
|
|
|
2022-09-01 00:18:18 +08:00
|
|
|
// StateTrie wraps a trie with key hashing. In a stateTrie trie, all
|
2015-07-06 01:19:48 +02:00
|
|
|
// access operations hash the key using keccak256. This prevents
|
|
|
|
// calling code from creating long chains of nodes that
|
|
|
|
// increase the access time.
|
|
|
|
//
|
2022-08-04 16:13:18 +02:00
|
|
|
// Contrary to a regular trie, a StateTrie can only be created with
|
2015-07-06 01:19:48 +02:00
|
|
|
// New and must have an attached database. The database also stores
|
2022-09-01 00:18:18 +08:00
|
|
|
// the preimage of each key if preimage recording is enabled.
|
2015-07-06 01:19:48 +02:00
|
|
|
//
|
2022-08-04 16:13:18 +02:00
|
|
|
// StateTrie is not safe for concurrent use.
|
|
|
|
type StateTrie struct {
|
2016-09-27 13:13:13 +03:00
|
|
|
trie Trie
|
2024-02-13 21:49:53 +08:00
|
|
|
db database.Database
|
2023-09-08 16:36:16 +08:00
|
|
|
hashKeyBuf [common.HashLength]byte //nolint:unused
|
2016-09-27 13:13:13 +03:00
|
|
|
secKeyCache map[string][]byte
|
2022-08-04 16:13:18 +02:00
|
|
|
secKeyCacheOwner *StateTrie // Pointer to self, replace the key cache on mismatch
|
2015-02-28 20:52:10 +01:00
|
|
|
}
|
|
|
|
|
2022-09-01 00:18:18 +08:00
|
|
|
// NewStateTrie creates a trie with an existing root node from a backing database.
|
2015-07-06 01:19:48 +02:00
|
|
|
//
|
|
|
|
// If root is the zero hash or the sha3 hash of an empty string, the
|
2015-11-25 18:28:21 +01:00
|
|
|
// trie is initially empty. Otherwise, New will panic if db is nil
|
|
|
|
// and returns MissingNodeError if the root node cannot be found.
|
2024-02-13 21:49:53 +08:00
|
|
|
func NewStateTrie(id *ID, db database.Database) (*StateTrie, error) {
|
2015-07-06 01:19:48 +02:00
|
|
|
if db == nil {
|
2022-09-03 00:48:26 +09:00
|
|
|
panic("trie.NewStateTrie called without a database")
|
2015-07-06 01:19:48 +02:00
|
|
|
}
|
cmd, core, eth, les, light: track deleted nodes (#25757)
* cmd, core, eth, les, light: track deleted nodes
* trie: add docs
* trie: address comments
* cmd, core, eth, les, light, trie: trie id
* trie: add tests
* trie, core: updates
* trie: fix imports
* trie: add utility print-method for nodeset
* trie: import err
* trie: fix go vet warnings
Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-09-27 16:01:02 +08:00
|
|
|
trie, err := New(id, db)
|
2015-07-06 01:19:48 +02:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2024-02-13 21:49:53 +08:00
|
|
|
return &StateTrie{trie: *trie, db: db}, nil
|
2015-02-28 20:52:10 +01:00
|
|
|
}
|
|
|
|
|
2023-04-20 18:57:24 +08:00
|
|
|
// MustGet returns the value for key stored in the trie.
|
2015-07-06 01:19:48 +02:00
|
|
|
// The value bytes must not be modified by the caller.
|
2023-04-20 18:57:24 +08:00
|
|
|
//
|
|
|
|
// This function will omit any encountered error but just
|
|
|
|
// print out an error message.
|
|
|
|
func (t *StateTrie) MustGet(key []byte) []byte {
|
|
|
|
return t.trie.MustGet(t.hashKey(key))
|
2015-11-25 18:28:21 +01:00
|
|
|
}
|
|
|
|
|
2023-03-27 10:48:46 +02:00
|
|
|
// GetStorage attempts to retrieve a storage slot with provided account address
|
|
|
|
// and slot key. The value bytes must not be modified by the caller.
|
|
|
|
// If the specified storage slot is not in the trie, nil will be returned.
|
2022-09-01 00:18:18 +08:00
|
|
|
// If a trie node is not found in the database, a MissingNodeError is returned.
|
2023-03-27 10:48:46 +02:00
|
|
|
func (t *StateTrie) GetStorage(_ common.Address, key []byte) ([]byte, error) {
|
2023-06-01 10:29:41 +02:00
|
|
|
enc, err := t.trie.Get(t.hashKey(key))
|
|
|
|
if err != nil || len(enc) == 0 {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
_, content, _, err := rlp.Split(enc)
|
|
|
|
return content, err
|
2015-02-28 20:52:10 +01:00
|
|
|
}
|
2015-07-06 01:19:48 +02:00
|
|
|
|
2023-03-27 10:48:46 +02:00
|
|
|
// GetAccount attempts to retrieve an account with provided account address.
|
2022-09-01 00:18:18 +08:00
|
|
|
// If the specified account is not in the trie, nil will be returned.
|
|
|
|
// If a trie node is not found in the database, a MissingNodeError is returned.
|
2023-03-27 10:48:46 +02:00
|
|
|
func (t *StateTrie) GetAccount(address common.Address) (*types.StateAccount, error) {
|
2023-04-20 18:57:24 +08:00
|
|
|
res, err := t.trie.Get(t.hashKey(address.Bytes()))
|
2022-09-01 00:18:18 +08:00
|
|
|
if res == nil || err != nil {
|
|
|
|
return nil, err
|
2022-08-04 16:13:18 +02:00
|
|
|
}
|
2022-09-01 00:18:18 +08:00
|
|
|
ret := new(types.StateAccount)
|
|
|
|
err = rlp.DecodeBytes(res, ret)
|
|
|
|
return ret, err
|
2020-08-28 10:50:37 +03:00
|
|
|
}
|
|
|
|
|
2023-03-27 10:48:46 +02:00
|
|
|
// GetAccountByHash does the same thing as GetAccount, however it expects an
|
|
|
|
// account hash that is the hash of address. This constitutes an abstraction
|
|
|
|
// leak, since the client code needs to know the key format.
|
|
|
|
func (t *StateTrie) GetAccountByHash(addrHash common.Hash) (*types.StateAccount, error) {
|
2023-04-20 18:57:24 +08:00
|
|
|
res, err := t.trie.Get(addrHash.Bytes())
|
2022-09-01 00:18:18 +08:00
|
|
|
if res == nil || err != nil {
|
|
|
|
return nil, err
|
2021-09-28 10:48:07 +02:00
|
|
|
}
|
2022-09-01 00:18:18 +08:00
|
|
|
ret := new(types.StateAccount)
|
|
|
|
err = rlp.DecodeBytes(res, ret)
|
|
|
|
return ret, err
|
2022-08-04 16:13:18 +02:00
|
|
|
}
|
|
|
|
|
2023-03-27 10:48:46 +02:00
|
|
|
// GetNode attempts to retrieve a trie node by compact-encoded path. It is not
|
2020-08-28 10:50:37 +03:00
|
|
|
// possible to use keybyte-encoding as the path might contain odd nibbles.
|
2022-09-01 00:18:18 +08:00
|
|
|
// If the specified trie node is not in the trie, nil will be returned.
|
|
|
|
// If a trie node is not found in the database, a MissingNodeError is returned.
|
2023-03-27 10:48:46 +02:00
|
|
|
func (t *StateTrie) GetNode(path []byte) ([]byte, int, error) {
|
2023-04-20 18:57:24 +08:00
|
|
|
return t.trie.GetNode(path)
|
2021-09-28 10:48:07 +02:00
|
|
|
}
|
|
|
|
|
2023-04-20 18:57:24 +08:00
|
|
|
// MustUpdate associates key with value in the trie. Subsequent calls to
|
2015-07-06 01:19:48 +02:00
|
|
|
// Get will return value. If value has length zero, any existing value
|
|
|
|
// is deleted from the trie and calls to Get will return nil.
|
|
|
|
//
|
|
|
|
// The value bytes must not be modified by the caller while they are
|
|
|
|
// stored in the trie.
|
2023-04-20 18:57:24 +08:00
|
|
|
//
|
|
|
|
// This function will omit any encountered error but just print out an
|
|
|
|
// error message.
|
|
|
|
func (t *StateTrie) MustUpdate(key, value []byte) {
|
|
|
|
hk := t.hashKey(key)
|
|
|
|
t.trie.MustUpdate(hk, value)
|
|
|
|
t.getSecKeyCache()[string(hk)] = common.CopyBytes(key)
|
2015-11-25 18:28:21 +01:00
|
|
|
}
|
|
|
|
|
2023-03-27 10:48:46 +02:00
|
|
|
// UpdateStorage associates key with value in the trie. Subsequent calls to
|
2015-11-25 18:28:21 +01:00
|
|
|
// Get will return value. If value has length zero, any existing value
|
|
|
|
// is deleted from the trie and calls to Get will return nil.
|
|
|
|
//
|
|
|
|
// The value bytes must not be modified by the caller while they are
|
|
|
|
// stored in the trie.
|
|
|
|
//
|
2022-09-01 00:18:18 +08:00
|
|
|
// If a node is not found in the database, a MissingNodeError is returned.
|
2023-03-27 10:48:46 +02:00
|
|
|
func (t *StateTrie) UpdateStorage(_ common.Address, key, value []byte) error {
|
2015-07-06 01:19:48 +02:00
|
|
|
hk := t.hashKey(key)
|
2023-06-01 10:29:41 +02:00
|
|
|
v, _ := rlp.EncodeToBytes(value)
|
|
|
|
err := t.trie.Update(hk, v)
|
2015-11-25 18:28:21 +01:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2016-09-27 13:13:13 +03:00
|
|
|
t.getSecKeyCache()[string(hk)] = common.CopyBytes(key)
|
2015-11-25 18:28:21 +01:00
|
|
|
return nil
|
2015-02-28 20:52:10 +01:00
|
|
|
}
|
|
|
|
|
2023-03-27 10:48:46 +02:00
|
|
|
// UpdateAccount will abstract the write of an account to the secure trie.
|
|
|
|
func (t *StateTrie) UpdateAccount(address common.Address, acc *types.StateAccount) error {
|
2023-01-03 21:41:40 +08:00
|
|
|
hk := t.hashKey(address.Bytes())
|
2022-09-01 00:18:18 +08:00
|
|
|
data, err := rlp.EncodeToBytes(acc)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
2015-11-25 18:28:21 +01:00
|
|
|
}
|
2023-04-20 18:57:24 +08:00
|
|
|
if err := t.trie.Update(hk, data); err != nil {
|
2022-09-01 00:18:18 +08:00
|
|
|
return err
|
|
|
|
}
|
2023-01-03 21:41:40 +08:00
|
|
|
t.getSecKeyCache()[string(hk)] = address.Bytes()
|
2022-09-01 00:18:18 +08:00
|
|
|
return nil
|
2015-11-25 18:28:21 +01:00
|
|
|
}
|
|
|
|
|
2023-06-22 14:52:52 +02:00
|
|
|
func (t *StateTrie) UpdateContractCode(_ common.Address, _ common.Hash, _ []byte) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-04-20 18:57:24 +08:00
|
|
|
// MustDelete removes any existing value for key from the trie. This function
|
|
|
|
// will omit any encountered error but just print out an error message.
|
|
|
|
func (t *StateTrie) MustDelete(key []byte) {
|
2016-01-20 16:06:28 +02:00
|
|
|
hk := t.hashKey(key)
|
2016-09-27 13:13:13 +03:00
|
|
|
delete(t.getSecKeyCache(), string(hk))
|
2023-04-20 18:57:24 +08:00
|
|
|
t.trie.MustDelete(hk)
|
2015-11-25 18:28:21 +01:00
|
|
|
}
|
|
|
|
|
2023-03-27 10:48:46 +02:00
|
|
|
// DeleteStorage removes any existing storage slot from the trie.
|
2022-09-01 00:18:18 +08:00
|
|
|
// If the specified trie node is not in the trie, nothing will be changed.
|
|
|
|
// If a node is not found in the database, a MissingNodeError is returned.
|
2023-03-27 10:48:46 +02:00
|
|
|
func (t *StateTrie) DeleteStorage(_ common.Address, key []byte) error {
|
2016-01-20 16:06:28 +02:00
|
|
|
hk := t.hashKey(key)
|
2016-09-27 13:13:13 +03:00
|
|
|
delete(t.getSecKeyCache(), string(hk))
|
2023-04-20 18:57:24 +08:00
|
|
|
return t.trie.Delete(hk)
|
2015-02-28 20:52:10 +01:00
|
|
|
}
|
2015-07-06 01:19:48 +02:00
|
|
|
|
2023-03-27 10:48:46 +02:00
|
|
|
// DeleteAccount abstracts an account deletion from the trie.
|
|
|
|
func (t *StateTrie) DeleteAccount(address common.Address) error {
|
2023-01-03 21:41:40 +08:00
|
|
|
hk := t.hashKey(address.Bytes())
|
2022-08-17 13:14:49 +02:00
|
|
|
delete(t.getSecKeyCache(), string(hk))
|
2023-04-20 18:57:24 +08:00
|
|
|
return t.trie.Delete(hk)
|
2015-02-28 20:52:10 +01:00
|
|
|
}
|
2015-07-06 01:19:48 +02:00
|
|
|
|
|
|
|
// GetKey returns the sha3 preimage of a hashed key that was
|
|
|
|
// previously used to store a value.
|
2022-08-04 16:13:18 +02:00
|
|
|
func (t *StateTrie) GetKey(shaKey []byte) []byte {
|
2016-09-27 13:13:13 +03:00
|
|
|
if key, ok := t.getSecKeyCache()[string(shaKey)]; ok {
|
2016-01-20 12:09:24 +02:00
|
|
|
return key
|
|
|
|
}
|
2024-02-13 21:49:53 +08:00
|
|
|
return t.db.Preimage(common.BytesToHash(shaKey))
|
2015-02-28 20:52:10 +01:00
|
|
|
}
|
2015-03-03 12:25:44 +01:00
|
|
|
|
2022-09-08 03:36:07 -07:00
|
|
|
// Commit collects all dirty nodes in the trie and replaces them with the
|
|
|
|
// corresponding node hash. All collected nodes (including dirty leaves if
|
2022-08-04 16:03:20 +08:00
|
|
|
// collectLeaf is true) will be encapsulated into a nodeset for return.
|
2022-09-08 03:36:07 -07:00
|
|
|
// The returned nodeset can be nil if the trie is clean (nothing to commit).
|
2022-08-04 16:03:20 +08:00
|
|
|
// All cached preimages will be also flushed if preimages recording is enabled.
|
|
|
|
// Once the trie is committed, it's not usable anymore. A new trie must
|
|
|
|
// be created with new root and updated trie database for following usage
|
2023-06-27 14:36:38 +02:00
|
|
|
func (t *StateTrie) Commit(collectLeaf bool) (common.Hash, *trienode.NodeSet, error) {
|
2018-02-05 18:40:32 +02:00
|
|
|
// Write all the pre-images to the actual disk database
|
|
|
|
if len(t.getSecKeyCache()) > 0 {
|
2024-02-13 21:49:53 +08:00
|
|
|
preimages := make(map[common.Hash][]byte)
|
|
|
|
for hk, key := range t.secKeyCache {
|
|
|
|
preimages[common.BytesToHash([]byte(hk))] = key
|
2018-02-05 18:40:32 +02:00
|
|
|
}
|
2024-02-13 21:49:53 +08:00
|
|
|
t.db.InsertPreimage(preimages)
|
2018-02-05 18:40:32 +02:00
|
|
|
t.secKeyCache = make(map[string][]byte)
|
|
|
|
}
|
2022-09-08 03:36:07 -07:00
|
|
|
// Commit the trie and return its modified nodeset.
|
2022-08-04 16:03:20 +08:00
|
|
|
return t.trie.Commit(collectLeaf)
|
2016-09-25 20:49:02 +02:00
|
|
|
}
|
|
|
|
|
2022-08-04 16:13:18 +02:00
|
|
|
// Hash returns the root hash of StateTrie. It does not write to the
|
2018-05-21 13:41:31 -07:00
|
|
|
// database and can be used even if the trie doesn't have one.
|
2022-08-04 16:13:18 +02:00
|
|
|
func (t *StateTrie) Hash() common.Hash {
|
2016-09-25 20:49:02 +02:00
|
|
|
return t.trie.Hash()
|
|
|
|
}
|
|
|
|
|
2022-08-04 16:13:18 +02:00
|
|
|
// Copy returns a copy of StateTrie.
|
|
|
|
func (t *StateTrie) Copy() *StateTrie {
|
|
|
|
return &StateTrie{
|
2022-03-31 15:28:32 +08:00
|
|
|
trie: *t.trie.Copy(),
|
2024-02-13 21:49:53 +08:00
|
|
|
db: t.db,
|
2022-03-31 15:28:32 +08:00
|
|
|
secKeyCache: t.secKeyCache,
|
|
|
|
}
|
2017-06-27 15:57:06 +02:00
|
|
|
}
|
|
|
|
|
2022-07-05 11:14:21 +08:00
|
|
|
func (t *SecureTrie) ResetCopy() *SecureTrie {
|
|
|
|
cpy := *t
|
|
|
|
cpy.secKeyCacheOwner = nil
|
|
|
|
cpy.secKeyCache = nil
|
|
|
|
return &cpy
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *SecureTrie) GetRawTrie() Trie {
|
|
|
|
return t.trie
|
|
|
|
}
|
|
|
|
|
cmd, core/state, eth, tests, trie: improve state reader (#27428)
The state availability is checked during the creation of a state reader.
- In hash-based database, if the specified root node does not exist on disk disk, then
the state reader won't be created and an error will be returned.
- In path-based database, if the specified state layer is not available, then the
state reader won't be created and an error will be returned.
This change also contains a stricter semantics regarding the `Commit` operation: once it has been performed, the trie is no longer usable, and certain operations will return an error.
2023-06-21 03:31:45 +08:00
|
|
|
// NodeIterator returns an iterator that returns nodes of the underlying trie.
|
|
|
|
// Iteration starts at the key after the given start key.
|
|
|
|
func (t *StateTrie) NodeIterator(start []byte) (NodeIterator, error) {
|
2017-04-13 14:41:24 +02:00
|
|
|
return t.trie.NodeIterator(start)
|
2016-01-20 12:09:24 +02:00
|
|
|
}
|
|
|
|
|
cmd, core/state, eth, tests, trie: improve state reader (#27428)
The state availability is checked during the creation of a state reader.
- In hash-based database, if the specified root node does not exist on disk disk, then
the state reader won't be created and an error will be returned.
- In path-based database, if the specified state layer is not available, then the
state reader won't be created and an error will be returned.
This change also contains a stricter semantics regarding the `Commit` operation: once it has been performed, the trie is no longer usable, and certain operations will return an error.
2023-06-21 03:31:45 +08:00
|
|
|
// MustNodeIterator is a wrapper of NodeIterator and will omit any encountered
|
|
|
|
// error but just print out an error message.
|
|
|
|
func (t *StateTrie) MustNodeIterator(start []byte) NodeIterator {
|
|
|
|
return t.trie.MustNodeIterator(start)
|
|
|
|
}
|
|
|
|
|
2016-09-25 20:49:02 +02:00
|
|
|
// hashKey returns the hash of key as an ephemeral buffer.
|
|
|
|
// The caller must not hold onto the return value because it will become
|
|
|
|
// invalid on the next call to hashKey or secKey.
|
2023-09-08 16:36:16 +08:00
|
|
|
//
|
|
|
|
// no use hashKeyBuf for thread safe.
|
2022-08-04 16:13:18 +02:00
|
|
|
func (t *StateTrie) hashKey(key []byte) []byte {
|
2022-07-05 11:14:21 +08:00
|
|
|
hash := make([]byte, common.HashLength)
|
2020-02-04 13:02:38 +01:00
|
|
|
h := newHasher(false)
|
2018-01-15 15:32:14 +02:00
|
|
|
h.sha.Reset()
|
|
|
|
h.sha.Write(key)
|
2022-07-05 11:14:21 +08:00
|
|
|
h.sha.Read(hash)
|
2018-01-15 15:32:14 +02:00
|
|
|
returnHasherToPool(h)
|
2022-07-05 11:14:21 +08:00
|
|
|
return hash
|
2015-03-24 15:14:03 +01:00
|
|
|
}
|
2016-09-27 13:13:13 +03:00
|
|
|
|
|
|
|
// getSecKeyCache returns the current secure key cache, creating a new one if
|
|
|
|
// ownership changed (i.e. the current secure trie is a copy of another owning
|
|
|
|
// the actual cache).
|
2022-08-04 16:13:18 +02:00
|
|
|
func (t *StateTrie) getSecKeyCache() map[string][]byte {
|
2016-09-27 13:13:13 +03:00
|
|
|
if t != t.secKeyCacheOwner {
|
|
|
|
t.secKeyCacheOwner = t
|
|
|
|
t.secKeyCache = make(map[string][]byte)
|
|
|
|
}
|
|
|
|
return t.secKeyCache
|
|
|
|
}
|