public abstract class ServerConnectionEventHandler extends Object
PaymentChannelServerListener
Constructor and Description |
---|
ServerConnectionEventHandler() |
Modifier and Type | Method and Description |
---|---|
abstract void |
channelClosed(PaymentChannelCloseException.CloseReason reason)
Called when the channel was closed for some reason.
|
abstract void |
channelOpen(Sha256Hash channelId)
Triggered when the channel is opened and application messages/payments can begin
|
protected void |
closeChannel()
Closes the channel with the client (will generate a
channelClosed(PaymentChannelCloseException.CloseReason) event) |
abstract ListenableFuture<com.google.protobuf.ByteString> |
paymentIncrease(Coin by,
Coin to,
com.google.protobuf.ByteString info)
Called when the payment in this channel was successfully incremented by the client
|
protected final void closeChannel()
Closes the channel with the client (will generate a
channelClosed(PaymentChannelCloseException.CloseReason)
event)
Note that this does NOT actually broadcast the most recent payment transaction, which will be triggered
automatically when the channel times out by the StoredPaymentChannelServerStates
, or manually by calling
StoredPaymentChannelServerStates.closeChannel(StoredServerChannel)
with the channel returned by
StoredPaymentChannelServerStates.getChannel(org.bitcoinj.core.Sha256Hash)
with the id provided in
channelOpen(org.bitcoinj.core.Sha256Hash)
public abstract void channelOpen(Sha256Hash channelId)
channelId
- A unique identifier which represents this channel (actually the hash of the multisig contract)@Nullable public abstract ListenableFuture<com.google.protobuf.ByteString> paymentIncrease(Coin by, Coin to, com.google.protobuf.ByteString info)
by
- The increase in total paymentto
- The new total payment to us (not including fees which may be required to claim the payment)info
- Information about this payment increase, used to extend this protocol.public abstract void channelClosed(PaymentChannelCloseException.CloseReason reason)
Called when the channel was closed for some reason. May be called without a call to
channelOpen(Sha256Hash)
.
Note that the same channel can be reopened at any point before it expires if the client reconnects and requests it.
Copyright © 2016. All rights reserved.