public static interface IPaymentChannelClient.ClientConnection
Modifier and Type | Method and Description |
---|---|
boolean |
acceptExpireTime(long expireTime)
Queries if the expire time proposed by server is acceptable.
|
void |
channelOpen(boolean wasInitiated)
Indicates the channel has been successfully opened and
PaymentChannelClient.incrementPayment(Coin)
may be called at will. |
void |
destroyConnection(PaymentChannelCloseException.CloseReason reason)
Requests that the connection to the server be closed.
|
void |
sendToServer(Protos.TwoWayChannelMessage msg)
Requests that the given message be sent to the server.
|
void sendToServer(Protos.TwoWayChannelMessage msg)
Requests that the given message be sent to the server. There are no blocking requirements for this method, however the order of messages must be preserved.
If the send fails, no exception should be thrown, however
PaymentChannelClient.connectionClosed()
should be called immediately. In the case of messages which
are a part of initialization, initialization will simply fail and the refund transaction will be broadcasted
when it unlocks (if necessary). In the case of a payment message, the payment will be lost however if the
channel is resumed it will begin again from the channel value after the failed payment.
Called while holding a lock on the PaymentChannelClient
object - be careful about reentrancy
void destroyConnection(PaymentChannelCloseException.CloseReason reason)
Requests that the connection to the server be closed. For stateless protocols, note that after this call,
no more messages should be received from the server and this object is no longer usable. A
PaymentChannelClient.connectionClosed()
event should be generated immediately after this call.
Called while holding a lock on the PaymentChannelClient
object - be careful about reentrancy
reason
- The reason for the closure, see the individual values for more details.
It is usually safe to ignore this and treat any value below
PaymentChannelCloseException.CloseReason.CLIENT_REQUESTED_CLOSE
as "unrecoverable error" and all others as
"try again once and see if it works then"boolean acceptExpireTime(long expireTime)
Queries if the expire time proposed by server is acceptable. If false
is return the channel
will be closed with a PaymentChannelCloseException.CloseReason.TIME_WINDOW_UNACCEPTABLE
.
expireTime
- The time, in seconds, when this channel will be closed by the server. Note this is in absolute time, i.e. seconds since 1970-01-01T00:00:00.true
if the proposed time is acceptable false
otherwise.void channelOpen(boolean wasInitiated)
Indicates the channel has been successfully opened and
PaymentChannelClient.incrementPayment(Coin)
may be called at will.
Called while holding a lock on the PaymentChannelClient
object - be careful about reentrancy
wasInitiated
- If true, the channel is newly opened. If false, it was resumed.