Merge #777: installer: start new bitcoind download if not finished previously

bdd16c73bcae64e17931bd62d70f4d85b9a6af9a installer: start new bitcoind download if not finished (jp1ac4)

Pull request description:

  In case the user clicks on "Previous" before the bitcoind download has finished, this PR will clear the incomplete download (or a download that completed with errors) from `InternalBitcoindStep`.

  If the user then returns to this step, either a new download will start or the finished download will be available still. This fixes a bug following #746 for users that already have bitcoind v25.0 installed. If they click "Previous" while downloading 25.1, then upon returning to this step, the existing 25.0 bitcoind will be started.

ACKs for top commit:
  darosior:
    ACK bdd16c73bcae64e17931bd62d70f4d85b9a6af9a -- code makes sense to me and Kevin tested it fixed (one of) the bug he reported.

Tree-SHA512: d1f39b1ee2b1f6fa15533f6c7880dc0e3edc9e7052be8ff315d77232eab9e74f8178252979c14cd8ccac8f164176cbe03a18faf523c969d841d11d6721b18fe1
This commit is contained in:
Antoine Poinsot 2023-11-02 13:05:54 +01:00
commit 7c0c7351b9
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -658,6 +658,13 @@ impl Step for InternalBitcoindStep {
bitcoind.stop();
}
self.internal_bitcoind = None;
if let Some(download) = self.exe_download.as_ref() {
// Clear exe_download if not Finished.
if let DownloadState::Finished { .. } = download.state {
} else {
self.exe_download = None;
}
}
self.started = None; // clear both Ok and Err
return Command::perform(async {}, |_| Message::Previous);
}