Skip to content

Commit

Permalink
try fix data race
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianElvis committed Jan 31, 2025
1 parent af9976f commit 5676080
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion finality-provider/service/fp_store_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ func (fps *fpState) setLastVotedHeight(height uint64) error {
}

func (fp *FinalityProviderInstance) GetStoreFinalityProvider() *store.StoredFinalityProvider {
return fp.fpState.sfp
var sfp *store.StoredFinalityProvider
fp.fpState.withLock(func() {
// Create a copy of the stored finality provider to prevent data races
sfpCopy := *fp.fpState.sfp
sfp = &sfpCopy
})
return sfp

Check failure on line 60 in finality-provider/service/fp_store_adapter.go

View workflow job for this annotation

GitHub Actions / lint_test / lint

return with no blank line before (nlreturn)
}

func (fp *FinalityProviderInstance) GetBtcPkBIP340() *bbntypes.BIP340PubKey {
Expand Down

0 comments on commit 5676080

Please sign in to comment.