public class StoredPaymentChannelClientStates extends Object implements WalletExtension
StoredClientChannel
s, automatically (re)broadcasting the contract transaction
and broadcasting the refund transaction over the given TransactionBroadcaster
.Modifier and Type | Field and Description |
---|---|
protected ReentrantLock |
lock |
Constructor and Description |
---|
StoredPaymentChannelClientStates(Wallet containingWallet)
Creates a new StoredPaymentChannelClientStates and associates it with the given
Wallet
Use this constructor if you use WalletAppKit, it will provide the broadcaster for you (no need to call the setter) |
StoredPaymentChannelClientStates(Wallet containingWallet,
TransactionBroadcaster announcePeerGroup)
Creates a new StoredPaymentChannelClientStates and associates it with the given
Wallet and
TransactionBroadcaster which are used to complete and announce contract and refund
transactions. |
Modifier and Type | Method and Description |
---|---|
void |
deserializeWalletExtension(Wallet containingWallet,
byte[] data)
Loads the contents of this object from the wallet.
|
Coin |
getBalanceForServer(Sha256Hash id)
Returns the outstanding amount of money sent back to us for all channels to this server added together.
|
org.bitcoinj.protocols.channels.StoredClientChannel |
getChannel(Sha256Hash id,
Sha256Hash contractHash)
Finds a channel with the given id and contract hash and returns it, or returns null.
|
Multimap<Sha256Hash,org.bitcoinj.protocols.channels.StoredClientChannel> |
getChannelMap()
Get a copy of all
StoredClientChannel s |
static StoredPaymentChannelClientStates |
getFromWallet(Wallet wallet)
Returns this extension from the given wallet, or null if no such extension was added.
|
long |
getSecondsUntilExpiry(Sha256Hash id)
Returns the number of seconds from now until this servers next channel will expire, or zero if no unexpired
channels found.
|
String |
getWalletExtensionID()
Returns a Java package/class style name used to disambiguate this extension from others.
|
boolean |
isWalletExtensionMandatory()
If this returns true, the mandatory flag is set when the wallet is serialized and attempts to load it without
the extension being in the wallet will throw an exception.
|
byte[] |
serializeWalletExtension()
Returns bytes that will be saved in the wallet.
|
void |
setTransactionBroadcaster(TransactionBroadcaster transactionBroadcaster)
Use this setter if the broadcaster is not available during instantiation and you're not using WalletAppKit.
|
String |
toString() |
protected final ReentrantLock lock
public StoredPaymentChannelClientStates(@Nullable Wallet containingWallet, TransactionBroadcaster announcePeerGroup)
Wallet
and
TransactionBroadcaster
which are used to complete and announce contract and refund
transactions.public StoredPaymentChannelClientStates(@Nullable Wallet containingWallet)
Wallet
Use this constructor if you use WalletAppKit, it will provide the broadcaster for you (no need to call the setter)public final void setTransactionBroadcaster(TransactionBroadcaster transactionBroadcaster)
transactionBroadcaster
- which is used to complete and announce contract and refund transactions.@Nullable public static StoredPaymentChannelClientStates getFromWallet(Wallet wallet)
public Coin getBalanceForServer(Sha256Hash id)
public long getSecondsUntilExpiry(Sha256Hash id)
@Nullable public org.bitcoinj.protocols.channels.StoredClientChannel getChannel(Sha256Hash id, Sha256Hash contractHash)
public Multimap<Sha256Hash,org.bitcoinj.protocols.channels.StoredClientChannel> getChannelMap()
StoredClientChannel
spublic String getWalletExtensionID()
WalletExtension
getWalletExtensionID
in interface WalletExtension
public boolean isWalletExtensionMandatory()
WalletExtension
isWalletExtensionMandatory
in interface WalletExtension
public byte[] serializeWalletExtension()
WalletExtension
serializeWalletExtension
in interface WalletExtension
public void deserializeWalletExtension(Wallet containingWallet, byte[] data) throws Exception
WalletExtension
deserializeWalletExtension
in interface WalletExtension
Exception
Copyright © 2016. All rights reserved.