X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-persister%2Fsrc%2Ffs_store.rs;h=6725e16974b8f3dd1b781af12e819e95db2931cc;hb=6e115db22b1e1f89f62c958af1300ec0a47ef27a;hp=56d071da9f0b86ad4cf3571b9e64e8dc3c950e0e;hpb=448b191fec4c6d1e9638c82aade7385b1516aa5d;p=rust-lightning diff --git a/lightning-persister/src/fs_store.rs b/lightning-persister/src/fs_store.rs index 56d071da..6725e169 100644 --- a/lightning-persister/src/fs_store.rs +++ b/lightning-persister/src/fs_store.rs @@ -26,7 +26,7 @@ macro_rules! call { } #[cfg(target_os = "windows")] -fn path_to_windows_str>(path: T) -> Vec { +fn path_to_windows_str>(path: &T) -> Vec { path.as_ref().encode_wide().chain(Some(0)).collect() } @@ -164,8 +164,8 @@ impl KVStore for FilesystemStore { let res = if dest_file_path.exists() { call!(unsafe { windows_sys::Win32::Storage::FileSystem::ReplaceFileW( - path_to_windows_str(dest_file_path.clone()).as_ptr(), - path_to_windows_str(tmp_file_path).as_ptr(), + path_to_windows_str(&dest_file_path).as_ptr(), + path_to_windows_str(&tmp_file_path).as_ptr(), std::ptr::null(), windows_sys::Win32::Storage::FileSystem::REPLACEFILE_IGNORE_MERGE_ERRORS, std::ptr::null_mut() as *const core::ffi::c_void, @@ -175,8 +175,8 @@ impl KVStore for FilesystemStore { } else { call!(unsafe { windows_sys::Win32::Storage::FileSystem::MoveFileExW( - path_to_windows_str(tmp_file_path).as_ptr(), - path_to_windows_str(dest_file_path.clone()).as_ptr(), + path_to_windows_str(&tmp_file_path).as_ptr(), + path_to_windows_str(&dest_file_path).as_ptr(), windows_sys::Win32::Storage::FileSystem::MOVEFILE_WRITE_THROUGH | windows_sys::Win32::Storage::FileSystem::MOVEFILE_REPLACE_EXISTING, ) @@ -263,8 +263,8 @@ impl KVStore for FilesystemStore { call!(unsafe { windows_sys::Win32::Storage::FileSystem::MoveFileExW( - path_to_windows_str(dest_file_path).as_ptr(), - path_to_windows_str(trash_file_path.clone()).as_ptr(), + path_to_windows_str(&dest_file_path).as_ptr(), + path_to_windows_str(&trash_file_path).as_ptr(), windows_sys::Win32::Storage::FileSystem::MOVEFILE_WRITE_THROUGH | windows_sys::Win32::Storage::FileSystem::MOVEFILE_REPLACE_EXISTING, ) @@ -436,7 +436,7 @@ mod tests { } // Test that if the store's path to channel data is read-only, writing a - // monitor to it results in the store returning a PermanentFailure. + // monitor to it results in the store returning an InProgress. // Windows ignores the read-only flag for folders, so this test is Unix-only. #[cfg(not(target_os = "windows"))] #[test] @@ -470,7 +470,7 @@ mod tests { index: 0 }; match store.persist_new_channel(test_txo, &added_monitors[0].1, update_id.2) { - ChannelMonitorUpdateStatus::PermanentFailure => {}, + ChannelMonitorUpdateStatus::InProgress => {}, _ => panic!("unexpected result from persisting new channel") } @@ -507,7 +507,7 @@ mod tests { index: 0 }; match store.persist_new_channel(test_txo, &added_monitors[0].1, update_id.2) { - ChannelMonitorUpdateStatus::PermanentFailure => {}, + ChannelMonitorUpdateStatus::InProgress => {}, _ => panic!("unexpected result from persisting new channel") }