Skip to content

Commit 0561744

Browse files
author
Baptiste Boussemart
committed
resolve remaining conflicts
1 parent 6007b12 commit 0561744

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

cmd/devp2p/internal/ethtest/chain.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ type Chain struct {
2222
chainConfig *params.ChainConfig
2323
}
2424

25-
func (c *Chain) WriteTo(writer io.Writer) error {
25+
func (c *Chain) WriteTo(writer io.Writer) (int64, error) {
2626
for _, block := range c.blocks {
2727
if err := rlp.Encode(writer, block); err != nil {
28-
return err
28+
return 0, err
2929
}
3030
}
3131

32-
return nil
32+
return 0, nil // TODO(bbo): size
3333
}
3434

3535
// Len returns the length of the chain.

eth/downloader/downloader.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,7 +2079,7 @@ func (d *Downloader) syncWithPeerUntil(p *peerConnection, hash common.Hash, td *
20792079
if localHeight == 0 && frozen > 0 {
20802080
// statedb was removed and is being recovered now
20812081
// we trust the peer height and sync upto that
2082-
remoteHeader, err = d.fetchHeight(p)
2082+
remoteHeader, _, err = d.fetchHead(p) // #21529
20832083
} else {
20842084
remoteHeader, err = d.fetchHeader(p, hash)
20852085
}
@@ -2101,13 +2101,11 @@ func (d *Downloader) syncWithPeerUntil(p *peerConnection, hash common.Hash, td *
21012101
d.syncInitHook(localHeight, remoteHeight)
21022102
}
21032103

2104-
pivot := uint64(0)
2105-
21062104
fetchers := []func() error{
21072105
func() error { return d.fetchBoundedHeaders(p, localHeight+1, remoteHeight) },
21082106
func() error { return d.fetchBodies(localHeight + 1) },
2109-
func() error { return d.fetchReceipts(localHeight + 1) }, // Receipts are only retrieved during fast sync
2110-
func() error { return d.processHeaders(localHeight+1, pivot, td) },
2107+
func() error { return d.fetchReceipts(localHeight + 1) }, // Receipts are only retrieved during fast sync
2108+
func() error { return d.processHeaders(localHeight+1, td) }, // #21529
21112109
d.processFullSyncContent, //This must be added to clear the buffer of downloaded content as it's being filled
21122110
}
21132111
return d.spawnSync(fetchers)

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ require (
3131
github.com/dlclark/regexp2 v1.2.0 // indirect
3232
github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf
3333
github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498
34-
github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813 // indirect
3534
github.com/eapache/channels v1.1.0
3635
github.com/eapache/queue v1.1.0 // indirect
3736
github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c
@@ -85,7 +84,6 @@ require (
8584
github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208
8685
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
8786
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
88-
golang.org/x/mobile v0.0.0-20200801112145-973feb4309de // indirect
8987
golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect
9088
golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8
9189
golang.org/x/text v0.3.3

miner/miner_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ import (
2424
"github.com/ethereum/go-ethereum/common"
2525
"github.com/ethereum/go-ethereum/consensus/ethash"
2626
"github.com/ethereum/go-ethereum/core"
27+
"github.com/ethereum/go-ethereum/core/mps"
2728
"github.com/ethereum/go-ethereum/core/rawdb"
2829
"github.com/ethereum/go-ethereum/core/state"
2930
"github.com/ethereum/go-ethereum/core/types"
3031
"github.com/ethereum/go-ethereum/core/vm"
3132
"github.com/ethereum/go-ethereum/eth/downloader"
33+
"github.com/ethereum/go-ethereum/ethdb"
3234
"github.com/ethereum/go-ethereum/ethdb/memorydb"
3335
"github.com/ethereum/go-ethereum/event"
3436
"github.com/ethereum/go-ethereum/params"
@@ -38,8 +40,11 @@ import (
3840
type mockBackend struct {
3941
bc *core.BlockChain
4042
txPool *core.TxPool
43+
db ethdb.Database
4144
}
4245

46+
var _ Backend = &mockBackend{} // check implementation
47+
4348
func NewMockBackend(bc *core.BlockChain, txPool *core.TxPool) *mockBackend {
4449
return &mockBackend{
4550
bc: bc,
@@ -55,8 +60,13 @@ func (m *mockBackend) TxPool() *core.TxPool {
5560
return m.txPool
5661
}
5762

63+
func (m *mockBackend) ChainDb() ethdb.Database {
64+
return m.db
65+
}
66+
5867
type testBlockChain struct {
59-
statedb *state.StateDB
68+
statedb *state.StateDB
69+
6070
gasLimit uint64
6171
chainHeadFeed *event.Feed
6272
}
@@ -71,8 +81,8 @@ func (bc *testBlockChain) GetBlock(hash common.Hash, number uint64) *types.Block
7181
return bc.CurrentBlock()
7282
}
7383

74-
func (bc *testBlockChain) StateAt(common.Hash) (*state.StateDB, error) {
75-
return bc.statedb, nil
84+
func (bc *testBlockChain) StateAt(common.Hash) (*state.StateDB, mps.PrivateStateRepository, error) {
85+
return bc.statedb, nil, nil
7686
}
7787

7888
func (bc *testBlockChain) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription {

p2p/server_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import (
3838
"github.com/ethereum/go-ethereum/p2p/rlpx"
3939
"github.com/ethereum/go-ethereum/params"
4040
"github.com/stretchr/testify/assert"
41-
"golang.org/x/crypto/sha3"
4241
)
4342

4443
type testTransport struct {
@@ -471,7 +470,7 @@ func TestServerSetupConn_whenNotInRaftCluster(t *testing.T) {
471470
PrivateKey: srvkey,
472471
NoDiscovery: true,
473472
},
474-
newTransport: func(fd net.Conn) transport { return newTestTransport(clientpub, fd) },
473+
newTransport: func(fd net.Conn, key *ecdsa.PublicKey) transport { return newTestTransport(clientpub, fd, key) },
475474
log: log.New(),
476475
checkPeerInRaft: func(node *enode.Node) bool {
477476
return false
@@ -511,7 +510,7 @@ func TestServerSetupConn_whenNotPermissioned(t *testing.T) {
511510
DataDir: tmpDir,
512511
EnableNodePermission: true,
513512
},
514-
newTransport: func(fd net.Conn) transport { return newTestTransport(clientpub, fd) },
513+
newTransport: func(fd net.Conn, key *ecdsa.PublicKey) transport { return newTestTransport(clientpub, fd, key) },
515514
log: log.New(),
516515
}
517516
if err := srv.Start(); err != nil {

0 commit comments

Comments
 (0)