mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
This commit is contained in:
parent
a00d95bf1a
commit
ea239d5b15
2 changed files with 12 additions and 12 deletions
|
|
@ -740,9 +740,9 @@ func newAccounts(n int) (accounts []Account) {
|
|||
return accounts
|
||||
}
|
||||
|
||||
func newRPCBalance(balance *big.Int) **hexutil.Big {
|
||||
func newRPCBalance(balance *big.Int) *hexutil.Big {
|
||||
rpcBalance := (*hexutil.Big)(balance)
|
||||
return &rpcBalance
|
||||
return rpcBalance
|
||||
}
|
||||
|
||||
func newRPCBytes(bytes []byte) *hexutil.Bytes {
|
||||
|
|
@ -750,7 +750,7 @@ func newRPCBytes(bytes []byte) *hexutil.Bytes {
|
|||
return &rpcBytes
|
||||
}
|
||||
|
||||
func newStates(keys []common.Hash, vals []common.Hash) *map[common.Hash]common.Hash {
|
||||
func newStates(keys []common.Hash, vals []common.Hash) map[common.Hash]common.Hash {
|
||||
if len(keys) != len(vals) {
|
||||
panic("invalid input")
|
||||
}
|
||||
|
|
@ -758,7 +758,7 @@ func newStates(keys []common.Hash, vals []common.Hash) *map[common.Hash]common.H
|
|||
for i := 0; i < len(keys); i++ {
|
||||
m[keys[i]] = vals[i]
|
||||
}
|
||||
return &m
|
||||
return m
|
||||
}
|
||||
|
||||
func TestTraceChain(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -532,11 +532,11 @@ func (s *BlockChainAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.
|
|||
// if statDiff is set, all diff will be applied first and then execute the call
|
||||
// message.
|
||||
type OverrideAccount struct {
|
||||
Nonce *hexutil.Uint64 `json:"nonce"`
|
||||
Code *hexutil.Bytes `json:"code"`
|
||||
Balance **hexutil.Big `json:"balance"`
|
||||
State *map[common.Hash]common.Hash `json:"state"`
|
||||
StateDiff *map[common.Hash]common.Hash `json:"stateDiff"`
|
||||
Nonce *hexutil.Uint64 `json:"nonce"`
|
||||
Code *hexutil.Bytes `json:"code"`
|
||||
Balance *hexutil.Big `json:"balance"`
|
||||
State map[common.Hash]common.Hash `json:"state"`
|
||||
StateDiff map[common.Hash]common.Hash `json:"stateDiff"`
|
||||
}
|
||||
|
||||
// StateOverride is the collection of overridden accounts.
|
||||
|
|
@ -558,18 +558,18 @@ func (diff *StateOverride) Apply(statedb *state.StateDB) error {
|
|||
}
|
||||
// Override account balance.
|
||||
if account.Balance != nil {
|
||||
statedb.SetBalance(addr, (*big.Int)(*account.Balance), tracing.BalanceChangeUnspecified)
|
||||
statedb.SetBalance(addr, (*big.Int)(account.Balance), tracing.BalanceChangeUnspecified)
|
||||
}
|
||||
if account.State != nil && account.StateDiff != nil {
|
||||
return fmt.Errorf("account %s has both 'state' and 'stateDiff'", addr.Hex())
|
||||
}
|
||||
// Replace entire state if caller requires.
|
||||
if account.State != nil {
|
||||
statedb.SetStorage(addr, *account.State)
|
||||
statedb.SetStorage(addr, account.State)
|
||||
}
|
||||
// Apply state diff into specified accounts.
|
||||
if account.StateDiff != nil {
|
||||
for key, value := range *account.StateDiff {
|
||||
for key, value := range account.StateDiff {
|
||||
statedb.SetState(addr, key, value)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue