mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
remove not used addr parameter
This commit is contained in:
parent
063033834b
commit
01eba515f9
2 changed files with 10 additions and 30 deletions
|
|
@ -41,14 +41,14 @@ type ContractCodeReader interface {
|
||||||
// - Returns nil code along with nil error if the requested contract code
|
// - Returns nil code along with nil error if the requested contract code
|
||||||
// doesn't exist
|
// doesn't exist
|
||||||
// - Returns an error only if an unexpected issue occurs
|
// - Returns an error only if an unexpected issue occurs
|
||||||
Code(addr common.Address, codeHash common.Hash) ([]byte, error)
|
Code(codeHash common.Hash) ([]byte, error)
|
||||||
|
|
||||||
// CodeSize retrieves a particular contracts code's size.
|
// CodeSize retrieves a particular contracts code's size.
|
||||||
//
|
//
|
||||||
// - Returns zero code size along with nil error if the requested contract code
|
// - Returns zero code size along with nil error if the requested contract code
|
||||||
// doesn't exist
|
// doesn't exist
|
||||||
// - Returns an error only if an unexpected issue occurs
|
// - Returns an error only if an unexpected issue occurs
|
||||||
CodeSize(addr common.Address, codeHash common.Hash) (int, error)
|
CodeSize(codeHash common.Hash) (int, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// StateReader defines the interface for accessing accounts and storage slots
|
// StateReader defines the interface for accessing accounts and storage slots
|
||||||
|
|
@ -121,7 +121,7 @@ func newCachingCodeReader(db ethdb.KeyValueReader, codeCache *lru.SizeConstraine
|
||||||
|
|
||||||
// Code implements ContractCodeReader, retrieving a particular contract's code.
|
// Code implements ContractCodeReader, retrieving a particular contract's code.
|
||||||
// If the contract code doesn't exist, no error will be returned.
|
// If the contract code doesn't exist, no error will be returned.
|
||||||
func (r *cachingCodeReader) Code(addr common.Address, codeHash common.Hash) ([]byte, error) {
|
func (r *cachingCodeReader) Code(codeHash common.Hash) ([]byte, error) {
|
||||||
code, _ := r.codeCache.Get(codeHash)
|
code, _ := r.codeCache.Get(codeHash)
|
||||||
if len(code) > 0 {
|
if len(code) > 0 {
|
||||||
return code, nil
|
return code, nil
|
||||||
|
|
@ -136,11 +136,11 @@ func (r *cachingCodeReader) Code(addr common.Address, codeHash common.Hash) ([]b
|
||||||
|
|
||||||
// CodeSize implements ContractCodeReader, retrieving a particular contracts code's size.
|
// CodeSize implements ContractCodeReader, retrieving a particular contracts code's size.
|
||||||
// If the contract code doesn't exist, no error will be returned.
|
// If the contract code doesn't exist, no error will be returned.
|
||||||
func (r *cachingCodeReader) CodeSize(addr common.Address, codeHash common.Hash) (int, error) {
|
func (r *cachingCodeReader) CodeSize(codeHash common.Hash) (int, error) {
|
||||||
if cached, ok := r.codeSizeCache.Get(codeHash); ok {
|
if cached, ok := r.codeSizeCache.Get(codeHash); ok {
|
||||||
return cached, nil
|
return cached, nil
|
||||||
}
|
}
|
||||||
code, err := r.Code(addr, codeHash)
|
code, err := r.Code(codeHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -423,19 +423,12 @@ func (s *StateDB) HasSelfDestructed(addr common.Address) bool {
|
||||||
|
|
||||||
// AddBalance adds amount to the account associated with addr.
|
// AddBalance adds amount to the account associated with addr.
|
||||||
func (s *StateDB) AddBalance(addr common.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) uint256.Int {
|
func (s *StateDB) AddBalance(addr common.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) uint256.Int {
|
||||||
stateObject := s.getOrNewStateObject(addr)
|
return s.getOrNewStateObject(addr).AddBalance(amount)
|
||||||
if stateObject == nil {
|
|
||||||
return uint256.Int{}
|
|
||||||
}
|
|
||||||
return stateObject.AddBalance(amount)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SubBalance subtracts amount from the account associated with addr.
|
// SubBalance subtracts amount from the account associated with addr.
|
||||||
func (s *StateDB) SubBalance(addr common.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) uint256.Int {
|
func (s *StateDB) SubBalance(addr common.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) uint256.Int {
|
||||||
stateObject := s.getOrNewStateObject(addr)
|
stateObject := s.getOrNewStateObject(addr)
|
||||||
if stateObject == nil {
|
|
||||||
return uint256.Int{}
|
|
||||||
}
|
|
||||||
if amount.IsZero() {
|
if amount.IsZero() {
|
||||||
return *(stateObject.Balance())
|
return *(stateObject.Balance())
|
||||||
}
|
}
|
||||||
|
|
@ -443,32 +436,19 @@ func (s *StateDB) SubBalance(addr common.Address, amount *uint256.Int, reason tr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StateDB) SetBalance(addr common.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) {
|
func (s *StateDB) SetBalance(addr common.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) {
|
||||||
stateObject := s.getOrNewStateObject(addr)
|
s.getOrNewStateObject(addr).SetBalance(amount)
|
||||||
if stateObject != nil {
|
|
||||||
stateObject.SetBalance(amount)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StateDB) SetNonce(addr common.Address, nonce uint64, reason tracing.NonceChangeReason) {
|
func (s *StateDB) SetNonce(addr common.Address, nonce uint64, reason tracing.NonceChangeReason) {
|
||||||
stateObject := s.getOrNewStateObject(addr)
|
s.getOrNewStateObject(addr).SetNonce(nonce)
|
||||||
if stateObject != nil {
|
|
||||||
stateObject.SetNonce(nonce)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StateDB) SetCode(addr common.Address, code []byte) (prev []byte) {
|
func (s *StateDB) SetCode(addr common.Address, code []byte) (prev []byte) {
|
||||||
stateObject := s.getOrNewStateObject(addr)
|
return s.getOrNewStateObject(addr).SetCode(crypto.Keccak256Hash(code), code)
|
||||||
if stateObject != nil {
|
|
||||||
return stateObject.SetCode(crypto.Keccak256Hash(code), code)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StateDB) SetState(addr common.Address, key, value common.Hash) common.Hash {
|
func (s *StateDB) SetState(addr common.Address, key, value common.Hash) common.Hash {
|
||||||
if stateObject := s.getOrNewStateObject(addr); stateObject != nil {
|
return s.getOrNewStateObject(addr).SetState(key, value)
|
||||||
return stateObject.SetState(key, value)
|
|
||||||
}
|
|
||||||
return common.Hash{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetStorage replaces the entire storage for the specified account with given
|
// SetStorage replaces the entire storage for the specified account with given
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue