public class StoredPaymentChannelServerStates extends Object implements WalletExtension
StoredServerChannel
s and expires them 2 hours before their refund transactions
unlock.Modifier and Type | Field and Description |
---|---|
static long |
CHANNEL_EXPIRE_OFFSET
The offset between the refund transaction's lock time and the time channels will be automatically closed.
|
Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
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() |
public static final long CHANNEL_EXPIRE_OFFSET
public StoredPaymentChannelServerStates(Wallet wallet, TransactionBroadcaster broadcaster)
Wallet
and
TransactionBroadcaster
which are used to complete and announce payment transactions.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 StoredServerChannel
s 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 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 © 2014. All rights reserved.