Skip to content

[MINOR] Fix race in managedSyncRevision

MERGE REQUEST

MR Guidelines

Overview

By changing

c.header.Transaction.FileContractRevisions[0] = rev to c.header.Transaction.FileContractRevisions = []types.FileContractRevision{rev}

this fixes a race that happens when handing out the c.header and reading c.header.Transaction.FileContractRevision[0]. That's because assigning to the index doesn't change the slice. So a copy of the header would point to the same slice in memory that is being modified. By assigning a completely new slice, we guarantee that doesn't happen.

Checklist

Review and complete the checklist to ensure that the MR is complete before assigned to an approver.

  • All new methods or updated methods have clear docstrings
  • Testing added or updated for new methods
  • Any new packages are added to Makefile and .gitlab-ci.yml
  • API documentation updated for API updates
  • Module README.md updated for changes to workflow
  • Issue added to Sia-UI repo for new supporting features
  • Changelog File Created

Issues Closed

Edited by Christopher Schinnerl

Merge request reports