Skip to content

Commit 55ed8d1

Browse files
committed
Merge pull request #1789 from Gustav-Simonsson/core_remove_unused_functions
core, core/vm, core/state: remove unused functions
2 parents f1a4b33 + b81a6e6 commit 55ed8d1

File tree

6 files changed

+0
-281
lines changed

6 files changed

+0
-281
lines changed

core/block_cache.go

Lines changed: 0 additions & 120 deletions
This file was deleted.

core/block_cache_test.go

Lines changed: 0 additions & 76 deletions
This file was deleted.

core/state/state_object.go

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ type StateObject struct {
8787
dirty bool
8888
}
8989

90-
func (self *StateObject) Reset() {
91-
self.storage = make(Storage)
92-
}
93-
9490
func NewStateObject(address common.Address, db common.Database) *StateObject {
9591
object := &StateObject{db: db, address: address, balance: new(big.Int), gasPool: new(big.Int), dirty: true}
9692
object.trie = trie.NewSecure((common.Hash{}).Bytes(), db)
@@ -184,14 +180,6 @@ func (self *StateObject) Update() {
184180
}
185181
}
186182

187-
func (c *StateObject) GetInstr(pc *big.Int) *common.Value {
188-
if int64(len(c.code)-1) < pc.Int64() {
189-
return common.NewValue(0)
190-
}
191-
192-
return common.NewValueFromBytes([]byte{c.code[pc.Int64()]})
193-
}
194-
195183
func (c *StateObject) AddBalance(amount *big.Int) {
196184
c.SetBalance(new(big.Int).Add(c.balance, amount))
197185

@@ -268,10 +256,6 @@ func (self *StateObject) Copy() *StateObject {
268256
return stateObject
269257
}
270258

271-
func (self *StateObject) Set(stateObject *StateObject) {
272-
*self = *stateObject
273-
}
274-
275259
//
276260
// Attribute accessors
277261
//
@@ -280,20 +264,11 @@ func (self *StateObject) Balance() *big.Int {
280264
return self.balance
281265
}
282266

283-
func (c *StateObject) N() *big.Int {
284-
return big.NewInt(int64(c.nonce))
285-
}
286-
287267
// Returns the address of the contract/account
288268
func (c *StateObject) Address() common.Address {
289269
return c.address
290270
}
291271

292-
// Returns the initialization Code
293-
func (c *StateObject) Init() Code {
294-
return c.initCode
295-
}
296-
297272
func (self *StateObject) Trie() *trie.SecureTrie {
298273
return self.trie
299274
}
@@ -311,11 +286,6 @@ func (self *StateObject) SetCode(code []byte) {
311286
self.dirty = true
312287
}
313288

314-
func (self *StateObject) SetInitCode(code []byte) {
315-
self.initCode = code
316-
self.dirty = true
317-
}
318-
319289
func (self *StateObject) SetNonce(nonce uint64) {
320290
self.nonce = nonce
321291
self.dirty = true
@@ -354,19 +324,6 @@ func (c *StateObject) CodeHash() common.Bytes {
354324
return crypto.Sha3(c.code)
355325
}
356326

357-
func (c *StateObject) RlpDecode(data []byte) {
358-
decoder := common.NewValueFromBytes(data)
359-
c.nonce = decoder.Get(0).Uint()
360-
c.balance = decoder.Get(1).BigInt()
361-
c.trie = trie.NewSecure(decoder.Get(2).Bytes(), c.db)
362-
c.storage = make(map[string]common.Hash)
363-
c.gasPool = new(big.Int)
364-
365-
c.codeHash = decoder.Get(3).Bytes()
366-
367-
c.code, _ = c.db.Get(c.codeHash)
368-
}
369-
370327
// Storage change object. Used by the manifest for notifying changes to
371328
// the sub channels.
372329
type StorageState struct {

core/state/statedb.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package state
1919

2020
import (
21-
"bytes"
2221
"math/big"
2322

2423
"github.com/ethereum/go-ethereum/common"
@@ -276,10 +275,6 @@ func (self *StateDB) CreateAccount(addr common.Address) *StateObject {
276275
// Setting, copying of the state methods
277276
//
278277

279-
func (s *StateDB) Cmp(other *StateDB) bool {
280-
return bytes.Equal(s.trie.Root(), other.trie.Root())
281-
}
282-
283278
func (self *StateDB) Copy() *StateDB {
284279
state := New(common.Hash{}, self.db)
285280
state.trie = self.trie
@@ -311,22 +306,6 @@ func (s *StateDB) Root() common.Hash {
311306
return common.BytesToHash(s.trie.Root())
312307
}
313308

314-
func (s *StateDB) Trie() *trie.SecureTrie {
315-
return s.trie
316-
}
317-
318-
// Resets the trie and all siblings
319-
func (s *StateDB) Reset() {
320-
s.trie.Reset()
321-
322-
// Reset all nested states
323-
for _, stateObject := range s.stateObjects {
324-
stateObject.Reset()
325-
}
326-
327-
s.Empty()
328-
}
329-
330309
// Syncs the trie and all siblings
331310
func (s *StateDB) Sync() {
332311
// Sync all nested states

core/types/transaction.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ import (
3333

3434
var ErrInvalidSig = errors.New("invalid v, r, s values")
3535

36-
func IsContractAddr(addr []byte) bool {
37-
return len(addr) == 0
38-
}
39-
4036
type Transaction struct {
4137
data txdata
4238
// caches

core/vm/errors.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,3 @@ import (
2525

2626
var OutOfGasError = errors.New("Out of gas")
2727
var DepthError = fmt.Errorf("Max call depth exceeded (%d)", params.CallCreateDepth)
28-
29-
type StackError struct {
30-
req, has int
31-
}
32-
33-
func StackErr(req, has int) StackError {
34-
return StackError{req, has}
35-
}
36-
37-
func (self StackError) Error() string {
38-
return fmt.Sprintf("stack error! require %v, have %v", self.req, self.has)
39-
}
40-
41-
func IsStackErr(err error) bool {
42-
_, ok := err.(StackError)
43-
return ok
44-
}

0 commit comments

Comments
 (0)