public class PaymentChannelV1ServerState extends PaymentChannelServerState
PaymentChannelServerState.State| Modifier and Type | Field and Description |
|---|---|
protected ECKey |
clientKey |
bestValueSignature, bestValueToMe, broadcaster, contract, minExpireTime, serverKey, stateMachine, storedServerChannel| Constructor and Description |
|---|
PaymentChannelV1ServerState(TransactionBroadcaster broadcaster,
Wallet wallet,
ECKey serverKey,
long minExpireTime)
Creates a new state object to track the server side of a payment channel.
|
| Modifier and Type | Method and Description |
|---|---|
ListenableFuture<Transaction> |
close()
Closes this channel and broadcasts the highest value payment transaction on the network.
|
protected Script |
createOutputScript() |
protected ECKey |
getClientKey() |
TransactionOutput |
getClientOutput() |
Coin |
getFeePaid()
Gets the fee paid in the final payment transaction (only available if settle() did not throw an exception)
|
int |
getMajorVersion() |
long |
getRefundTransactionUnlockTime()
Gets the client's refund transaction which they can spend to get the entire channel value back if it reaches its
lock time.
|
protected Script |
getSignedScript()
Gets the script that signatures should sign against.
|
Multimap<PaymentChannelServerState.State,PaymentChannelServerState.State> |
getStateTransitions() |
byte[] |
provideRefundTransaction(Transaction refundTx,
byte[] clientMultiSigPubKey)
Called when the client provides the refund transaction.
|
getBestValueToMe, getContract, getContractScript, getExpiryTime, getState, getTotalValue, incrementPayment, makeUnsignedChannelContract, provideContract, storeChannelInWallet, updateChannelInWallet, verifyContractprotected ECKey clientKey
public PaymentChannelV1ServerState(TransactionBroadcaster broadcaster, Wallet wallet, ECKey serverKey, long minExpireTime)
broadcaster - The peer group which we will broadcast transactions to, this should have multiple peerswallet - The wallet which will be used to complete transactionsserverKey - The private key which we use for our part of the multi-sig contract
(this MUST be fresh and CANNOT be used elsewhere)minExpireTime - The earliest time at which the client can claim the refund transaction (UNIX timestamp of block)public Multimap<PaymentChannelServerState.State,PaymentChannelServerState.State> getStateTransitions()
getStateTransitions in class PaymentChannelServerStatepublic int getMajorVersion()
getMajorVersion in class PaymentChannelServerStatepublic TransactionOutput getClientOutput()
getClientOutput in class PaymentChannelServerStateprotected Script getSignedScript()
PaymentChannelServerStategetSignedScript in class PaymentChannelServerStatepublic byte[] provideRefundTransaction(Transaction refundTx, byte[] clientMultiSigPubKey) throws VerificationException
refundTx - The refund transaction, this object will be mutated when payment is incremented.clientMultiSigPubKey - The client's pubkey which is required for the multisig outputVerificationException - If the transaction isnt valid or did not meet the requirements of a refund transaction.protected Script createOutputScript()
createOutputScript in class PaymentChannelServerStateprotected ECKey getClientKey()
getClientKey in class PaymentChannelServerStatepublic ListenableFuture<Transaction> close() throws InsufficientMoneyException
Closes this channel and broadcasts the highest value payment transaction on the network.
This will set the state to State#CLOSED if the transaction is successfully broadcast on the network.
If we fail to broadcast for some reason, the state is set to State#ERROR.
If the current state is before State#READY (ie we have not finished initializing the channel), we
simply set the state to State#CLOSED and let the client handle getting its refund transaction confirmed.
close in class PaymentChannelServerStateInsufficientMoneyException - If the payment tx would have cost more in fees to spend than it is worth.public Coin getFeePaid()
getFeePaid in class PaymentChannelServerStatepublic long getRefundTransactionUnlockTime()
Copyright © 2016. All rights reserved.