graph: updated builder to use atomic ints

Instead of relying on devs to remember that they must only be accessed
atomically.
This commit is contained in:
Elle Mouton committed 2024-07-15 15:56:33 +02:00
1 parent fe34d62eb1
commit 90dff730ce
3 files changed
+12 -16

No files matched your search

+2 -5
View File
@@ -11,7 +11,6 @@ import (
"net"
"os"
"strings"
"sync/atomic"
"testing"
"time"
@@ -1392,12 +1391,10 @@ func TestBlockDifferenceFix(t *testing.T) {
err := wait.NoError(func() error {
// Then router height should be updated to the latest block.
if atomic.LoadUint32(&ctx.builder.bestHeight) !=
newBlockHeight {
if ctx.builder.bestHeight.Load() != newBlockHeight {
return fmt.Errorf("height should have been updated "+
"to %v, instead got %v", newBlockHeight,
ctx.builder.bestHeight)
ctx.builder.bestHeight.Load())
}
return nil