Close() temp files before renaming them.
Fixes syncing dirty wallet files on Windows.
This commit is contained in:
parent
9983a0a92a
commit
4b7f858bee
1 changed files with 3 additions and 0 deletions
|
@ -48,6 +48,7 @@ func (w *BtcWallet) writeDirtyToDisk() error {
|
|||
if _, err = w.WriteTo(tmpfile); err != nil {
|
||||
return err
|
||||
}
|
||||
tmpfile.Close()
|
||||
|
||||
// TODO(jrick): this should be atomic on *nix, but is not on
|
||||
// Windows. Use _windows.go to provide atomic renames.
|
||||
|
@ -70,6 +71,7 @@ func (w *BtcWallet) writeDirtyToDisk() error {
|
|||
if _, err = w.TxStore.s.WriteTo(tmpfile); err != nil {
|
||||
return err
|
||||
}
|
||||
tmpfile.Close()
|
||||
|
||||
// TODO(jrick): this should be atomic on *nix, but is not on
|
||||
// Windows. Use _windows.go to provide atomic renames.
|
||||
|
@ -92,6 +94,7 @@ func (w *BtcWallet) writeDirtyToDisk() error {
|
|||
if _, err = w.UtxoStore.s.WriteTo(tmpfile); err != nil {
|
||||
return err
|
||||
}
|
||||
tmpfile.Close()
|
||||
|
||||
// TODO(jrick): this should be atomic on *nix, but is not on
|
||||
// Windows. Use _windows.go to provide atomic renames.
|
||||
|
|
Loading…
Add table
Reference in a new issue