minor fix

This commit is contained in:
Alfonso de la Rocha 2023-03-16 17:17:59 +01:00
parent 8d260d7478
commit 90c2f9dbe2
No known key found for this signature in database
GPG Key ID: B7BEF4B895F2B535
2 changed files with 5 additions and 5 deletions

View File

@ -40,7 +40,7 @@ type bcastDict struct {
} }
func (bd *bcastDict) load(key []byte) (*blksInfo, bool) { func (bd *bcastDict) load(key []byte) (*blksInfo, bool) {
v, ok := bd.m.Load(key) v, ok := bd.m.Load(string(key))
if !ok { if !ok {
return nil, ok return nil, ok
} }
@ -48,11 +48,11 @@ func (bd *bcastDict) load(key []byte) (*blksInfo, bool) {
} }
func (bd *bcastDict) store(key []byte, d *blksInfo) { func (bd *bcastDict) store(key []byte, d *blksInfo) {
bd.m.Store(key, d) bd.m.Store(string(key), d)
} }
func (bd *bcastDict) blkLen(key []byte) int { func (bd *bcastDict) blkLen(key []byte) int {
v, ok := bd.m.Load(key) v, ok := bd.m.Load(string(key))
if !ok { if !ok {
return 0 return 0
} }

View File

@ -61,7 +61,7 @@ func testSimpleDelivery(t *testing.T, cb *bcast.ConsistentBCast, epoch abi.Chain
func TestSeveralEpochs(t *testing.T) { func TestSeveralEpochs(t *testing.T) {
cb := bcast.NewConsistentBCast(TEST_DELAY) cb := bcast.NewConsistentBCast(TEST_DELAY)
numEpochs := 5 numEpochs := 6
wg := new(sync.WaitGroup) wg := new(sync.WaitGroup)
wg.Add(numEpochs) wg.Add(numEpochs)
for i := 0; i < numEpochs; i++ { for i := 0; i < numEpochs; i++ {
@ -83,7 +83,7 @@ func TestSeveralEpochs(t *testing.T) {
}(i) }(i)
} }
wg.Wait() wg.Wait()
require.Equal(t, cb.Len(), bcast.GcLookback) require.Equal(t, cb.Len(), numEpochs)
} }
// bias is expected to be 0-1 // bias is expected to be 0-1