mirror of
https://github.com/btcsuite/btcd.git
synced 2025-02-23 06:35:20 +01:00
ffldb: close block files before deleting them
The block files may be open when deleteFile is called. This resulted in files not being deleted and erroring out on windows. Properly closing the files closing the files avoids this error.
This commit is contained in:
parent
8ed8ef1340
commit
c9fae1ac7c
1 changed files with 3 additions and 0 deletions
|
@ -1630,6 +1630,9 @@ func (tx *transaction) writePendingAndCommit() error {
|
|||
// We do this first before doing any of the writes as we can't undo
|
||||
// deletions of files.
|
||||
for _, fileNum := range tx.pendingDelFileNums {
|
||||
// Make sure the file is closed before attempting to delete it.
|
||||
tx.db.store.closeFile(fileNum)
|
||||
|
||||
err := tx.db.store.deleteFileFunc(fileNum)
|
||||
if err != nil {
|
||||
// Nothing we can do if we fail to delete blocks besides
|
||||
|
|
Loading…
Add table
Reference in a new issue