aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/database_util_test.go2
-rw-r--r--core/state/database.go5
-rw-r--r--core/types/block.go35
-rw-r--r--core/types/log.go5
-rw-r--r--core/types/receipt.go8
-rw-r--r--core/types/transaction.go53
-rw-r--r--core/vm/logger.go7
7 files changed, 9 insertions, 106 deletions
diff --git a/core/database_util_test.go b/core/database_util_test.go
index ab4e45a47..aa87fa6f8 100644
--- a/core/database_util_test.go
+++ b/core/database_util_test.go
@@ -317,7 +317,7 @@ func TestLookupStorage(t *testing.T) {
if hash != block.Hash() || number != block.NumberU64() || index != uint64(i) {
t.Fatalf("tx #%d [%x]: positional metadata mismatch: have %x/%d/%d, want %x/%v/%v", i, tx.Hash(), hash, number, index, block.Hash(), block.NumberU64(), i)
}
- if tx.String() != txn.String() {
+ if tx.Hash() != txn.Hash() {
t.Fatalf("tx #%d [%x]: transaction mismatch: have %v, want %v", i, tx.Hash(), txn, tx)
}
}
diff --git a/core/state/database.go b/core/state/database.go
index 36926ec69..c1b630991 100644
--- a/core/state/database.go
+++ b/core/state/database.go
@@ -26,7 +26,7 @@ import (
lru "github.com/hashicorp/golang-lru"
)
-// Trie cache generation limit after which to evic trie nodes from memory.
+// Trie cache generation limit after which to evict trie nodes from memory.
var MaxTrieCacheGen = uint16(120)
const (
@@ -151,9 +151,6 @@ func (db *cachingDB) ContractCodeSize(addrHash, codeHash common.Hash) (int, erro
return cached.(int), nil
}
code, err := db.ContractCode(addrHash, codeHash)
- if err == nil {
- db.codeSizeCache.Add(codeHash, len(code))
- }
return len(code), err
}
diff --git a/core/types/block.go b/core/types/block.go
index 92b868d9d..ae1b4299d 100644
--- a/core/types/block.go
+++ b/core/types/block.go
@@ -19,7 +19,6 @@ package types
import (
"encoding/binary"
- "fmt"
"io"
"math/big"
"sort"
@@ -389,40 +388,6 @@ func (b *Block) Hash() common.Hash {
return v
}
-func (b *Block) String() string {
- str := fmt.Sprintf(`Block(#%v): Size: %v {
-MinerHash: %x
-%v
-Transactions:
-%v
-Uncles:
-%v
-}
-`, b.Number(), b.Size(), b.header.HashNoNonce(), b.header, b.transactions, b.uncles)
- return str
-}
-
-func (h *Header) String() string {
- return fmt.Sprintf(`Header(%x):
-[
- ParentHash: %x
- UncleHash: %x
- Coinbase: %x
- Root: %x
- TxSha %x
- ReceiptSha: %x
- Bloom: %x
- Difficulty: %v
- Number: %v
- GasLimit: %v
- GasUsed: %v
- Time: %v
- Extra: %s
- MixDigest: %x
- Nonce: %x
-]`, h.Hash(), h.ParentHash, h.UncleHash, h.Coinbase, h.Root, h.TxHash, h.ReceiptHash, h.Bloom, h.Difficulty, h.Number, h.GasLimit, h.GasUsed, h.Time, h.Extra, h.MixDigest, h.Nonce)
-}
-
type Blocks []*Block
type BlockBy func(b1, b2 *Block) bool
diff --git a/core/types/log.go b/core/types/log.go
index be5de38da..b629b47ed 100644
--- a/core/types/log.go
+++ b/core/types/log.go
@@ -17,7 +17,6 @@
package types
import (
- "fmt"
"io"
"github.com/ethereum/go-ethereum/common"
@@ -95,10 +94,6 @@ func (l *Log) DecodeRLP(s *rlp.Stream) error {
return err
}
-func (l *Log) String() string {
- return fmt.Sprintf(`log: %x %x %x %x %d %x %d`, l.Address, l.Topics, l.Data, l.TxHash, l.TxIndex, l.BlockHash, l.Index)
-}
-
// LogForStorage is a wrapper around a Log that flattens and parses the entire content of
// a log including non-consensus fields.
type LogForStorage Log
diff --git a/core/types/receipt.go b/core/types/receipt.go
index f945f6f6a..613f03d50 100644
--- a/core/types/receipt.go
+++ b/core/types/receipt.go
@@ -149,14 +149,6 @@ func (r *Receipt) Size() common.StorageSize {
return size
}
-// String implements the Stringer interface.
-func (r *Receipt) String() string {
- if len(r.PostState) == 0 {
- return fmt.Sprintf("receipt{status=%d cgas=%v bloom=%x logs=%v}", r.Status, r.CumulativeGasUsed, r.Bloom, r.Logs)
- }
- return fmt.Sprintf("receipt{med=%x cgas=%v bloom=%x logs=%v}", r.PostState, r.CumulativeGasUsed, r.Bloom, r.Logs)
-}
-
// ReceiptForStorage is a wrapper around a Receipt that flattens and parses the
// entire content of a receipt, as opposed to only the consensus fields originally.
type ReceiptForStorage Receipt
diff --git a/core/types/transaction.go b/core/types/transaction.go
index 5660582ba..70d757c94 100644
--- a/core/types/transaction.go
+++ b/core/types/transaction.go
@@ -19,7 +19,6 @@ package types
import (
"container/heap"
"errors"
- "fmt"
"io"
"math/big"
"sync/atomic"
@@ -262,58 +261,6 @@ func (tx *Transaction) RawSignatureValues() (*big.Int, *big.Int, *big.Int) {
return tx.data.V, tx.data.R, tx.data.S
}
-func (tx *Transaction) String() string {
- var from, to string
- if tx.data.V != nil {
- // make a best guess about the signer and use that to derive
- // the sender.
- signer := deriveSigner(tx.data.V)
- if f, err := Sender(signer, tx); err != nil { // derive but don't cache
- from = "[invalid sender: invalid sig]"
- } else {
- from = fmt.Sprintf("%x", f[:])
- }
- } else {
- from = "[invalid sender: nil V field]"
- }
-
- if tx.data.Recipient == nil {
- to = "[contract creation]"
- } else {
- to = fmt.Sprintf("%x", tx.data.Recipient[:])
- }
- enc, _ := rlp.EncodeToBytes(&tx.data)
- return fmt.Sprintf(`
- TX(%x)
- Contract: %v
- From: %s
- To: %s
- Nonce: %v
- GasPrice: %#x
- GasLimit %#x
- Value: %#x
- Data: 0x%x
- V: %#x
- R: %#x
- S: %#x
- Hex: %x
-`,
- tx.Hash(),
- tx.data.Recipient == nil,
- from,
- to,
- tx.data.AccountNonce,
- tx.data.Price,
- tx.data.GasLimit,
- tx.data.Amount,
- tx.data.Payload,
- tx.data.V,
- tx.data.R,
- tx.data.S,
- enc,
- )
-}
-
// Transactions is a Transaction slice type for basic sorting.
type Transactions []*Transaction
diff --git a/core/vm/logger.go b/core/vm/logger.go
index 4c820d8b5..dde1903bf 100644
--- a/core/vm/logger.go
+++ b/core/vm/logger.go
@@ -45,6 +45,7 @@ type LogConfig struct {
DisableMemory bool // disable memory capture
DisableStack bool // disable stack capture
DisableStorage bool // disable storage capture
+ Debug bool // print output during capture end
Limit int // maximum length of output, but zero means unlimited
}
@@ -184,6 +185,12 @@ func (l *StructLogger) CaptureFault(env *EVM, pc uint64, op OpCode, gas, cost ui
func (l *StructLogger) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) error {
l.output = output
l.err = err
+ if l.cfg.Debug {
+ fmt.Printf("0x%x\n", output)
+ if err != nil {
+ fmt.Printf(" error: %v\n", err)
+ }
+ }
return nil
}