Documentation ¶
Index ¶
- Constants
- Variables
- func CalcCosmosFees(gasPrice types.DecCoins, gas uint64) (types.Coins, error)
- func GetAccountByPassword(sdk *poly_go_sdk.PolySdk, path string, pwd []byte) (*poly_go_sdk.Account, error)
- func GetCosmosPrivateKey(path string, pwd []byte) (crypto2.PrivKey, types.AccAddress, error)
- func InitCtx(conf *Conf) error
- func NewCodecForRelayer() *codec.Codec
- type Conf
- type CosmosInfo
- type CosmosSeq
- type CosmosStatus
- type CosmosTx
- type Ctx
- type InfoType
- type PolyInfo
- type PolyStatus
- type PolyTx
Constants ¶
View Source
const ( PerPage = 100 // (0, 100] HdrLimitPerBatch = 50 QueryConsensusPath = "/custom/" + headersync.ModuleName + "/" + headersync.QueryConsensusPeers CosmosCrossChainModName = ccm.ModuleName RightHeightUpdate = "update latest height" CosmosProofKey = "make_from_cosmos_proof" ProofPath = "/store/" + ccm.ModuleName + "/key" TxAlreadyExist = "already done" NewEpoch = "lower than epoch switching height" SeqErr = "verify correct account sequence and chain-id" BroadcastConnTimeOut = "connection timed out" UtxoNotEnough = "current utxo is not enoug" ChanBufSize = 256 QueryAccPath = "/custom/acc/account" CosmosTxNotInEpoch = "Compare height" NoUsefulHeaders = "no header you commited is useful" )
Variables ¶
View Source
var (
RCtx = &Ctx{}
)
Functions ¶
func GetAccountByPassword ¶
func GetCosmosPrivateKey ¶
func NewCodecForRelayer ¶
Types ¶
type Conf ¶
type Conf struct { CosmosRpcAddr string `json:"cosmos_rpc_addr"` CosmosWallet string `json:"cosmos_wallet"` CosmosWalletPwd string `json:"cosmos_wallet_pwd"` CosmosStartHeight int64 `json:"cosmos_start_height"` CosmosListenInterval int `json:"cosmos_listen_interval"` CosmosChainId string `json:"cosmos_chain_id"` CosmosGasPrice string `json:"cosmos_gas_price"` CosmosGas uint64 `json:"cosmos_gas"` PolyRpcAddr string `json:"poly_rpc_addr"` PolyWallet string `json:"poly_wallet"` PolyWalletPwd string `json:"poly_wallet_pwd"` PolyStartHeight uint32 `json:"poly_start_height"` PolyListenInterval int `json:"poly_listen_interval"` PolyToCosmosKey string `json:"poly_to_cosmos_key"` SideChainId uint64 `json:"side_chain_id"` DBPath string `json:"db_path"` ConfirmTimeout int `json:"confirm_timeout"` LogLevel int `json:"log_level"` }
type CosmosInfo ¶
type CosmosInfo struct { // type 1 means header and tx; type 2 means only header; Type InfoType // to update height of chain Height int64 // tx part Tx *CosmosTx // header part Hdrs []*cosmos.CosmosHeader }
type CosmosStatus ¶
type CosmosStatus struct { Txs *sync.Map // TODO: record a start time to test if it's not confirm for a long time, that could be tx lost Wg *sync.WaitGroup IsBlocked bool PolyEpochHeight uint32 }
func NewCosmosStatus ¶
func NewCosmosStatus() (*CosmosStatus, error)
func (*CosmosStatus) AddTx ¶
func (s *CosmosStatus) AddTx(hash bytes.HexBytes, info *PolyInfo) error
func (*CosmosStatus) Len ¶
func (s *CosmosStatus) Len() int
func (*CosmosStatus) Show ¶
func (s *CosmosStatus) Show()
type Ctx ¶
type Ctx struct { // configuration Conf *Conf // To transfer cross chain tx from listening to relaying ToCosmos chan *PolyInfo ToPoly chan *CosmosInfo // Cosmos CMRpcCli *rpchttp.HTTP CMPrivk tcrypto.PrivKey CMAcc ctypes.AccAddress CMSeq *CosmosSeq CMAccNum uint64 CMFees ctypes.Coins CMGas uint64 CMCdc *codec.Codec // Poly chain Poly *poly_go_sdk.PolySdk PolyAcc *poly_go_sdk.Account // DB Db *db.Database // status for relayed tx CMStatus *CosmosStatus PolyStatus *PolyStatus }
type PolyInfo ¶
type PolyInfo struct { // type 0 means only tx; type 2 means header and tx; type 1 means only header; Type InfoType // to update height of Poly on COSMOS Height uint32 // tx part Tx *PolyTx // header part Hdr *types.Header // proof of header which is not during current epoch HeaderProof string // any header in current epoch can be trust anchor EpochAnchor string }
type PolyStatus ¶
func NewPolyStatus ¶
func NewPolyStatus() (*PolyStatus, error)
func (*PolyStatus) Check ¶
func (s *PolyStatus) Check()
func (*PolyStatus) Len ¶
func (s *PolyStatus) Len() int
func (*PolyStatus) Show ¶
func (s *PolyStatus) Show()
Click to show internal directories.
Click to hide internal directories.