3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 23:32:16 +00:00

Fixes to tagging, thanks to Andreas for the review.

- Wallet now forces immediate autosave when a tag is set.
- TaggableObject javadocs s/wallet/object/
This commit is contained in:
Mike Hearn 2014-05-13 13:00:01 +02:00
parent acebe8e3d2
commit cbd91c7ea1
2 changed files with 8 additions and 1 deletions

View File

@ -38,6 +38,7 @@ import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture; import com.google.common.util.concurrent.SettableFuture;
import com.google.protobuf.ByteString;
import org.bitcoinj.wallet.Protos.Wallet.EncryptionType; import org.bitcoinj.wallet.Protos.Wallet.EncryptionType;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -3848,4 +3849,10 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
public ReentrantLock getLock() { public ReentrantLock getLock() {
return lock; return lock;
} }
@Override
public synchronized void setTag(String tag, ByteString value) {
super.setTag(tag, value);
saveNow();
}
} }

View File

@ -31,6 +31,6 @@ public interface TaggableObject {
/** Associates the given immutable byte array with the string tag. See the docs for TaggableObject to learn more. */ /** Associates the given immutable byte array with the string tag. See the docs for TaggableObject to learn more. */
void setTag(String tag, ByteString value); void setTag(String tag, ByteString value);
/** Returns a copy of all the tags held by this wallet. */ /** Returns a copy of all the tags held by this object. */
public Map<String, ByteString> getTags(); public Map<String, ByteString> getTags();
} }