mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-18 13:22:42 +01:00
Wallet: remove references to deprecated autosaveToFile()
This commit is contained in:
parent
c43ef27167
commit
cef8b77e47
@ -178,7 +178,7 @@ import static org.bitcoinj.base.internal.Preconditions.checkState;
|
||||
* auto-save feature that simplifies this for you although you're still responsible for manually triggering a save when
|
||||
* your app is about to quit because the auto-save feature waits a moment before actually committing to disk to avoid IO
|
||||
* thrashing when the wallet is changing very fast (e.g. due to a block chain sync). See
|
||||
* {@link Wallet#autosaveToFile(File, long, TimeUnit, WalletFiles.Listener)}
|
||||
* {@link Wallet#autosaveToFile(File, Duration, WalletFiles.Listener)}
|
||||
* for more information about this.</p>
|
||||
*/
|
||||
public class Wallet extends BaseTaggableObject
|
||||
@ -1051,7 +1051,7 @@ public class Wallet extends BaseTaggableObject
|
||||
|
||||
/**
|
||||
* Imports the given keys to the wallet.
|
||||
* If {@link Wallet#autosaveToFile(File, long, TimeUnit, WalletFiles.Listener)}
|
||||
* If {@link Wallet#autosaveToFile(File, Duration, WalletFiles.Listener)}
|
||||
* has been called, triggers an auto save bypassing the normal coalescing delay and event handlers.
|
||||
* Returns the number of keys added, after duplicates are ignored. The onKeyAdded event will be called for each key
|
||||
* in the list that was not already present.
|
||||
@ -1834,7 +1834,7 @@ public class Wallet extends BaseTaggableObject
|
||||
* In this way disk IO can be rate limited. It's a good idea to set this as otherwise the wallet can change very
|
||||
* frequently, e.g. if there are a lot of transactions in it or during block sync, and there will be a lot of redundant
|
||||
* writes. Note that when a new key is added, that always results in an immediate save regardless of
|
||||
* delayTime. <b>You should still save the wallet manually using {@link Wallet#saveToFile(File)} when your program
|
||||
* delay. <b>You should still save the wallet manually using {@link Wallet#saveToFile(File)} when your program
|
||||
* is about to shut down as the JVM will not wait for the background thread.</b></p>
|
||||
*
|
||||
* <p>An event listener can be provided. It will be called on a background thread
|
||||
@ -1868,7 +1868,7 @@ public class Wallet extends BaseTaggableObject
|
||||
/**
|
||||
* <p>
|
||||
* Disables auto-saving, after it had been enabled with
|
||||
* {@link Wallet#autosaveToFile(File, long, TimeUnit, WalletFiles.Listener)}
|
||||
* {@link Wallet#autosaveToFile(File, Duration, WalletFiles.Listener)}
|
||||
* before. This method blocks until finished.
|
||||
* </p>
|
||||
*/
|
||||
|
@ -101,7 +101,6 @@ import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@ -1708,7 +1707,7 @@ public class WalletTest extends TestWithWallet {
|
||||
File f = File.createTempFile("bitcoinj-unit-test", null);
|
||||
Sha256Hash hash1 = Sha256Hash.of(f);
|
||||
// Start with zero delay and ensure the wallet file changes after adding a key.
|
||||
wallet.autosaveToFile(f, 0, TimeUnit.SECONDS, null);
|
||||
wallet.autosaveToFile(f, Duration.ZERO, null);
|
||||
ECKey key = wallet.freshReceiveKey();
|
||||
Sha256Hash hash2 = Sha256Hash.of(f);
|
||||
assertFalse("Wallet not saved after generating fresh key", hash1.equals(hash2)); // File has changed.
|
||||
@ -1729,7 +1728,7 @@ public class WalletTest extends TestWithWallet {
|
||||
final CountDownLatch latch = new CountDownLatch(3);
|
||||
File f = File.createTempFile("bitcoinj-unit-test", null);
|
||||
Sha256Hash hash1 = Sha256Hash.of(f);
|
||||
wallet.autosaveToFile(f, 1, TimeUnit.SECONDS,
|
||||
wallet.autosaveToFile(f, Duration.ofSeconds(1),
|
||||
new WalletFiles.Listener() {
|
||||
@Override
|
||||
public void onBeforeAutoSave(File tempFile) {
|
||||
|
Loading…
Reference in New Issue
Block a user