@@ -3,6 +3,7 @@ package reservation
33import (
44 "context"
55 "encoding/hex"
6+ "sync/atomic"
67 "testing"
78 "time"
89
@@ -72,13 +73,14 @@ func TestManager(t *testing.T) {
7273 require .NoError (t , err )
7374
7475 // We'll now expect a spend registration.
75- spendReg := <- testContext .mockLnd .RegisterSpendChannel
76- require .Equal (t , spendReg .PkScript , pkScript )
76+ var spendReg atomic.Pointer [test.SpendRegistration ]
77+ spendReg .Store (<- testContext .mockLnd .RegisterSpendChannel )
78+ require .Equal (t , spendReg .Load ().PkScript , pkScript )
7779
7880 go func () {
7981 // We'll expect a second spend registration.
80- spendReg = <- testContext .mockLnd .RegisterSpendChannel
81- require .Equal (t , spendReg .PkScript , pkScript )
82+ spendReg . Store ( <- testContext .mockLnd .RegisterSpendChannel )
83+ require .Equal (t , spendReg .Load (). PkScript , pkScript )
8284 }()
8385
8486 // We'll now try to lock the reservation.
@@ -90,7 +92,7 @@ func TestManager(t *testing.T) {
9092 require .Error (t , err )
9193
9294 testContext .mockLnd .SpendChannel <- & chainntnfs.SpendDetail {
93- SpentOutPoint : spendReg .Outpoint ,
95+ SpentOutPoint : spendReg .Load (). Outpoint ,
9496 }
9597
9698 // We'll now expect the reservation to be expired.
0 commit comments