aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
Diffstat (limited to 'eth')
-rw-r--r--eth/api.go2
-rw-r--r--eth/api_backend.go2
-rw-r--r--eth/backend_test.go5
-rw-r--r--eth/downloader/downloader.go2
-rw-r--r--eth/downloader/downloader_test.go2
-rw-r--r--eth/downloader/peer.go4
-rw-r--r--eth/downloader/queue.go19
-rw-r--r--eth/fetcher/fetcher_test.go2
-rw-r--r--eth/filters/api.go19
-rw-r--r--eth/filters/filter.go17
-rw-r--r--eth/filters/filter_system.go25
-rw-r--r--eth/filters/filter_system_test.go79
-rw-r--r--eth/filters/filter_test.go35
-rw-r--r--eth/handler.go30
-rw-r--r--eth/handler_test.go26
-rw-r--r--eth/helper_test.go2
-rw-r--r--eth/protocol_test.go4
17 files changed, 126 insertions, 149 deletions
diff --git a/eth/api.go b/eth/api.go
index f077e348c..d798c196e 100644
--- a/eth/api.go
+++ b/eth/api.go
@@ -435,7 +435,7 @@ func (api *PrivateDebugAPI) traceBlock(block *types.Block, logConfig *vm.LogConf
return true, structLogger.StructLogs(), nil
}
-// callmsg is the message type used for call transations.
+// callmsg is the message type used for call transitions.
type callmsg struct {
addr common.Address
to *common.Address
diff --git a/eth/api_backend.go b/eth/api_backend.go
index 801b6a4f6..1174588ea 100644
--- a/eth/api_backend.go
+++ b/eth/api_backend.go
@@ -31,7 +31,7 @@ import (
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/params"
- rpc "github.com/ethereum/go-ethereum/rpc"
+ "github.com/ethereum/go-ethereum/rpc"
"golang.org/x/net/context"
)
diff --git a/eth/backend_test.go b/eth/backend_test.go
index 212c4c4d3..574731fbe 100644
--- a/eth/backend_test.go
+++ b/eth/backend_test.go
@@ -23,7 +23,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/params"
)
@@ -38,12 +37,12 @@ func TestMipmapUpgrade(t *testing.T) {
switch i {
case 1:
receipt := types.NewReceipt(nil, new(big.Int))
- receipt.Logs = vm.Logs{&vm.Log{Address: addr}}
+ receipt.Logs = []*types.Log{{Address: addr}}
gen.AddUncheckedReceipt(receipt)
receipts = types.Receipts{receipt}
case 2:
receipt := types.NewReceipt(nil, new(big.Int))
- receipt.Logs = vm.Logs{&vm.Log{Address: addr}}
+ receipt.Logs = []*types.Log{{Address: addr}}
gen.AddUncheckedReceipt(receipt)
receipts = types.Receipts{receipt}
}
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go
index b1f4b8169..9be4bd87d 100644
--- a/eth/downloader/downloader.go
+++ b/eth/downloader/downloader.go
@@ -1005,7 +1005,7 @@ func (d *Downloader) fetchNodeData() error {
// - fetchHook: tester callback to notify of new tasks being initiated (allows testing the scheduling logic)
// - fetch: network callback to actually send a particular download request to a physical remote peer
// - cancel: task callback to abort an in-flight download request and allow rescheduling it (in case of lost peer)
-// - capacity: network callback to retreive the estimated type-specific bandwidth capacity of a peer (traffic shaping)
+// - capacity: network callback to retrieve the estimated type-specific bandwidth capacity of a peer (traffic shaping)
// - idle: network callback to retrieve the currently (type specific) idle peers that can be assigned tasks
// - setIdle: network callback to set a peer back to idle and update its estimated capacity (traffic shaping)
// - kind: textual label of the type being downloaded to display in log mesages
diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go
index 86638ae2d..b43edf53e 100644
--- a/eth/downloader/downloader_test.go
+++ b/eth/downloader/downloader_test.go
@@ -119,7 +119,7 @@ func (dl *downloadTester) makeChain(n int, seed byte, parent *types.Block, paren
// If the block number is multiple of 3, send a bonus transaction to the miner
if parent == dl.genesis && i%3 == 0 {
signer := types.MakeSigner(params.TestChainConfig, block.Number())
- tx, err := types.NewTransaction(block.TxNonce(testAddress), common.Address{seed}, big.NewInt(1000), params.TxGas, nil, nil).SignECDSA(signer, testKey)
+ tx, err := types.SignTx(types.NewTransaction(block.TxNonce(testAddress), common.Address{seed}, big.NewInt(1000), params.TxGas, nil, nil), signer, testKey)
if err != nil {
panic(err)
}
diff --git a/eth/downloader/peer.go b/eth/downloader/peer.go
index b0bfc66c8..ea4b6a6f2 100644
--- a/eth/downloader/peer.go
+++ b/eth/downloader/peer.go
@@ -205,7 +205,7 @@ func (p *peer) FetchNodeData(request *fetchRequest) error {
// Convert the hash set to a retrievable slice
hashes := make([]common.Hash, 0, len(request.Hashes))
- for hash, _ := range request.Hashes {
+ for hash := range request.Hashes {
hashes = append(hashes, hash)
}
go p.getNodeData(hashes)
@@ -314,7 +314,7 @@ func (p *peer) MarkLacking(hash common.Hash) {
defer p.lock.Unlock()
for len(p.lacking) >= maxLackingHashes {
- for drop, _ := range p.lacking {
+ for drop := range p.lacking {
delete(p.lacking, drop)
break
}
diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go
index b7ad92099..dd9590b28 100644
--- a/eth/downloader/queue.go
+++ b/eth/downloader/queue.go
@@ -844,7 +844,7 @@ func (q *queue) expire(timeout time.Duration, pendPool map[string]*fetchRequest,
}
}
// Remove the expired requests from the pending pool
- for id, _ := range expiries {
+ for id := range expiries {
delete(pendPool, id)
}
return expiries
@@ -1063,7 +1063,7 @@ func (q *queue) DeliverNodeData(id string, data [][]byte, callback func(int, boo
// If no data was retrieved, mark their hashes as unavailable for the origin peer
if len(data) == 0 {
- for hash, _ := range request.Hashes {
+ for hash := range request.Hashes {
request.Peer.MarkLacking(hash)
}
}
@@ -1123,15 +1123,20 @@ func (q *queue) deliverNodeData(results []trie.SyncResult, callback func(int, bo
callback(i, progressed, errNoFetchesPending)
return
}
- if prog, _, err := q.stateScheduler.Process([]trie.SyncResult{result}); err != nil {
- // Processing a state result failed, bail out
+
+ batch := q.stateDatabase.NewBatch()
+ prog, _, err := q.stateScheduler.Process([]trie.SyncResult{result}, batch)
+ if err != nil {
+ q.stateSchedLock.Unlock()
+ callback(i, progressed, err)
+ }
+ if err = batch.Write(); err != nil {
q.stateSchedLock.Unlock()
callback(i, progressed, err)
- return
- } else if prog {
- progressed = true
}
+
// Item processing succeeded, release the lock (temporarily)
+ progressed = progressed || prog
q.stateSchedLock.Unlock()
}
callback(len(results), progressed, nil)
diff --git a/eth/fetcher/fetcher_test.go b/eth/fetcher/fetcher_test.go
index 426bfd542..2e28541ab 100644
--- a/eth/fetcher/fetcher_test.go
+++ b/eth/fetcher/fetcher_test.go
@@ -51,7 +51,7 @@ func makeChain(n int, seed byte, parent *types.Block) ([]common.Hash, map[common
// If the block number is multiple of 3, send a bonus transaction to the miner
if parent == genesis && i%3 == 0 {
signer := types.MakeSigner(params.TestChainConfig, block.Number())
- tx, err := types.NewTransaction(block.TxNonce(testAddress), common.Address{seed}, big.NewInt(1000), params.TxGas, nil, nil).SignECDSA(signer, testKey)
+ tx, err := types.SignTx(types.NewTransaction(block.TxNonce(testAddress), common.Address{seed}, big.NewInt(1000), params.TxGas, nil, nil), signer, testKey)
if err != nil {
panic(err)
}
diff --git a/eth/filters/api.go b/eth/filters/api.go
index bbb34d3de..02a544ce1 100644
--- a/eth/filters/api.go
+++ b/eth/filters/api.go
@@ -29,7 +29,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/rpc"
@@ -46,7 +45,7 @@ type filter struct {
deadline *time.Timer // filter is inactiv when deadline triggers
hashes []common.Hash
crit FilterCriteria
- logs []*vm.Log
+ logs []*types.Log
s *Subscription // associated subscription in event system
}
@@ -242,7 +241,7 @@ func (api *PublicFilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc
var (
rpcSub = notifier.CreateSubscription()
- matchedLogs = make(chan []*vm.Log)
+ matchedLogs = make(chan []*types.Log)
)
logsSub, err := api.events.SubscribeLogs(crit, matchedLogs)
@@ -293,14 +292,14 @@ type FilterCriteria struct {
//
// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter
func (api *PublicFilterAPI) NewFilter(crit FilterCriteria) (rpc.ID, error) {
- logs := make(chan []*vm.Log)
+ logs := make(chan []*types.Log)
logsSub, err := api.events.SubscribeLogs(crit, logs)
if err != nil {
return rpc.ID(""), err
}
api.filtersMu.Lock()
- api.filters[logsSub.ID] = &filter{typ: LogsSubscription, crit: crit, deadline: time.NewTimer(deadline), logs: make([]*vm.Log, 0), s: logsSub}
+ api.filters[logsSub.ID] = &filter{typ: LogsSubscription, crit: crit, deadline: time.NewTimer(deadline), logs: make([]*types.Log, 0), s: logsSub}
api.filtersMu.Unlock()
go func() {
@@ -327,7 +326,7 @@ func (api *PublicFilterAPI) NewFilter(crit FilterCriteria) (rpc.ID, error) {
// GetLogs returns logs matching the given argument that are stored within the state.
//
// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs
-func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([]*vm.Log, error) {
+func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([]*types.Log, error) {
if crit.FromBlock == nil {
crit.FromBlock = big.NewInt(rpc.LatestBlockNumber.Int64())
}
@@ -366,7 +365,7 @@ func (api *PublicFilterAPI) UninstallFilter(id rpc.ID) bool {
// If the filter could not be found an empty array of logs is returned.
//
// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs
-func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*vm.Log, error) {
+func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*types.Log, error) {
api.filtersMu.Lock()
f, found := api.filters[id]
api.filtersMu.Unlock()
@@ -441,9 +440,9 @@ func returnHashes(hashes []common.Hash) []common.Hash {
// returnLogs is a helper that will return an empty log array in case the given logs array is nil,
// otherwise the given logs array is returned.
-func returnLogs(logs []*vm.Log) []*vm.Log {
+func returnLogs(logs []*types.Log) []*types.Log {
if logs == nil {
- return []*vm.Log{}
+ return []*types.Log{}
}
return logs
}
@@ -506,7 +505,7 @@ func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
switch topic := t.(type) {
case nil:
// ignore topic when matching logs
- args.Topics[i] = []common.Hash{common.Hash{}}
+ args.Topics[i] = []common.Hash{{}}
case string:
// match specific topic
diff --git a/eth/filters/filter.go b/eth/filters/filter.go
index 76ca86524..9a8e2fd70 100644
--- a/eth/filters/filter.go
+++ b/eth/filters/filter.go
@@ -25,7 +25,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/rpc"
@@ -91,7 +90,7 @@ func (f *Filter) SetTopics(topics [][]common.Hash) {
// all matching entries from the first block that contains matches,
// updating the start point of the filter accordingly. If no results are
// found, a nil slice is returned.
-func (f *Filter) FindOnce(ctx context.Context) ([]*vm.Log, error) {
+func (f *Filter) FindOnce(ctx context.Context) ([]*types.Log, error) {
head, _ := f.backend.HeaderByNumber(ctx, rpc.LatestBlockNumber)
if head == nil {
return nil, nil
@@ -122,7 +121,7 @@ func (f *Filter) FindOnce(ctx context.Context) ([]*vm.Log, error) {
}
// Run filters logs with the current parameters set
-func (f *Filter) Find(ctx context.Context) (logs []*vm.Log, err error) {
+func (f *Filter) Find(ctx context.Context) (logs []*types.Log, err error) {
for {
newLogs, err := f.FindOnce(ctx)
if len(newLogs) == 0 || err != nil {
@@ -132,7 +131,7 @@ func (f *Filter) Find(ctx context.Context) (logs []*vm.Log, err error) {
}
}
-func (f *Filter) mipFind(start, end uint64, depth int) (logs []*vm.Log, blockNumber uint64) {
+func (f *Filter) mipFind(start, end uint64, depth int) (logs []*types.Log, blockNumber uint64) {
level := core.MIPMapLevels[depth]
// normalise numerator so we can work in level specific batches and
// work with the proper range checks
@@ -168,7 +167,7 @@ func (f *Filter) mipFind(start, end uint64, depth int) (logs []*vm.Log, blockNum
return nil, end
}
-func (f *Filter) getLogs(ctx context.Context, start, end uint64) (logs []*vm.Log, blockNumber uint64, err error) {
+func (f *Filter) getLogs(ctx context.Context, start, end uint64) (logs []*types.Log, blockNumber uint64, err error) {
for i := start; i <= end; i++ {
blockNumber := rpc.BlockNumber(i)
header, err := f.backend.HeaderByNumber(ctx, blockNumber)
@@ -184,9 +183,9 @@ func (f *Filter) getLogs(ctx context.Context, start, end uint64) (logs []*vm.Log
if err != nil {
return nil, end, err
}
- var unfiltered []*vm.Log
+ var unfiltered []*types.Log
for _, receipt := range receipts {
- unfiltered = append(unfiltered, ([]*vm.Log)(receipt.Logs)...)
+ unfiltered = append(unfiltered, ([]*types.Log)(receipt.Logs)...)
}
logs = filterLogs(unfiltered, nil, nil, f.addresses, f.topics)
if len(logs) > 0 {
@@ -209,8 +208,8 @@ func includes(addresses []common.Address, a common.Address) bool {
}
// filterLogs creates a slice of logs matching the given criteria.
-func filterLogs(logs []*vm.Log, fromBlock, toBlock *big.Int, addresses []common.Address, topics [][]common.Hash) []*vm.Log {
- var ret []*vm.Log
+func filterLogs(logs []*types.Log, fromBlock, toBlock *big.Int, addresses []common.Address, topics [][]common.Hash) []*types.Log {
+ var ret []*types.Log
Logs:
for _, log := range logs {
if fromBlock != nil && fromBlock.Int64() >= 0 && fromBlock.Uint64() > log.BlockNumber {
diff --git a/eth/filters/filter_system.go b/eth/filters/filter_system.go
index 1b360cfdb..e0ee2ff51 100644
--- a/eth/filters/filter_system.go
+++ b/eth/filters/filter_system.go
@@ -27,7 +27,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/rpc"
"golang.org/x/net/context"
@@ -38,7 +37,7 @@ import (
type Type byte
const (
- // UnknownSubscription indicates an unkown subscription type
+ // UnknownSubscription indicates an unknown subscription type
UnknownSubscription Type = iota
// LogsSubscription queries for new or removed (chain reorg) logs
LogsSubscription
@@ -64,7 +63,7 @@ type subscription struct {
typ Type
created time.Time
logsCrit FilterCriteria
- logs chan []*vm.Log
+ logs chan []*types.Log
hashes chan common.Hash
headers chan *types.Header
installed chan struct{} // closed when the filter is installed
@@ -151,7 +150,7 @@ func (es *EventSystem) subscribe(sub *subscription) *Subscription {
// SubscribeLogs creates a subscription that will write all logs matching the
// given criteria to the given logs channel. Default value for the from and to
// block is "latest". If the fromBlock > toBlock an error is returned.
-func (es *EventSystem) SubscribeLogs(crit FilterCriteria, logs chan []*vm.Log) (*Subscription, error) {
+func (es *EventSystem) SubscribeLogs(crit FilterCriteria, logs chan []*types.Log) (*Subscription, error) {
var from, to rpc.BlockNumber
if crit.FromBlock == nil {
from = rpc.LatestBlockNumber
@@ -189,7 +188,7 @@ func (es *EventSystem) SubscribeLogs(crit FilterCriteria, logs chan []*vm.Log) (
// subscribeMinedPendingLogs creates a subscription that returned mined and
// pending logs that match the given criteria.
-func (es *EventSystem) subscribeMinedPendingLogs(crit FilterCriteria, logs chan []*vm.Log) *Subscription {
+func (es *EventSystem) subscribeMinedPendingLogs(crit FilterCriteria, logs chan []*types.Log) *Subscription {
sub := &subscription{
id: rpc.NewID(),
typ: MinedAndPendingLogsSubscription,
@@ -207,7 +206,7 @@ func (es *EventSystem) subscribeMinedPendingLogs(crit FilterCriteria, logs chan
// subscribeLogs creates a subscription that will write all logs matching the
// given criteria to the given logs channel.
-func (es *EventSystem) subscribeLogs(crit FilterCriteria, logs chan []*vm.Log) *Subscription {
+func (es *EventSystem) subscribeLogs(crit FilterCriteria, logs chan []*types.Log) *Subscription {
sub := &subscription{
id: rpc.NewID(),
typ: LogsSubscription,
@@ -225,7 +224,7 @@ func (es *EventSystem) subscribeLogs(crit FilterCriteria, logs chan []*vm.Log) *
// subscribePendingLogs creates a subscription that writes transaction hashes for
// transactions that enter the transaction pool.
-func (es *EventSystem) subscribePendingLogs(crit FilterCriteria, logs chan []*vm.Log) *Subscription {
+func (es *EventSystem) subscribePendingLogs(crit FilterCriteria, logs chan []*types.Log) *Subscription {
sub := &subscription{
id: rpc.NewID(),
typ: PendingLogsSubscription,
@@ -248,7 +247,7 @@ func (es *EventSystem) SubscribeNewHeads(headers chan *types.Header) *Subscripti
id: rpc.NewID(),
typ: BlocksSubscription,
created: time.Now(),
- logs: make(chan []*vm.Log),
+ logs: make(chan []*types.Log),
hashes: make(chan common.Hash),
headers: headers,
installed: make(chan struct{}),
@@ -265,7 +264,7 @@ func (es *EventSystem) SubscribePendingTxEvents(hashes chan common.Hash) *Subscr
id: rpc.NewID(),
typ: PendingTransactionsSubscription,
created: time.Now(),
- logs: make(chan []*vm.Log),
+ logs: make(chan []*types.Log),
hashes: hashes,
headers: make(chan *types.Header),
installed: make(chan struct{}),
@@ -284,7 +283,7 @@ func (es *EventSystem) broadcast(filters filterIndex, ev *event.Event) {
}
switch e := ev.Data.(type) {
- case vm.Logs:
+ case []*types.Log:
if len(e) > 0 {
for _, f := range filters[LogsSubscription] {
if ev.Time.After(f.created) {
@@ -370,7 +369,7 @@ func (es *EventSystem) lightFilterNewHead(newHeader *types.Header, callBack func
}
// filter logs of a single header in light client mode
-func (es *EventSystem) lightFilterLogs(header *types.Header, addresses []common.Address, topics [][]common.Hash, remove bool) []*vm.Log {
+func (es *EventSystem) lightFilterLogs(header *types.Header, addresses []common.Address, topics [][]common.Hash, remove bool) []*types.Log {
if bloomFilter(header.Bloom, addresses, topics) {
// Get the logs of the block
ctx, _ := context.WithTimeout(context.Background(), time.Second*5)
@@ -378,7 +377,7 @@ func (es *EventSystem) lightFilterLogs(header *types.Header, addresses []common.
if err != nil {
return nil
}
- var unfiltered []*vm.Log
+ var unfiltered []*types.Log
for _, receipt := range receipts {
for _, log := range receipt.Logs {
logcopy := *log
@@ -396,7 +395,7 @@ func (es *EventSystem) lightFilterLogs(header *types.Header, addresses []common.
func (es *EventSystem) eventLoop() {
var (
index = make(filterIndex)
- sub = es.mux.Subscribe(core.PendingLogsEvent{}, core.RemovedLogsEvent{}, vm.Logs{}, core.TxPreEvent{}, core.ChainEvent{})
+ sub = es.mux.Subscribe(core.PendingLogsEvent{}, core.RemovedLogsEvent{}, []*types.Log{}, core.TxPreEvent{}, core.ChainEvent{})
)
for i := UnknownSubscription; i < LastIndexSubscription; i++ {
diff --git a/eth/filters/filter_system_test.go b/eth/filters/filter_system_test.go
index 3ce0cf663..1cfced7e4 100644
--- a/eth/filters/filter_system_test.go
+++ b/eth/filters/filter_system_test.go
@@ -27,7 +27,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/params"
@@ -263,34 +262,34 @@ func TestLogFilter(t *testing.T) {
notUsedTopic = common.HexToHash("0x9999999999999999999999999999999999999999999999999999999999999999")
// posted twice, once as vm.Logs and once as core.PendingLogsEvent
- allLogs = vm.Logs{
- vm.NewLog(firstAddr, []common.Hash{}, []byte(""), 0),
- vm.NewLog(firstAddr, []common.Hash{firstTopic}, []byte(""), 1),
- vm.NewLog(secondAddr, []common.Hash{firstTopic}, []byte(""), 1),
- vm.NewLog(thirdAddress, []common.Hash{secondTopic}, []byte(""), 2),
- vm.NewLog(thirdAddress, []common.Hash{secondTopic}, []byte(""), 3),
+ allLogs = []*types.Log{
+ {Address: firstAddr},
+ {Address: firstAddr, Topics: []common.Hash{firstTopic}, BlockNumber: 1},
+ {Address: secondAddr, Topics: []common.Hash{firstTopic}, BlockNumber: 1},
+ {Address: thirdAddress, Topics: []common.Hash{secondTopic}, BlockNumber: 2},
+ {Address: thirdAddress, Topics: []common.Hash{secondTopic}, BlockNumber: 3},
}
- expectedCase7 = vm.Logs{allLogs[3], allLogs[4], allLogs[0], allLogs[1], allLogs[2], allLogs[3], allLogs[4]}
- expectedCase11 = vm.Logs{allLogs[1], allLogs[2], allLogs[1], allLogs[2]}
+ expectedCase7 = []*types.Log{allLogs[3], allLogs[4], allLogs[0], allLogs[1], allLogs[2], allLogs[3], allLogs[4]}
+ expectedCase11 = []*types.Log{allLogs[1], allLogs[2], allLogs[1], allLogs[2]}
testCases = []struct {
crit FilterCriteria
- expected vm.Logs
+ expected []*types.Log
id rpc.ID
}{
// match all
0: {FilterCriteria{}, allLogs, ""},
// match none due to no matching addresses
- 1: {FilterCriteria{Addresses: []common.Address{common.Address{}, notUsedAddress}, Topics: [][]common.Hash{allLogs[0].Topics}}, vm.Logs{}, ""},
+ 1: {FilterCriteria{Addresses: []common.Address{{}, notUsedAddress}, Topics: [][]common.Hash{allLogs[0].Topics}}, []*types.Log{}, ""},
// match logs based on addresses, ignore topics
2: {FilterCriteria{Addresses: []common.Address{firstAddr}}, allLogs[:2], ""},
// match none due to no matching topics (match with address)
- 3: {FilterCriteria{Addresses: []common.Address{secondAddr}, Topics: [][]common.Hash{[]common.Hash{notUsedTopic}}}, vm.Logs{}, ""},
+ 3: {FilterCriteria{Addresses: []common.Address{secondAddr}, Topics: [][]common.Hash{{notUsedTopic}}}, []*types.Log{}, ""},
// match logs based on addresses and topics
- 4: {FilterCriteria{Addresses: []common.Address{thirdAddress}, Topics: [][]common.Hash{[]common.Hash{firstTopic, secondTopic}}}, allLogs[3:5], ""},
+ 4: {FilterCriteria{Addresses: []common.Address{thirdAddress}, Topics: [][]common.Hash{{firstTopic, secondTopic}}}, allLogs[3:5], ""},
// match logs based on multiple addresses and "or" topics
- 5: {FilterCriteria{Addresses: []common.Address{secondAddr, thirdAddress}, Topics: [][]common.Hash{[]common.Hash{firstTopic, secondTopic}}}, allLogs[2:5], ""},
+ 5: {FilterCriteria{Addresses: []common.Address{secondAddr, thirdAddress}, Topics: [][]common.Hash{{firstTopic, secondTopic}}}, allLogs[2:5], ""},
// logs in the pending block
6: {FilterCriteria{Addresses: []common.Address{firstAddr}, FromBlock: big.NewInt(rpc.PendingBlockNumber.Int64()), ToBlock: big.NewInt(rpc.PendingBlockNumber.Int64())}, allLogs[:2], ""},
// mined logs with block num >= 2 or pending logs
@@ -300,9 +299,9 @@ func TestLogFilter(t *testing.T) {
// all "mined" logs
9: {FilterCriteria{ToBlock: big.NewInt(rpc.LatestBlockNumber.Int64())}, allLogs, ""},
// all "mined" logs with 1>= block num <=2 and topic secondTopic
- 10: {FilterCriteria{FromBlock: big.NewInt(1), ToBlock: big.NewInt(2), Topics: [][]common.Hash{[]common.Hash{secondTopic}}}, allLogs[3:4], ""},
+ 10: {FilterCriteria{FromBlock: big.NewInt(1), ToBlock: big.NewInt(2), Topics: [][]common.Hash{{secondTopic}}}, allLogs[3:4], ""},
// all "mined" and pending logs with topic firstTopic
- 11: {FilterCriteria{FromBlock: big.NewInt(rpc.LatestBlockNumber.Int64()), ToBlock: big.NewInt(rpc.PendingBlockNumber.Int64()), Topics: [][]common.Hash{[]common.Hash{firstTopic}}}, expectedCase11, ""},
+ 11: {FilterCriteria{FromBlock: big.NewInt(rpc.LatestBlockNumber.Int64()), ToBlock: big.NewInt(rpc.PendingBlockNumber.Int64()), Topics: [][]common.Hash{{firstTopic}}}, expectedCase11, ""},
}
)
@@ -321,14 +320,14 @@ func TestLogFilter(t *testing.T) {
}
for i, tt := range testCases {
- var fetched []*vm.Log
+ var fetched []*types.Log
for { // fetch all expected logs
results, err := api.GetFilterChanges(tt.id)
if err != nil {
t.Fatalf("Unable to fetch logs: %v", err)
}
- fetched = append(fetched, results.([]*vm.Log)...)
+ fetched = append(fetched, results.([]*types.Log)...)
if len(fetched) >= len(tt.expected) {
break
}
@@ -373,21 +372,21 @@ func TestPendingLogsSubscription(t *testing.T) {
notUsedTopic = common.HexToHash("0x9999999999999999999999999999999999999999999999999999999999999999")
allLogs = []core.PendingLogsEvent{
- core.PendingLogsEvent{Logs: vm.Logs{vm.NewLog(firstAddr, []common.Hash{}, []byte(""), 0)}},
- core.PendingLogsEvent{Logs: vm.Logs{vm.NewLog(firstAddr, []common.Hash{firstTopic}, []byte(""), 1)}},
- core.PendingLogsEvent{Logs: vm.Logs{vm.NewLog(secondAddr, []common.Hash{firstTopic}, []byte(""), 2)}},
- core.PendingLogsEvent{Logs: vm.Logs{vm.NewLog(thirdAddress, []common.Hash{secondTopic}, []byte(""), 3)}},
- core.PendingLogsEvent{Logs: vm.Logs{vm.NewLog(thirdAddress, []common.Hash{secondTopic}, []byte(""), 4)}},
- core.PendingLogsEvent{Logs: vm.Logs{
- vm.NewLog(thirdAddress, []common.Hash{firstTopic}, []byte(""), 5),
- vm.NewLog(thirdAddress, []common.Hash{thirdTopic}, []byte(""), 5),
- vm.NewLog(thirdAddress, []common.Hash{forthTopic}, []byte(""), 5),
- vm.NewLog(firstAddr, []common.Hash{firstTopic}, []byte(""), 5),
+ {Logs: []*types.Log{{Address: firstAddr, Topics: []common.Hash{}, BlockNumber: 0}}},
+ {Logs: []*types.Log{{Address: firstAddr, Topics: []common.Hash{firstTopic}, BlockNumber: 1}}},
+ {Logs: []*types.Log{{Address: secondAddr, Topics: []common.Hash{firstTopic}, BlockNumber: 2}}},
+ {Logs: []*types.Log{{Address: thirdAddress, Topics: []common.Hash{secondTopic}, BlockNumber: 3}}},
+ {Logs: []*types.Log{{Address: thirdAddress, Topics: []common.Hash{secondTopic}, BlockNumber: 4}}},
+ {Logs: []*types.Log{
+ {Address: thirdAddress, Topics: []common.Hash{firstTopic}, BlockNumber: 5},
+ {Address: thirdAddress, Topics: []common.Hash{thirdTopic}, BlockNumber: 5},
+ {Address: thirdAddress, Topics: []common.Hash{forthTopic}, BlockNumber: 5},
+ {Address: firstAddr, Topics: []common.Hash{firstTopic}, BlockNumber: 5},
}},
}
- convertLogs = func(pl []core.PendingLogsEvent) vm.Logs {
- var logs vm.Logs
+ convertLogs = func(pl []core.PendingLogsEvent) []*types.Log {
+ var logs []*types.Log
for _, l := range pl {
logs = append(logs, l.Logs...)
}
@@ -396,26 +395,26 @@ func TestPendingLogsSubscription(t *testing.T) {
testCases = []struct {
crit FilterCriteria
- expected vm.Logs
- c chan []*vm.Log
+ expected []*types.Log
+ c chan []*types.Log
sub *Subscription
}{
// match all
{FilterCriteria{}, convertLogs(allLogs), nil, nil},
// match none due to no matching addresses
- {FilterCriteria{Addresses: []common.Address{common.Address{}, notUsedAddress}, Topics: [][]common.Hash{[]common.Hash{}}}, vm.Logs{}, nil, nil},
+ {FilterCriteria{Addresses: []common.Address{{}, notUsedAddress}, Topics: [][]common.Hash{{}}}, []*types.Log{}, nil, nil},
// match logs based on addresses, ignore topics
{FilterCriteria{Addresses: []common.Address{firstAddr}}, append(convertLogs(allLogs[:2]), allLogs[5].Logs[3]), nil, nil},
// match none due to no matching topics (match with address)
- {FilterCriteria{Addresses: []common.Address{secondAddr}, Topics: [][]common.Hash{[]common.Hash{notUsedTopic}}}, vm.Logs{}, nil, nil},
+ {FilterCriteria{Addresses: []common.Address{secondAddr}, Topics: [][]common.Hash{{notUsedTopic}}}, []*types.Log{}, nil, nil},
// match logs based on addresses and topics
- {FilterCriteria{Addresses: []common.Address{thirdAddress}, Topics: [][]common.Hash{[]common.Hash{firstTopic, secondTopic}}}, append(convertLogs(allLogs[3:5]), allLogs[5].Logs[0]), nil, nil},
+ {FilterCriteria{Addresses: []common.Address{thirdAddress}, Topics: [][]common.Hash{{firstTopic, secondTopic}}}, append(convertLogs(allLogs[3:5]), allLogs[5].Logs[0]), nil, nil},
// match logs based on multiple addresses and "or" topics
- {FilterCriteria{Addresses: []common.Address{secondAddr, thirdAddress}, Topics: [][]common.Hash{[]common.Hash{firstTopic, secondTopic}}}, append(convertLogs(allLogs[2:5]), allLogs[5].Logs[0]), nil, nil},
- // block numbers are ignored for filters created with New***Filter, these return all logs that match the given criterias when the state changes
+ {FilterCriteria{Addresses: []common.Address{secondAddr, thirdAddress}, Topics: [][]common.Hash{{firstTopic, secondTopic}}}, append(convertLogs(allLogs[2:5]), allLogs[5].Logs[0]), nil, nil},
+ // block numbers are ignored for filters created with New***Filter, these return all logs that match the given criteria when the state changes
{FilterCriteria{Addresses: []common.Address{firstAddr}, FromBlock: big.NewInt(2), ToBlock: big.NewInt(3)}, append(convertLogs(allLogs[:2]), allLogs[5].Logs[3]), nil, nil},
// multiple pending logs, should match only 2 topics from the logs in block 5
- {FilterCriteria{Addresses: []common.Address{thirdAddress}, Topics: [][]common.Hash{[]common.Hash{firstTopic, forthTopic}}}, vm.Logs{allLogs[5].Logs[0], allLogs[5].Logs[2]}, nil, nil},
+ {FilterCriteria{Addresses: []common.Address{thirdAddress}, Topics: [][]common.Hash{{firstTopic, forthTopic}}}, []*types.Log{allLogs[5].Logs[0], allLogs[5].Logs[2]}, nil, nil},
}
)
@@ -423,7 +422,7 @@ func TestPendingLogsSubscription(t *testing.T) {
// on slow machines this could otherwise lead to missing events when the subscription is created after
// (some) events are posted.
for i := range testCases {
- testCases[i].c = make(chan []*vm.Log)
+ testCases[i].c = make(chan []*types.Log)
testCases[i].sub, _ = api.events.SubscribeLogs(testCases[i].crit, testCases[i].c)
}
@@ -431,7 +430,7 @@ func TestPendingLogsSubscription(t *testing.T) {
i := n
tt := test
go func() {
- var fetched []*vm.Log
+ var fetched []*types.Log
fetchLoop:
for {
logs := <-tt.c
diff --git a/eth/filters/filter_test.go b/eth/filters/filter_test.go
index ab6a87851..83ff3e9ce 100644
--- a/eth/filters/filter_test.go
+++ b/eth/filters/filter_test.go
@@ -27,17 +27,16 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
- "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/event"
+ "github.com/ethereum/go-ethereum/params"
)
func makeReceipt(addr common.Address) *types.Receipt {
receipt := types.NewReceipt(nil, new(big.Int))
- receipt.Logs = vm.Logs{
- &vm.Log{Address: addr},
+ receipt.Logs = []*types.Log{
+ {Address: addr},
}
receipt.Bloom = types.CreateBloom(types.Receipts{receipt})
return receipt
@@ -146,8 +145,8 @@ func TestFilters(t *testing.T) {
switch i {
case 1:
receipt := types.NewReceipt(nil, new(big.Int))
- receipt.Logs = vm.Logs{
- &vm.Log{
+ receipt.Logs = []*types.Log{
+ {
Address: addr,
Topics: []common.Hash{hash1},
},
@@ -156,8 +155,8 @@ func TestFilters(t *testing.T) {
receipts = types.Receipts{receipt}
case 2:
receipt := types.NewReceipt(nil, new(big.Int))
- receipt.Logs = vm.Logs{
- &vm.Log{
+ receipt.Logs = []*types.Log{
+ {
Address: addr,
Topics: []common.Hash{hash2},
},
@@ -166,8 +165,8 @@ func TestFilters(t *testing.T) {
receipts = types.Receipts{receipt}
case 998:
receipt := types.NewReceipt(nil, new(big.Int))
- receipt.Logs = vm.Logs{
- &vm.Log{
+ receipt.Logs = []*types.Log{
+ {
Address: addr,
Topics: []common.Hash{hash3},
},
@@ -176,8 +175,8 @@ func TestFilters(t *testing.T) {
receipts = types.Receipts{receipt}
case 999:
receipt := types.NewReceipt(nil, new(big.Int))
- receipt.Logs = vm.Logs{
- &vm.Log{
+ receipt.Logs = []*types.Log{
+ {
Address: addr,
Topics: []common.Hash{hash4},
},
@@ -211,7 +210,7 @@ func TestFilters(t *testing.T) {
filter := New(backend, true)
filter.SetAddresses([]common.Address{addr})
- filter.SetTopics([][]common.Hash{[]common.Hash{hash1, hash2, hash3, hash4}})
+ filter.SetTopics([][]common.Hash{{hash1, hash2, hash3, hash4}})
filter.SetBeginBlock(0)
filter.SetEndBlock(-1)
@@ -222,7 +221,7 @@ func TestFilters(t *testing.T) {
filter = New(backend, true)
filter.SetAddresses([]common.Address{addr})
- filter.SetTopics([][]common.Hash{[]common.Hash{hash3}})
+ filter.SetTopics([][]common.Hash{{hash3}})
filter.SetBeginBlock(900)
filter.SetEndBlock(999)
logs, _ = filter.Find(context.Background())
@@ -235,7 +234,7 @@ func TestFilters(t *testing.T) {
filter = New(backend, true)
filter.SetAddresses([]common.Address{addr})
- filter.SetTopics([][]common.Hash{[]common.Hash{hash3}})
+ filter.SetTopics([][]common.Hash{{hash3}})
filter.SetBeginBlock(990)
filter.SetEndBlock(-1)
logs, _ = filter.Find(context.Background())
@@ -247,7 +246,7 @@ func TestFilters(t *testing.T) {
}
filter = New(backend, true)
- filter.SetTopics([][]common.Hash{[]common.Hash{hash1, hash2}})
+ filter.SetTopics([][]common.Hash{{hash1, hash2}})
filter.SetBeginBlock(1)
filter.SetEndBlock(10)
@@ -258,7 +257,7 @@ func TestFilters(t *testing.T) {
failHash := common.BytesToHash([]byte("fail"))
filter = New(backend, true)
- filter.SetTopics([][]common.Hash{[]common.Hash{failHash}})
+ filter.SetTopics([][]common.Hash{{failHash}})
filter.SetBeginBlock(0)
filter.SetEndBlock(-1)
@@ -279,7 +278,7 @@ func TestFilters(t *testing.T) {
}
filter = New(backend, true)
- filter.SetTopics([][]common.Hash{[]common.Hash{failHash}, []common.Hash{hash1}})
+ filter.SetTopics([][]common.Hash{{failHash}, {hash1}})
filter.SetBeginBlock(0)
filter.SetEndBlock(-1)
diff --git a/eth/handler.go b/eth/handler.go
index 771e69b8d..1de3f67e6 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -607,38 +607,16 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
}
case msg.Code == NewBlockHashesMsg:
- // Retrieve and deserialize the remote new block hashes notification
- type announce struct {
- Hash common.Hash
- Number uint64
- }
- var announces = []announce{}
-
- if p.version < eth62 {
- // We're running the old protocol, make block number unknown (0)
- var hashes []common.Hash
- if err := msg.Decode(&hashes); err != nil {
- return errResp(ErrDecode, "%v: %v", msg, err)
- }
- for _, hash := range hashes {
- announces = append(announces, announce{hash, 0})
- }
- } else {
- // Otherwise extract both block hash and number
- var request newBlockHashesData
- if err := msg.Decode(&request); err != nil {
- return errResp(ErrDecode, "%v: %v", msg, err)
- }
- for _, block := range request {
- announces = append(announces, announce{block.Hash, block.Number})
- }
+ var announces newBlockHashesData
+ if err := msg.Decode(&announces); err != nil {
+ return errResp(ErrDecode, "%v: %v", msg, err)
}
// Mark the hashes as present at the remote node
for _, block := range announces {
p.MarkBlock(block.Hash)
}
// Schedule all the unknown hashes for retrieval
- unknown := make([]announce, 0, len(announces))
+ unknown := make(newBlockHashesData, 0, len(announces))
for _, block := range announces {
if !pm.blockchain.HasBlock(block.Hash) {
unknown = append(unknown, block)
diff --git a/eth/handler_test.go b/eth/handler_test.go
index f599e9e86..22a4ddf50 100644
--- a/eth/handler_test.go
+++ b/eth/handler_test.go
@@ -75,7 +75,7 @@ func testGetBlockHeaders(t *testing.T, protocol int) {
// Create a "random" unknown hash for testing
var unknown common.Hash
- for i, _ := range unknown {
+ for i := range unknown {
unknown[i] = byte(i)
}
// Create a batch of tests for various scenarios
@@ -246,17 +246,17 @@ func testGetBlockBodies(t *testing.T, protocol int) {
{limit + 1, nil, nil, limit}, // No more than the possible block count should be returned
{0, []common.Hash{pm.blockchain.Genesis().Hash()}, []bool{true}, 1}, // The genesis block should be retrievable
{0, []common.Hash{pm.blockchain.CurrentBlock().Hash()}, []bool{true}, 1}, // The chains head block should be retrievable
- {0, []common.Hash{common.Hash{}}, []bool{false}, 0}, // A non existent block should not be returned
+ {0, []common.Hash{{}}, []bool{false}, 0}, // A non existent block should not be returned
// Existing and non-existing blocks interleaved should not cause problems
{0, []common.Hash{
- common.Hash{},
+ {},
pm.blockchain.GetBlockByNumber(1).Hash(),
- common.Hash{},
+ {},
pm.blockchain.GetBlockByNumber(10).Hash(),
- common.Hash{},
+ {},
pm.blockchain.GetBlockByNumber(100).Hash(),
- common.Hash{},
+ {},
}, []bool{false, true, false, true, false, true, false}, 3},
}
// Run each of the tests and verify the results against the chain
@@ -311,13 +311,13 @@ func testGetNodeData(t *testing.T, protocol int) {
switch i {
case 0:
// In block 1, the test bank sends account #1 some ether.
- tx, _ := types.NewTransaction(block.TxNonce(testBank.Address), acc1Addr, big.NewInt(10000), params.TxGas, nil, nil).SignECDSA(signer, testBankKey)
+ tx, _ := types.SignTx(types.NewTransaction(block.TxNonce(testBank.Address), acc1Addr, big.NewInt(10000), params.TxGas, nil, nil), signer, testBankKey)
block.AddTx(tx)
case 1:
// In block 2, the test bank sends some more ether to account #1.
// acc1Addr passes it on to account #2.
- tx1, _ := types.NewTransaction(block.TxNonce(testBank.Address), acc1Addr, big.NewInt(1000), params.TxGas, nil, nil).SignECDSA(signer, testBankKey)
- tx2, _ := types.NewTransaction(block.TxNonce(acc1Addr), acc2Addr, big.NewInt(1000), params.TxGas, nil, nil).SignECDSA(signer, acc1Key)
+ tx1, _ := types.SignTx(types.NewTransaction(block.TxNonce(testBank.Address), acc1Addr, big.NewInt(1000), params.TxGas, nil, nil), signer, testBankKey)
+ tx2, _ := types.SignTx(types.NewTransaction(block.TxNonce(acc1Addr), acc2Addr, big.NewInt(1000), params.TxGas, nil, nil), signer, acc1Key)
block.AddTx(tx1)
block.AddTx(tx2)
case 2:
@@ -403,13 +403,13 @@ func testGetReceipt(t *testing.T, protocol int) {
switch i {
case 0:
// In block 1, the test bank sends account #1 some ether.
- tx, _ := types.NewTransaction(block.TxNonce(testBank.Address), acc1Addr, big.NewInt(10000), params.TxGas, nil, nil).SignECDSA(signer, testBankKey)
+ tx, _ := types.SignTx(types.NewTransaction(block.TxNonce(testBank.Address), acc1Addr, big.NewInt(10000), params.TxGas, nil, nil), signer, testBankKey)
block.AddTx(tx)
case 1:
// In block 2, the test bank sends some more ether to account #1.
// acc1Addr passes it on to account #2.
- tx1, _ := types.NewTransaction(block.TxNonce(testBank.Address), acc1Addr, big.NewInt(1000), params.TxGas, nil, nil).SignECDSA(signer, testBankKey)
- tx2, _ := types.NewTransaction(block.TxNonce(acc1Addr), acc2Addr, big.NewInt(1000), params.TxGas, nil, nil).SignECDSA(signer, acc1Key)
+ tx1, _ := types.SignTx(types.NewTransaction(block.TxNonce(testBank.Address), acc1Addr, big.NewInt(1000), params.TxGas, nil, nil), signer, testBankKey)
+ tx2, _ := types.SignTx(types.NewTransaction(block.TxNonce(acc1Addr), acc2Addr, big.NewInt(1000), params.TxGas, nil, nil), signer, acc1Key)
block.AddTx(tx1)
block.AddTx(tx2)
case 2:
@@ -491,7 +491,7 @@ func testDAOChallenge(t *testing.T, localForked, remoteForked bool, timeout bool
if err := p2p.ExpectMsg(peer.app, GetBlockHeadersMsg, challenge); err != nil {
t.Fatalf("challenge mismatch: %v", err)
}
- // Create a block to reply to the challenge if no timeout is simualted
+ // Create a block to reply to the challenge if no timeout is simulated
if !timeout {
blocks, _ := core.GenerateChain(&params.ChainConfig{}, genesis, db, 1, func(i int, block *core.BlockGen) {
if remoteForked {
diff --git a/eth/helper_test.go b/eth/helper_test.go
index bd6b2d0da..a718a6d21 100644
--- a/eth/helper_test.go
+++ b/eth/helper_test.go
@@ -124,7 +124,7 @@ func (p *testTxPool) Pending() (map[common.Address]types.Transactions, error) {
// newTestTransaction create a new dummy transaction.
func newTestTransaction(from *ecdsa.PrivateKey, nonce uint64, datasize int) *types.Transaction {
tx := types.NewTransaction(nonce, common.Address{}, big.NewInt(0), big.NewInt(100000), big.NewInt(0), make([]byte, datasize))
- tx, _ = tx.SignECDSA(types.HomesteadSigner{}, from)
+ tx, _ = types.SignTx(tx, types.HomesteadSigner{}, from)
return tx
}
diff --git a/eth/protocol_test.go b/eth/protocol_test.go
index 0aac19f43..3b8056433 100644
--- a/eth/protocol_test.go
+++ b/eth/protocol_test.go
@@ -82,7 +82,7 @@ func testStatusMsgErrors(t *testing.T, protocol int) {
t.Errorf("test %d: wrong error: got %q, want %q", i, err, test.wantError)
}
case <-time.After(2 * time.Second):
- t.Errorf("protocol did not shut down withing 2 seconds")
+ t.Errorf("protocol did not shut down within 2 seconds")
}
p.close()
}
@@ -178,7 +178,7 @@ func testSendTransactions(t *testing.T, protocol int) {
func TestGetBlockHeadersDataEncodeDecode(t *testing.T) {
// Create a "random" hash for testing
var hash common.Hash
- for i, _ := range hash {
+ for i := range hash {
hash[i] = byte(i)
}
// Assemble some table driven tests