Documentation ¶
Index ¶
- Constants
- Variables
- func QueryAnchor(config *params.ChainConfig, bc core.ChainContext, statedb *state.StateDB, ...) ([]common.Address, int)
- type Anchor
- type AnchorSet
- type ChainInvoke
- type CrossNodeInfo
- type CrossPeerInfo
- type CrossPool
- func (pool *CrossPool) AddLocal(ctx *cc.CrossTransaction) error
- func (pool *CrossPool) AddRemote(ctx *cc.CrossTransaction) error
- func (pool *CrossPool) Commit(cws *cc.CrossTransactionWithSignatures)
- func (pool *CrossPool) GetLocal(ctxID common.Hash) *cc.CrossTransaction
- func (pool *CrossPool) Pending(number uint64, limit int, exclude map[common.Hash]bool) (pending []common.Hash)
- func (pool *CrossPool) Stats() (int, int)
- func (pool *CrossPool) Stop()
- func (pool *CrossPool) SubscribeSignedCtxEvent(ch chan<- cc.SignedCtxEvent) event.Subscription
- type CrossService
- func (srv *CrossService) APIs() []rpc.API
- func (srv *CrossService) BroadcastCrossTx(ctxs []*cc.CrossTransaction, local bool)
- func (srv *CrossService) NodeInfo() *CrossNodeInfo
- func (srv *CrossService) Protocols() []p2p.Protocol
- func (srv *CrossService) Start(server *p2p.Server) error
- func (srv *CrossService) Stop() error
- type CrossStore
- func (store *CrossStore) AddLocal(ctx *cc.CrossTransactionWithSignatures) error
- func (store *CrossStore) AddRemote(ctx *cc.CrossTransactionWithSignatures) error
- func (store *CrossStore) Close()
- func (store *CrossStore) GetLocal(ctxID common.Hash) *cc.CrossTransactionWithSignatures
- func (store *CrossStore) GetSyncCrossTransactions(reqHeight, maxHeight uint64, pageSize int) []*cc.CrossTransactionWithSignatures
- func (store *CrossStore) HasLocal(ctxID common.Hash) bool
- func (store *CrossStore) Height() uint64
- func (store *CrossStore) MarkStatus(txms []*cc.CrossTransactionModifier, status cc.CtxStatus)
- func (store *CrossStore) RegisterChain(chainID *big.Int)
- func (store *CrossStore) RemoveRemotes(rtxs []*cc.ReceptTransaction)
- func (store *CrossStore) StoreStats() (map[cc.CtxStatus]int, map[cc.CtxStatus]int)
- func (store *CrossStore) SyncCrossTransactions(ctxList []*cc.CrossTransactionWithSignatures) int
- type CrossValidator
- func (v *CrossValidator) UpdateAnchors(info *cc.RemoteChainInfo) error
- func (v *CrossValidator) VerifyCtx(ctx *cc.CrossTransaction) error
- func (v *CrossValidator) VerifyCwsInvoking(cws *cc.CrossTransactionWithSignatures) error
- func (v *CrossValidator) VerifySigner(ctx *cc.CrossTransaction, signChain, destChain *big.Int) error
- type EvmInvoke
- type Handler
- func (h *Handler) AddRemoteCtx(ctx *cc.CrossTransaction) error
- func (h *Handler) FindByTxHash(hash common.Hash) *cc.CrossTransactionWithSignatures
- func (h *Handler) GetSyncCrossTransaction(height uint64, syncSize int) []*cc.CrossTransactionWithSignatures
- func (h *Handler) GetSyncPending(ids []common.Hash) []*cc.CrossTransaction
- func (h *Handler) Height() *big.Int
- func (h *Handler) LocalID() uint64
- func (h *Handler) Pending(limit int, exclude map[common.Hash]bool) (ids []common.Hash)
- func (h *Handler) PoolStats() (int, int)
- func (h *Handler) QueryByPage(localSize, localPage, remoteSize, remotePage int) (map[uint64][]*cc.CrossTransactionWithSignatures, ...)
- func (h *Handler) QueryLocalBySenderAndPage(from common.Address, pageSize, startPage int) (map[uint64][]*cc.OwnerCrossTransactionWithSignatures, int)
- func (h *Handler) QueryRemoteByDestinationValueAndPage(value *big.Int, pageSize, startPage int) (uint64, []*cc.CrossTransactionWithSignatures, int)
- func (h *Handler) RemoteID() uint64
- func (h *Handler) Start()
- func (h *Handler) Stop()
- func (h *Handler) StoreStats() (map[cc.CtxStatus]int, map[cc.CtxStatus]int)
- func (h *Handler) SyncCrossTransaction(ctx []*cc.CrossTransactionWithSignatures) int
- func (h *Handler) SyncPending(ctxs []*cc.CrossTransaction) map[common.Hash]bool
- type PrivateCrossAdminAPI
- func (s *PrivateCrossAdminAPI) Height() map[string]hexutil.Uint64
- func (s *PrivateCrossAdminAPI) Peers() (infos []*CrossPeerInfo, err error)
- func (s *PrivateCrossAdminAPI) Repair() (bool, error)
- func (s *PrivateCrossAdminAPI) SyncPending() (bool, error)
- func (s *PrivateCrossAdminAPI) SyncStore() (bool, error)
- type PublicCrossChainAPI
- func (s *PublicCrossChainAPI) CtxContent() map[string]map[uint64][]*RPCCrossTransaction
- func (s *PublicCrossChainAPI) CtxContentByPage(localSize, localPage, remoteSize, remotePage int) map[string]RPCPageCrossTransactions
- func (s *PublicCrossChainAPI) CtxOwner(ctx context.Context, from common.Address) map[string]map[uint64][]*RPCOwnerCrossTransaction
- func (s *PublicCrossChainAPI) CtxOwnerByPage(ctx context.Context, from common.Address, pageSize, startPage int) RPCPageOwnerCrossTransactions
- func (s *PublicCrossChainAPI) CtxQuery(ctx context.Context, hash common.Hash) *RPCCrossTransaction
- func (s *PublicCrossChainAPI) CtxQueryDestValue(ctx context.Context, value *hexutil.Big, pageSize, startPage int) *RPCPageCrossTransactions
- func (s *PublicCrossChainAPI) CtxStats() map[string]map[cc.CtxStatus]int
- func (s *PublicCrossChainAPI) PoolStats() map[string]int
- type PublicCrossManualAPI
- type RPCCrossTransaction
- type RPCOwnerCrossTransaction
- type RPCPageCrossTransactions
- type RPCPageOwnerCrossTransactions
- type SyncPendingReq
- type SyncPendingResp
- type SyncReq
- type SyncResp
Constants ¶
View Source
const ( CtxSignMsg = 0x31 GetCtxSyncMsg = 0x32 CtxSyncMsg = 0x33 GetPendingSyncMsg = 0x34 PendingSyncMsg = 0x35 )
Variables ¶
View Source
var ErrVerifyCtx = errors.New("verify ctx failed")
Functions ¶
Types ¶
type AnchorSet ¶
type AnchorSet map[Anchor]struct{}
func NewAnchorSet ¶
func (AnchorSet) IsAnchorSignedCtx ¶
type ChainInvoke ¶
type ChainInvoke struct {
// contains filtered or unexported fields
}
func NewChainInvoke ¶
func NewChainInvoke(chain cross.BlockChain) *ChainInvoke
func (ChainInvoke) GetTransactionNumberOnChain ¶
func (c ChainInvoke) GetTransactionNumberOnChain(tx cross.Transaction) uint64
func (ChainInvoke) GetTransactionTimeOnChain ¶
func (c ChainInvoke) GetTransactionTimeOnChain(tx cross.Transaction) uint64
func (ChainInvoke) IsTransactionInExpiredBlock ¶
func (c ChainInvoke) IsTransactionInExpiredBlock(tx cross.Transaction, expiredHeight uint64) bool
type CrossNodeInfo ¶
type CrossPeerInfo ¶
type CrossPool ¶ added in v1.0.5
type CrossPool struct {
// contains filtered or unexported fields
}
func NewCrossPool ¶ added in v1.0.5
func NewCrossPool(store *CrossStore, validator *CrossValidator, signHash cc.SignHash) *CrossPool
func (*CrossPool) AddLocal ¶ added in v1.0.5
func (pool *CrossPool) AddLocal(ctx *cc.CrossTransaction) error
func (*CrossPool) AddRemote ¶ added in v1.0.5
func (pool *CrossPool) AddRemote(ctx *cc.CrossTransaction) error
func (*CrossPool) Commit ¶ added in v1.0.5
func (pool *CrossPool) Commit(cws *cc.CrossTransactionWithSignatures)
func (*CrossPool) GetLocal ¶ added in v1.0.5
func (pool *CrossPool) GetLocal(ctxID common.Hash) *cc.CrossTransaction
func (*CrossPool) SubscribeSignedCtxEvent ¶ added in v1.0.5
func (pool *CrossPool) SubscribeSignedCtxEvent(ch chan<- cc.SignedCtxEvent) event.Subscription
type CrossService ¶
type CrossService struct {
// contains filtered or unexported fields
}
CrossService implements node.Service
func NewCrossService ¶
func NewCrossService(ctx *node.ServiceContext, main, sub cross.SimpleChain, config *eth.Config) (*CrossService, error)
func (*CrossService) APIs ¶
func (srv *CrossService) APIs() []rpc.API
func (*CrossService) BroadcastCrossTx ¶
func (srv *CrossService) BroadcastCrossTx(ctxs []*cc.CrossTransaction, local bool)
func (*CrossService) NodeInfo ¶
func (srv *CrossService) NodeInfo() *CrossNodeInfo
func (*CrossService) Protocols ¶
func (srv *CrossService) Protocols() []p2p.Protocol
func (*CrossService) Stop ¶
func (srv *CrossService) Stop() error
type CrossStore ¶
type CrossStore struct {
// contains filtered or unexported fields
}
func NewCrossStore ¶
func NewCrossStore(ctx crossdb.ServiceContext, config cross.CtxStoreConfig, chainConfig *params.ChainConfig, chain cross.BlockChain, makerDb string) (*CrossStore, error)
func (*CrossStore) AddLocal ¶
func (store *CrossStore) AddLocal(ctx *cc.CrossTransactionWithSignatures) error
func (*CrossStore) AddRemote ¶
func (store *CrossStore) AddRemote(ctx *cc.CrossTransactionWithSignatures) error
func (*CrossStore) Close ¶ added in v1.0.5
func (store *CrossStore) Close()
func (*CrossStore) GetLocal ¶ added in v1.0.4
func (store *CrossStore) GetLocal(ctxID common.Hash) *cc.CrossTransactionWithSignatures
func (*CrossStore) GetSyncCrossTransactions ¶
func (store *CrossStore) GetSyncCrossTransactions(reqHeight, maxHeight uint64, pageSize int) []*cc.CrossTransactionWithSignatures
func (*CrossStore) HasLocal ¶ added in v1.0.5
func (store *CrossStore) HasLocal(ctxID common.Hash) bool
func (*CrossStore) Height ¶
func (store *CrossStore) Height() uint64
func (*CrossStore) MarkStatus ¶
func (store *CrossStore) MarkStatus(txms []*cc.CrossTransactionModifier, status cc.CtxStatus)
func (*CrossStore) RegisterChain ¶
func (store *CrossStore) RegisterChain(chainID *big.Int)
func (*CrossStore) RemoveRemotes ¶
func (store *CrossStore) RemoveRemotes(rtxs []*cc.ReceptTransaction)
func (*CrossStore) StoreStats ¶
func (*CrossStore) SyncCrossTransactions ¶
func (store *CrossStore) SyncCrossTransactions(ctxList []*cc.CrossTransactionWithSignatures) int
sync cross transactions (with signatures) from other anchor peers
type CrossValidator ¶ added in v1.0.5
type CrossValidator struct {
// contains filtered or unexported fields
}
func NewCrossValidator ¶ added in v1.0.5
func NewCrossValidator(store *CrossStore, contract common.Address) *CrossValidator
func (*CrossValidator) UpdateAnchors ¶ added in v1.0.5
func (v *CrossValidator) UpdateAnchors(info *cc.RemoteChainInfo) error
func (*CrossValidator) VerifyCtx ¶ added in v1.0.5
func (v *CrossValidator) VerifyCtx(ctx *cc.CrossTransaction) error
func (*CrossValidator) VerifyCwsInvoking ¶ added in v1.0.5
func (v *CrossValidator) VerifyCwsInvoking(cws *cc.CrossTransactionWithSignatures) error
send message to verify ctx in the cross contract (must exist makerTx in source-chain, do not took by others in destination-chain)
func (*CrossValidator) VerifySigner ¶ added in v1.0.5
func (v *CrossValidator) VerifySigner(ctx *cc.CrossTransaction, signChain, destChain *big.Int) error
validate ctx signed by anchor (fromChain:tx signed by fromChain, )
type EvmInvoke ¶
type EvmInvoke struct {
// contains filtered or unexported fields
}
func NewEvmInvoke ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewCrossHandler ¶
func NewCrossHandler(ctx *node.ServiceContext, chain cross.SimpleChain, service *CrossService, storeConfig cross.CtxStoreConfig, storePath string, contract common.Address, crossMsgReader <-chan interface{}, crossMsgWriter chan<- interface{}, signHash cc.SignHash, anchorSigner common.Address) (*Handler, error)
func (*Handler) AddRemoteCtx ¶
func (h *Handler) AddRemoteCtx(ctx *cc.CrossTransaction) error
func (*Handler) FindByTxHash ¶ added in v1.0.4
func (h *Handler) FindByTxHash(hash common.Hash) *cc.CrossTransactionWithSignatures
func (*Handler) GetSyncCrossTransaction ¶
func (h *Handler) GetSyncCrossTransaction(height uint64, syncSize int) []*cc.CrossTransactionWithSignatures
func (*Handler) GetSyncPending ¶ added in v1.0.4
func (h *Handler) GetSyncPending(ids []common.Hash) []*cc.CrossTransaction
func (*Handler) QueryByPage ¶ added in v1.0.4
func (h *Handler) QueryByPage(localSize, localPage, remoteSize, remotePage int) (map[uint64][]*cc.CrossTransactionWithSignatures, map[uint64][]*cc.CrossTransactionWithSignatures, int, int)
func (*Handler) QueryLocalBySenderAndPage ¶ added in v1.0.4
func (*Handler) QueryRemoteByDestinationValueAndPage ¶ added in v1.0.4
func (*Handler) StoreStats ¶ added in v1.0.4
func (*Handler) SyncCrossTransaction ¶
func (h *Handler) SyncCrossTransaction(ctx []*cc.CrossTransactionWithSignatures) int
func (*Handler) SyncPending ¶ added in v1.0.4
type PrivateCrossAdminAPI ¶ added in v1.0.4
type PrivateCrossAdminAPI struct {
// contains filtered or unexported fields
}
func NewPrivateCrossAdminAPI ¶ added in v1.0.4
func NewPrivateCrossAdminAPI(service *CrossService) *PrivateCrossAdminAPI
func (*PrivateCrossAdminAPI) Height ¶ added in v1.0.4
func (s *PrivateCrossAdminAPI) Height() map[string]hexutil.Uint64
func (*PrivateCrossAdminAPI) Peers ¶ added in v1.0.4
func (s *PrivateCrossAdminAPI) Peers() (infos []*CrossPeerInfo, err error)
func (*PrivateCrossAdminAPI) Repair ¶ added in v1.0.4
func (s *PrivateCrossAdminAPI) Repair() (bool, error)
func (*PrivateCrossAdminAPI) SyncPending ¶ added in v1.0.4
func (s *PrivateCrossAdminAPI) SyncPending() (bool, error)
func (*PrivateCrossAdminAPI) SyncStore ¶ added in v1.0.4
func (s *PrivateCrossAdminAPI) SyncStore() (bool, error)
type PublicCrossChainAPI ¶
type PublicCrossChainAPI struct {
// contains filtered or unexported fields
}
PublicTxPoolAPI offers and API for the transaction pool. It only operates on data that is non confidential.
func NewPublicCrossChainAPI ¶
func NewPublicCrossChainAPI(handler *Handler) *PublicCrossChainAPI
NewPublicTxPoolAPI creates a new tx pool service that gives information about the transaction pool.
func (*PublicCrossChainAPI) CtxContent ¶
func (s *PublicCrossChainAPI) CtxContent() map[string]map[uint64][]*RPCCrossTransaction
func (*PublicCrossChainAPI) CtxContentByPage ¶ added in v1.0.4
func (s *PublicCrossChainAPI) CtxContentByPage(localSize, localPage, remoteSize, remotePage int) map[string]RPCPageCrossTransactions
func (*PublicCrossChainAPI) CtxOwner ¶
func (s *PublicCrossChainAPI) CtxOwner(ctx context.Context, from common.Address) map[string]map[uint64][]*RPCOwnerCrossTransaction
func (*PublicCrossChainAPI) CtxOwnerByPage ¶ added in v1.0.4
func (s *PublicCrossChainAPI) CtxOwnerByPage(ctx context.Context, from common.Address, pageSize, startPage int) RPCPageOwnerCrossTransactions
func (*PublicCrossChainAPI) CtxQuery ¶
func (s *PublicCrossChainAPI) CtxQuery(ctx context.Context, hash common.Hash) *RPCCrossTransaction
func (*PublicCrossChainAPI) CtxQueryDestValue ¶ added in v1.0.4
func (s *PublicCrossChainAPI) CtxQueryDestValue(ctx context.Context, value *hexutil.Big, pageSize, startPage int) *RPCPageCrossTransactions
func (*PublicCrossChainAPI) CtxStats ¶
func (s *PublicCrossChainAPI) CtxStats() map[string]map[cc.CtxStatus]int
func (*PublicCrossChainAPI) PoolStats ¶ added in v1.0.4
func (s *PublicCrossChainAPI) PoolStats() map[string]int
type PublicCrossManualAPI ¶ added in v1.0.4
type PublicCrossManualAPI struct {
// contains filtered or unexported fields
}
func NewPublicCrossManualAPI ¶ added in v1.0.4
func NewPublicCrossManualAPI(mainHandler, subHandler *Handler) *PublicCrossManualAPI
func (*PublicCrossManualAPI) ImportMainCtx ¶ added in v1.0.4
func (s *PublicCrossManualAPI) ImportMainCtx(ctxWithSignsSArgs hexutil.Bytes) error
func (*PublicCrossManualAPI) ImportSubCtx ¶ added in v1.0.4
func (s *PublicCrossManualAPI) ImportSubCtx(ctxWithSignsSArgs hexutil.Bytes) error
type RPCCrossTransaction ¶
type RPCCrossTransaction struct { Value *hexutil.Big `json:"value"` CTxId common.Hash `json:"ctxId"` Status cc.CtxStatus `json:"status"` TxHash common.Hash `json:"txHash"` From common.Address `json:"from"` BlockHash common.Hash `json:"blockHash"` DestinationId *hexutil.Big `json:"destinationId"` DestinationValue *hexutil.Big `json:"destinationValue"` Input hexutil.Bytes `json:"input"` V []*hexutil.Big `json:"v"` R []*hexutil.Big `json:"r"` S []*hexutil.Big `json:"s"` }
type RPCOwnerCrossTransaction ¶
type RPCOwnerCrossTransaction struct { Value *hexutil.Big `json:"value"` Status cc.CtxStatus `json:"status"` CTxId common.Hash `json:"ctxId"` TxHash common.Hash `json:"txHash"` From common.Address `json:"from"` BlockHash common.Hash `json:"blockHash"` DestinationId *hexutil.Big `json:"destinationId"` DestinationValue *hexutil.Big `json:"destinationValue"` Input hexutil.Bytes `json:"input"` Time hexutil.Uint64 `json:"time"` V []*hexutil.Big `json:"v"` R []*hexutil.Big `json:"r"` S []*hexutil.Big `json:"s"` }
type RPCPageCrossTransactions ¶ added in v1.0.4
type RPCPageCrossTransactions struct { Data map[uint64][]*RPCCrossTransaction `json:"data"` Total int `json:"total"` }
type RPCPageOwnerCrossTransactions ¶ added in v1.0.4
type RPCPageOwnerCrossTransactions struct { Data map[uint64][]*RPCOwnerCrossTransaction `json:"data"` Total int `json:"total"` }
type SyncPendingReq ¶ added in v1.0.4
type SyncPendingResp ¶ added in v1.0.4
Click to show internal directories.
Click to hide internal directories.