eth, les: drop support for eth/64, fix eth/66 tests
This commit is contained in:
@ -80,8 +80,8 @@ func (h *testEthHandler) Handle(peer *eth.Peer, packet eth.Packet) error {
|
||||
|
||||
// Tests that peers are correctly accepted (or rejected) based on the advertised
|
||||
// fork IDs in the protocol handshake.
|
||||
func TestForkIDSplit64(t *testing.T) { testForkIDSplit(t, 64) }
|
||||
func TestForkIDSplit65(t *testing.T) { testForkIDSplit(t, 65) }
|
||||
func TestForkIDSplit65(t *testing.T) { testForkIDSplit(t, eth.ETH65) }
|
||||
func TestForkIDSplit66(t *testing.T) { testForkIDSplit(t, eth.ETH66) }
|
||||
|
||||
func testForkIDSplit(t *testing.T, protocol uint) {
|
||||
t.Parallel()
|
||||
@ -236,8 +236,8 @@ func testForkIDSplit(t *testing.T, protocol uint) {
|
||||
}
|
||||
|
||||
// Tests that received transactions are added to the local pool.
|
||||
func TestRecvTransactions64(t *testing.T) { testRecvTransactions(t, 64) }
|
||||
func TestRecvTransactions65(t *testing.T) { testRecvTransactions(t, 65) }
|
||||
func TestRecvTransactions65(t *testing.T) { testRecvTransactions(t, eth.ETH65) }
|
||||
func TestRecvTransactions66(t *testing.T) { testRecvTransactions(t, eth.ETH66) }
|
||||
|
||||
func testRecvTransactions(t *testing.T, protocol uint) {
|
||||
t.Parallel()
|
||||
@ -294,8 +294,8 @@ func testRecvTransactions(t *testing.T, protocol uint) {
|
||||
}
|
||||
|
||||
// This test checks that pending transactions are sent.
|
||||
func TestSendTransactions64(t *testing.T) { testSendTransactions(t, 64) }
|
||||
func TestSendTransactions65(t *testing.T) { testSendTransactions(t, 65) }
|
||||
func TestSendTransactions65(t *testing.T) { testSendTransactions(t, eth.ETH65) }
|
||||
func TestSendTransactions66(t *testing.T) { testSendTransactions(t, eth.ETH66) }
|
||||
|
||||
func testSendTransactions(t *testing.T, protocol uint) {
|
||||
t.Parallel()
|
||||
@ -354,19 +354,7 @@ func testSendTransactions(t *testing.T, protocol uint) {
|
||||
seen := make(map[common.Hash]struct{})
|
||||
for len(seen) < len(insert) {
|
||||
switch protocol {
|
||||
case 63, 64:
|
||||
select {
|
||||
case <-anns:
|
||||
t.Errorf("tx announce received on pre eth/65")
|
||||
case txs := <-bcasts:
|
||||
for _, tx := range txs {
|
||||
if _, ok := seen[tx.Hash()]; ok {
|
||||
t.Errorf("duplicate transaction announced: %x", tx.Hash())
|
||||
}
|
||||
seen[tx.Hash()] = struct{}{}
|
||||
}
|
||||
}
|
||||
case 65:
|
||||
case 65, 66:
|
||||
select {
|
||||
case hashes := <-anns:
|
||||
for _, hash := range hashes {
|
||||
@ -392,8 +380,8 @@ func testSendTransactions(t *testing.T, protocol uint) {
|
||||
|
||||
// Tests that transactions get propagated to all attached peers, either via direct
|
||||
// broadcasts or via announcements/retrievals.
|
||||
func TestTransactionPropagation64(t *testing.T) { testTransactionPropagation(t, 64) }
|
||||
func TestTransactionPropagation65(t *testing.T) { testTransactionPropagation(t, 65) }
|
||||
func TestTransactionPropagation65(t *testing.T) { testTransactionPropagation(t, eth.ETH65) }
|
||||
func TestTransactionPropagation66(t *testing.T) { testTransactionPropagation(t, eth.ETH66) }
|
||||
|
||||
func testTransactionPropagation(t *testing.T, protocol uint) {
|
||||
t.Parallel()
|
||||
@ -530,8 +518,8 @@ func testCheckpointChallenge(t *testing.T, syncmode downloader.SyncMode, checkpo
|
||||
defer p2pLocal.Close()
|
||||
defer p2pRemote.Close()
|
||||
|
||||
local := eth.NewPeer(eth.ETH64, p2p.NewPeer(enode.ID{1}, "", nil), p2pLocal, handler.txpool)
|
||||
remote := eth.NewPeer(eth.ETH64, p2p.NewPeer(enode.ID{2}, "", nil), p2pRemote, handler.txpool)
|
||||
local := eth.NewPeer(eth.ETH65, p2p.NewPeer(enode.ID{1}, "", nil), p2pLocal, handler.txpool)
|
||||
remote := eth.NewPeer(eth.ETH65, p2p.NewPeer(enode.ID{2}, "", nil), p2pRemote, handler.txpool)
|
||||
defer local.Close()
|
||||
defer remote.Close()
|
||||
|
||||
@ -620,8 +608,8 @@ func testBroadcastBlock(t *testing.T, peers, bcasts int) {
|
||||
defer sourcePipe.Close()
|
||||
defer sinkPipe.Close()
|
||||
|
||||
sourcePeer := eth.NewPeer(eth.ETH64, p2p.NewPeer(enode.ID{byte(i)}, "", nil), sourcePipe, nil)
|
||||
sinkPeer := eth.NewPeer(eth.ETH64, p2p.NewPeer(enode.ID{0}, "", nil), sinkPipe, nil)
|
||||
sourcePeer := eth.NewPeer(eth.ETH65, p2p.NewPeer(enode.ID{byte(i)}, "", nil), sourcePipe, nil)
|
||||
sinkPeer := eth.NewPeer(eth.ETH65, p2p.NewPeer(enode.ID{0}, "", nil), sinkPipe, nil)
|
||||
defer sourcePeer.Close()
|
||||
defer sinkPeer.Close()
|
||||
|
||||
@ -672,8 +660,8 @@ func testBroadcastBlock(t *testing.T, peers, bcasts int) {
|
||||
|
||||
// Tests that a propagated malformed block (uncles or transactions don't match
|
||||
// with the hashes in the header) gets discarded and not broadcast forward.
|
||||
func TestBroadcastMalformedBlock64(t *testing.T) { testBroadcastMalformedBlock(t, 64) }
|
||||
func TestBroadcastMalformedBlock65(t *testing.T) { testBroadcastMalformedBlock(t, 65) }
|
||||
func TestBroadcastMalformedBlock65(t *testing.T) { testBroadcastMalformedBlock(t, eth.ETH65) }
|
||||
func TestBroadcastMalformedBlock66(t *testing.T) { testBroadcastMalformedBlock(t, eth.ETH66) }
|
||||
|
||||
func testBroadcastMalformedBlock(t *testing.T, protocol uint) {
|
||||
t.Parallel()
|
||||
|
Reference in New Issue
Block a user