|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.bitcoin.protocols.channels.StoredPaymentChannelServerStates
public class StoredPaymentChannelServerStates
Keeps track of a set of StoredServerChannels and expires them 2 hours before their refund transactions
unlock.
| Field Summary | |
|---|---|
static long |
CHANNEL_EXPIRE_OFFSET
The offset between the refund transaction's lock time and the time channels will be automatically closed. |
| Constructor Summary | |
|---|---|
StoredPaymentChannelServerStates(Wallet wallet,
TransactionBroadcaster broadcaster)
Creates a new PaymentChannelServerStateManager and associates it with the given Wallet and
TransactionBroadcaster which are used to complete and announce payment transactions. |
|
| Method Summary | |
|---|---|
void |
closeChannel(StoredServerChannel channel)
Closes the given channel using ServerConnectionEventHandler.closeChannel() and
PaymentChannelServerState.close() to notify any connected client of channel closure and to complete and
broadcast the latest payment transaction. |
void |
deserializeWalletExtension(Wallet containingWallet,
byte[] data)
Loads the contents of this object from the wallet. |
StoredServerChannel |
getChannel(Sha256Hash id)
Gets the StoredServerChannel with the given channel id (ie contract transaction hash). |
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. |
void |
putChannel(StoredServerChannel channel)
Puts the given channel in the channels map and automatically closes it 2 hours before its refund transaction becomes spendable. |
byte[] |
serializeWalletExtension()
Returns bytes that will be saved in the wallet. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long CHANNEL_EXPIRE_OFFSET
| Constructor Detail |
|---|
public StoredPaymentChannelServerStates(Wallet wallet,
TransactionBroadcaster broadcaster)
Wallet and
TransactionBroadcaster which are used to complete and announce payment transactions.
| Method Detail |
|---|
public void closeChannel(StoredServerChannel channel)
Closes the given channel using ServerConnectionEventHandler.closeChannel() and
PaymentChannelServerState.close() to notify any connected client of channel closure and to complete and
broadcast the latest payment transaction.
Removes the given channel from this set of StoredServerChannels and notifies the wallet of a change to
this wallet extension.
public StoredServerChannel getChannel(Sha256Hash id)
StoredServerChannel with the given channel id (ie contract transaction hash).
public void putChannel(StoredServerChannel channel)
Puts the given channel in the channels map and automatically closes it 2 hours before its refund transaction becomes spendable.
Because there must be only one, canonical StoredServerChannel per channel, this method throws if the
channel is already present in the set of channels.
public String getWalletExtensionID()
WalletExtension
getWalletExtensionID in interface WalletExtensionpublic boolean isWalletExtensionMandatory()
WalletExtension
isWalletExtensionMandatory in interface WalletExtensionpublic byte[] serializeWalletExtension()
WalletExtension
serializeWalletExtension in interface WalletExtension
public void deserializeWalletExtension(Wallet containingWallet,
byte[] data)
throws Exception
WalletExtension
deserializeWalletExtension in interface WalletExtensionExceptionpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||