eth: skip transaction handling during fast sync

This commit is contained in:
Péter Szilágyi
2016-05-17 14:17:20 +03:00
parent adc1b50395
commit d87f7a1e81
3 changed files with 23 additions and 14 deletions

View File

@ -17,6 +17,7 @@
package eth
import (
"sync/atomic"
"testing"
"time"
@ -29,12 +30,12 @@ import (
func TestFastSyncDisabling(t *testing.T) {
// Create a pristine protocol manager, check that fast sync is left enabled
pmEmpty := newTestProtocolManagerMust(t, true, 0, nil, nil)
if !pmEmpty.fastSync {
if atomic.LoadUint32(&pmEmpty.fastSync) == 0 {
t.Fatalf("fast sync disabled on pristine blockchain")
}
// Create a full protocol manager, check that fast sync gets disabled
pmFull := newTestProtocolManagerMust(t, true, 1024, nil, nil)
if pmFull.fastSync {
if atomic.LoadUint32(&pmFull.fastSync) == 1 {
t.Fatalf("fast sync not disabled on non-empty blockchain")
}
// Sync up the two peers
@ -47,7 +48,7 @@ func TestFastSyncDisabling(t *testing.T) {
pmEmpty.synchronise(pmEmpty.peers.BestPeer())
// Check that fast sync was disabled
if pmEmpty.fastSync {
if atomic.LoadUint32(&pmEmpty.fastSync) == 1 {
t.Fatalf("fast sync not disabled after successful synchronisation")
}
}