File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 6
6
"encoding/json"
7
7
"errors"
8
8
"math"
9
+ "sync"
9
10
"testing"
10
11
"time"
11
12
@@ -22,7 +23,8 @@ type DummyHeader struct {
22
23
HeightI uint64
23
24
Timestamp time.Time
24
25
25
- hash header.Hash
26
+ hashMu sync.Mutex
27
+ hash header.Hash
26
28
27
29
// VerifyFailure allows for testing scenarios where a header would fail
28
30
// verification. When set to true, it forces a failure.
@@ -63,6 +65,8 @@ func (d *DummyHeader) ChainID() string {
63
65
}
64
66
65
67
func (d * DummyHeader ) Hash () header.Hash {
68
+ d .hashMu .Lock ()
69
+ defer d .hashMu .Unlock ()
66
70
if len (d .hash ) == 0 {
67
71
if err := d .rehash (); err != nil {
68
72
panic (err )
Original file line number Diff line number Diff line change @@ -387,7 +387,7 @@ func TestStoreGetByHeight_whenGaps(t *testing.T) {
387
387
388
388
head , err := store .GetByHeight (ctx , wantLastHead .Height ())
389
389
require .NoError (t , err )
390
- require .Equal (t , head , wantLastHead )
390
+ require .Equal (t , head . Hash () , wantLastHead . Hash () )
391
391
default :
392
392
t .Fatal ("store.GetByHeight on last height MUST NOT be blocked" )
393
393
}
You can’t perform that action at this time.
0 commit comments