diff --git a/ethereum/stat/stat_recorder_test.go b/ethereum/stat/stat_recorder_test.go index a57a1fa..cf9808c 100644 --- a/ethereum/stat/stat_recorder_test.go +++ b/ethereum/stat/stat_recorder_test.go @@ -10,8 +10,8 @@ import ( "time" ) -var rig *ethereum.Rig = ethereum.NewRig("testrig") -var rig2 *ethereum.Rig = ethereum.NewRig("anotherrig") +var rig *ethereum.Rig = ethereum.NewRig("testrig", "192.168.1.2") +var rig2 *ethereum.Rig = ethereum.NewRig("anotherrig", "192.168.1.3") func newStatRecorder() *StatRecorder { return &StatRecorder{ diff --git a/protocol/test_rig.go b/protocol/test_rig.go index aa62f13..f30997c 100644 --- a/protocol/test_rig.go +++ b/protocol/test_rig.go @@ -6,3 +6,7 @@ type testRig struct { func (r *testRig) ID() string { return "rig" } + +func (r *testRig) IP() string { + return "127.0.0.1" +} diff --git a/run_test.sh b/run_test.sh index b73a530..91d4a3f 100755 --- a/run_test.sh +++ b/run_test.sh @@ -1 +1 @@ -build/env.sh go test -ldflags -s `go list ./... | grep -v vendor | grep -v experiment` +build/env.sh go test -ldflags -s `go list ./... | grep -v vendor | grep -v experiment | grep -v ethash` diff --git a/storage/gob_file_storage.go b/storage/gob_file_storage.go index 81ef9d7..0973e28 100644 --- a/storage/gob_file_storage.go +++ b/storage/gob_file_storage.go @@ -77,8 +77,6 @@ func getName(value interface{}) string { } func (gfs *GobFileStorage) register(value interface{}) { - gfs.mu.Lock() - defer gfs.mu.Unlock() name := getName(value) if _, found := gfs.registeredType[name]; !found { gob.Register(value) @@ -102,6 +100,8 @@ func (gfs *GobFileStorage) persistToFile(data interface{}, id string) error { } func (gfs *GobFileStorage) Persist(data interface{}, id string) error { + gfs.mu.Lock() + defer gfs.mu.Unlock() if err := gfs.persistToFile(data, id); err != nil { return err } @@ -109,6 +109,8 @@ func (gfs *GobFileStorage) Persist(data interface{}, id string) error { } func (gfs *GobFileStorage) Load(data interface{}, id string) (interface{}, error) { + gfs.mu.Lock() + defer gfs.mu.Unlock() f, err := os.Open(getFile(id)) if err != nil { return data, err