Documentation
¶
Index ¶
- Constants
- func ChanStatusName(status uint8) string
- func ComputeBalance(selfSimplex, peerSimplex *entity.SimplexPaymentChannel, ...) *common.ChannelBalance
- func GetBalance(dal *storage.DAL, cid ctype.CidType, myAddr ctype.Addr, nowTs uint64) (*common.ChannelBalance, error)
- func GetBalanceTx(tx *storage.DALTx, cid ctype.CidType, myAddr ctype.Addr, nowTs uint64) (*common.ChannelBalance, error)
- func GetBaseSimplex(tx *storage.DALTx, cid ctype.CidType, ...) (*entity.SimplexPaymentChannel, error)
- func GetMigratedTo(dal *storage.DAL, cid ctype.CidType, nodeConfig common.GlobalNodeConfig) (ctype.Addr, error)
- func GetOnChainChannelBalance(cid ctype.CidType, ledgerAddr ctype.Addr, nodeConfig common.GlobalNodeConfig) (*structs.OnChainBalance, error)
- func GetOnChainChannelStatus(cid ctype.CidType, nodeConfig common.GlobalNodeConfig) (uint8, error)
- func GetOnChainChannelStatusOnLedger(cid ctype.CidType, nodeConfig common.GlobalNodeConfig, ledgerAddr ctype.Addr) (uint8, error)
- func GetOnChainDisputeTimeout(cid ctype.CidType, nodeConfig common.GlobalNodeConfig) (uint64, error)
- func GetOnChainSettleFinalizedTime(cid ctype.CidType, nodeConfig common.GlobalNodeConfig) (*big.Int, error)
- func GetOnChainWithdrawIntent(cid ctype.CidType, nodeConfig common.GlobalNodeConfig) (ctype.Addr, *big.Int, uint64, ctype.CidType, error)
- func SyncOnChainBalance(dal *storage.DAL, cid ctype.CidType, nodeConfig common.GlobalNodeConfig) error
- func SyncOnChainBalanceTx(tx *storage.DALTx, cid ctype.CidType, nodeConfig common.GlobalNodeConfig) (*structs.OnChainBalance, error)
- type TxInfo
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func ChanStatusName ¶
func ComputeBalance ¶
func ComputeBalance( selfSimplex, peerSimplex *entity.SimplexPaymentChannel, onChainBalance *structs.OnChainBalance, myAddr, peerAddr ctype.Addr, nowTs uint64) *common.ChannelBalance
ComputeBalance derives free / locked channel balance. nowTs is a unix timestamp (seconds) used to evaluate the active-pending-withdraw deadline window.
func GetBalance ¶
func GetBalance(dal *storage.DAL, cid ctype.CidType, myAddr ctype.Addr, nowTs uint64) (*common.ChannelBalance, error)
GetBalance computes the channel balance. nowTs is a unix timestamp (seconds) used to decide whether a pending withdrawal is still active per the contract's `block.timestamp`-based deadline semantics.
func GetBalanceTx ¶
func GetBaseSimplex ¶
func GetBaseSimplex( tx *storage.DALTx, cid ctype.CidType, selfSimplex *entity.SimplexPaymentChannel, baseSeq, lastAckedSeq uint64) (*entity.SimplexPaymentChannel, error)
func GetMigratedTo ¶
func GetMigratedTo(dal *storage.DAL, cid ctype.CidType, nodeConfig common.GlobalNodeConfig) (ctype.Addr, error)
GetMigratedTo queries the ledger contract for channel migration info. When channel status is "Migrated", it would return the new ledger to which the channel migrated. When channel status is not "Migrated", it would return address 0x0. Usually call GetOnChainChannelStatus before call this
func GetOnChainChannelBalance ¶
func GetOnChainChannelBalance(cid ctype.CidType, ledgerAddr ctype.Addr, nodeConfig common.GlobalNodeConfig) (*structs.OnChainBalance, error)
GetOnChainChannelBalance queries the ledger contract for channel balance
func GetOnChainChannelStatus ¶
func SyncOnChainBalance ¶
func SyncOnChainBalance(dal *storage.DAL, cid ctype.CidType, nodeConfig common.GlobalNodeConfig) error
SyncOnChainBalance updates local on-chain balances for the given channel
func SyncOnChainBalanceTx ¶
func SyncOnChainBalanceTx(tx *storage.DALTx, cid ctype.CidType, nodeConfig common.GlobalNodeConfig) (*structs.OnChainBalance, error)