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:
11 files changed
+111
-129
No files matched your search
@@ -82,7 +82,7 @@ func (h *htlcOutgoingContestResolver) Launch() error {
|
||||
func (h *htlcOutgoingContestResolver) Resolve() (ContractResolver, error) {
|
||||
// If we're already full resolved, then we don't have anything further
|
||||
// to do.
|
||||
if h.resolved {
|
||||
if h.IsResolved() {
|
||||
h.log.Errorf("already resolved")
|
||||
return nil, nil
|
||||
}
|
||||
@@ -215,14 +215,6 @@ func (h *htlcOutgoingContestResolver) Stop() {
|
||||
close(h.quit)
|
||||
}
|
||||
|
||||
// IsResolved returns true if the stored state in the resolve is fully
|
||||
// resolved. In this case the target output can be forgotten.
|
||||
//
|
||||
// NOTE: Part of the ContractResolver interface.
|
||||
func (h *htlcOutgoingContestResolver) IsResolved() bool {
|
||||
return h.resolved
|
||||
}
|
||||
|
||||
// Encode writes an encoded version of the ContractResolver into the passed
|
||||
// Writer.
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user