@@ -3,6 +3,7 @@ package reservation
3
3
import (
4
4
"context"
5
5
"encoding/hex"
6
+ "sync/atomic"
6
7
"testing"
7
8
"time"
8
9
@@ -72,13 +73,14 @@ func TestManager(t *testing.T) {
72
73
require .NoError (t , err )
73
74
74
75
// 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 )
77
79
78
80
go func () {
79
81
// 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 )
82
84
}()
83
85
84
86
// We'll now try to lock the reservation.
@@ -90,7 +92,7 @@ func TestManager(t *testing.T) {
90
92
require .Error (t , err )
91
93
92
94
testContext .mockLnd .SpendChannel <- & chainntnfs.SpendDetail {
93
- SpentOutPoint : spendReg .Outpoint ,
95
+ SpentOutPoint : spendReg .Load (). Outpoint ,
94
96
}
95
97
96
98
// We'll now expect the reservation to be expired.
0 commit comments