contractcourt: fix concurrent access to resolved

This commit makes `resolved` an atomic bool to avoid data race. This
field is now defined in `contractResolverKit` to avoid code duplication.
This commit is contained in:
yyforyongyu
2024-07-10 18:08:23 +08:00
parent 47722292c5
commit 4f5ccb8650
11 changed files with 111 additions and 129 deletions

View File

@@ -616,11 +616,11 @@ func runFromCheckpoint(t *testing.T, ctx *htlcResolverTestContext,
var resolved, incubating bool
if h, ok := resolver.(*htlcSuccessResolver); ok {
resolved = h.resolved
resolved = h.resolved.Load()
incubating = h.outputIncubating
}
if h, ok := resolver.(*htlcTimeoutResolver); ok {
resolved = h.resolved
resolved = h.resolved.Load()
incubating = h.outputIncubating
}