Copy accessor for the channel map

This commit is contained in:
cyberzac
2015-11-03 15:27:16 +01:00
committed by Andreas Schildbach
parent ff2e057126
commit 3966f424a0

View File

@@ -16,6 +16,7 @@
package org.bitcoinj.protocols.channels;
import com.google.common.collect.ImmutableMap;
import org.bitcoinj.core.*;
import org.bitcoinj.utils.Threading;
import com.google.common.annotations.VisibleForTesting;
@@ -149,6 +150,18 @@ public class StoredPaymentChannelServerStates implements WalletExtension {
}
}
/**
* Get a copy of all {@link StoredServerChannel}s
*/
public Map<Sha256Hash, StoredServerChannel> getChannelMap() {
lock.lock();
try {
return ImmutableMap.copyOf(mapChannels);
} finally {
lock.unlock();
}
}
/**
* Notifies the set of stored states that a channel has been updated. Use to notify the wallet of an update to this
* wallet extension.