Documentation
¶
Index ¶
- Constants
- Variables
- func QueryAnchor(config *params.ChainConfig, bc core.ChainContext, statedb *state.StateDB, ...) ([]common.Address, int)
- type Anchor
- type AnchorSet
- type CallArgs
- type ChainInvoke
- type CrossNodeInfo
- type CrossPeerInfo
- 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) AddFromRemoteChain(ctx *cc.CrossTransactionWithSignatures, ...) error
- func (store *CrossStore) AddLocal(ctx *cc.CrossTransaction) error
- func (store *CrossStore) AddRemote(ctx *cc.CrossTransaction) error
- func (store *CrossStore) GetSyncCrossTransactions(chainID uint64, txID common.Hash, pageSize int) []*cc.CrossTransactionWithSignatures
- func (store *CrossStore) Height() int
- func (store *CrossStore) ListLocalCrossTransactionBySender(from common.Address) map[uint64][]*cc.OwnerCrossTransactionWithSignatures
- func (store *CrossStore) MarkStatus(rtxs []*cc.ReceptTransaction, status cc.CtxStatus)
- func (store *CrossStore) Query() (map[uint64][]*cc.CrossTransactionWithSignatures, ...)
- func (store *CrossStore) RegisterChain(chainID *big.Int)
- func (store *CrossStore) RemoveLocals(finishes []common.Hash) []error
- func (store *CrossStore) RemoveRemotes(rtxs []*cc.ReceptTransaction) []error
- func (store *CrossStore) Stats() (int, int)
- func (store *CrossStore) Stop()
- func (store *CrossStore) StoreStats() int
- func (store *CrossStore) SubscribeSignedCtxEvent(ch chan<- cc.SignedCtxEvent) event.Subscription
- func (store *CrossStore) SyncCrossTransactions(ctxList []*cc.CrossTransactionWithSignatures) int
- func (store *CrossStore) UpdateAnchors(info *cc.RemoteChainInfo) error
- func (store *CrossStore) VerifyCtx(ctx *cc.CrossTransaction) error
- type EvmInvoke
- type GasHelper
- type Handler
- func (h *Handler) AddRemoteCtx(ctx *cc.CrossTransaction) error
- func (h *Handler) GetHeight() *big.Int
- func (h *Handler) GetSyncCrossTransaction(startTxID common.Hash, syncSize int) []*cc.CrossTransactionWithSignatures
- func (h *Handler) ListLocalCrossTransactionBySender(from common.Address) map[uint64][]*cc.OwnerCrossTransactionWithSignatures
- func (h *Handler) Query() (map[uint64][]*cc.CrossTransactionWithSignatures, ...)
- func (h *Handler) Start()
- func (h *Handler) Stats() int
- func (h *Handler) Status() (int, int)
- func (h *Handler) Stop()
- func (h *Handler) SyncCrossTransaction(ctx []*cc.CrossTransactionWithSignatures) int
- type PublicCrossChainAPI
- func (s *PublicCrossChainAPI) CtxContent() map[string]map[uint64][]*RPCCrossTransaction
- func (s *PublicCrossChainAPI) CtxList(ctx context.Context, from common.Address) map[string]map[uint64][]*RPCCrossTransaction
- func (s *PublicCrossChainAPI) CtxOwner(ctx context.Context, from common.Address) map[string]map[uint64][]*RPCOwnerCrossTransaction
- func (s *PublicCrossChainAPI) CtxQuery(ctx context.Context, hash common.Hash) *RPCCrossTransaction
- func (s *PublicCrossChainAPI) CtxStats() int
- func (s *PublicCrossChainAPI) CtxStatus() map[string]int
- func (s *PublicCrossChainAPI) GetLocalCtx(count uint64) map[uint64][]*RPCCrossTransaction
- func (s *PublicCrossChainAPI) GetRemoteCtx(count uint64) map[uint64][]*RPCCrossTransaction
- type RPCCrossTransaction
- type RPCOwnerCrossTransaction
- type RoleHandler
- type SyncReq
- type SyncResp
- type TranParam
- type Validator
Constants ¶
View Source
const ( CtxSignMsg = 0x31 GetCtxSyncMsg = 0x32 CtxSyncMsg = 0x33 GetPendingSyncMsg = 0x34 //TODO: sync pending-sign ctx when anchor restart 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 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 ¶
func NewCrossStore ¶
func NewCrossStore(ctx crossdb.ServiceContext, config cross.CtxStoreConfig, chainConfig *params.ChainConfig, chain cross.BlockChain, makerDb string, address common.Address, signHash cc.SignHash) (*CrossStore, error)
func (*CrossStore) AddFromRemoteChain ¶
func (store *CrossStore) AddFromRemoteChain(ctx *cc.CrossTransactionWithSignatures, callback func(*cc.CrossTransactionWithSignatures, ...int)) error
AddFromRemoteChain add remote-chain ctx with signatures
func (*CrossStore) AddLocal ¶
func (store *CrossStore) AddLocal(ctx *cc.CrossTransaction) error
func (*CrossStore) AddRemote ¶
func (store *CrossStore) AddRemote(ctx *cc.CrossTransaction) error
func (*CrossStore) GetSyncCrossTransactions ¶
func (store *CrossStore) GetSyncCrossTransactions(chainID uint64, txID common.Hash, pageSize int) []*cc.CrossTransactionWithSignatures
func (*CrossStore) Height ¶
func (store *CrossStore) Height() int
func (*CrossStore) ListLocalCrossTransactionBySender ¶
func (store *CrossStore) ListLocalCrossTransactionBySender(from common.Address) map[uint64][]*cc.OwnerCrossTransactionWithSignatures
func (*CrossStore) MarkStatus ¶
func (store *CrossStore) MarkStatus(rtxs []*cc.ReceptTransaction, status cc.CtxStatus)
func (*CrossStore) Query ¶
func (store *CrossStore) Query() (map[uint64][]*cc.CrossTransactionWithSignatures, map[uint64][]*cc.CrossTransactionWithSignatures)
func (*CrossStore) RegisterChain ¶
func (store *CrossStore) RegisterChain(chainID *big.Int)
func (*CrossStore) RemoveLocals ¶
func (store *CrossStore) RemoveLocals(finishes []common.Hash) []error
func (*CrossStore) RemoveRemotes ¶
func (store *CrossStore) RemoveRemotes(rtxs []*cc.ReceptTransaction) []error
func (*CrossStore) Stats ¶
func (store *CrossStore) Stats() (int, int)
func (*CrossStore) Stop ¶
func (store *CrossStore) Stop()
func (*CrossStore) StoreStats ¶
func (store *CrossStore) StoreStats() int
func (*CrossStore) SubscribeSignedCtxEvent ¶
func (store *CrossStore) SubscribeSignedCtxEvent(ch chan<- cc.SignedCtxEvent) event.Subscription
func (*CrossStore) SyncCrossTransactions ¶
func (store *CrossStore) SyncCrossTransactions(ctxList []*cc.CrossTransactionWithSignatures) int
sync cross transactions (with signatures) from other anchor peers
func (*CrossStore) UpdateAnchors ¶
func (store *CrossStore) UpdateAnchors(info *cc.RemoteChainInfo) error
func (*CrossStore) VerifyCtx ¶
func (store *CrossStore) VerifyCtx(ctx *cc.CrossTransaction) error
type EvmInvoke ¶
type EvmInvoke struct {
// contains filtered or unexported fields
}
func NewEvmInvoke ¶
type GasHelper ¶
type GasHelper struct {
// contains filtered or unexported fields
}
func NewGasHelper ¶
func NewGasHelper(blockchain *core.BlockChain, chain cross.SimpleChain) *GasHelper
type Handler ¶
type Handler struct {
MainChainCtxAddress common.Address
SubChainCtxAddress common.Address
// contains filtered or unexported fields
}
func NewCrossHandler ¶
func NewCrossHandler(chain cross.SimpleChain, roleHandler RoleHandler, role common.ChainRole, service *CrossService, ctxPool *CrossStore, blockChain *core.BlockChain, crossMsgReader <-chan interface{}, crossMsgWriter chan<- interface{}, mainAddr common.Address, subAddr common.Address, signHash cc.SignHash, anchorSigner common.Address) *Handler
func (*Handler) AddRemoteCtx ¶
func (h *Handler) AddRemoteCtx(ctx *cc.CrossTransaction) error
func (*Handler) GetSyncCrossTransaction ¶
func (*Handler) ListLocalCrossTransactionBySender ¶
func (*Handler) Query ¶
func (h *Handler) Query() (map[uint64][]*cc.CrossTransactionWithSignatures, map[uint64][]*cc.CrossTransactionWithSignatures)
func (*Handler) SyncCrossTransaction ¶
func (h *Handler) SyncCrossTransaction(ctx []*cc.CrossTransactionWithSignatures) int
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) CtxList ¶
func (s *PublicCrossChainAPI) CtxList(ctx context.Context, from common.Address) map[string]map[uint64][]*RPCCrossTransaction
func (*PublicCrossChainAPI) CtxOwner ¶
func (s *PublicCrossChainAPI) CtxOwner(ctx context.Context, from common.Address) map[string]map[uint64][]*RPCOwnerCrossTransaction
func (*PublicCrossChainAPI) CtxQuery ¶
func (s *PublicCrossChainAPI) CtxQuery(ctx context.Context, hash common.Hash) *RPCCrossTransaction
func (*PublicCrossChainAPI) CtxStats ¶
func (s *PublicCrossChainAPI) CtxStats() int
func (*PublicCrossChainAPI) CtxStatus ¶
func (s *PublicCrossChainAPI) CtxStatus() map[string]int
func (*PublicCrossChainAPI) GetLocalCtx ¶
func (s *PublicCrossChainAPI) GetLocalCtx(count uint64) map[uint64][]*RPCCrossTransaction
func (*PublicCrossChainAPI) GetRemoteCtx ¶
func (s *PublicCrossChainAPI) GetRemoteCtx(count uint64) map[uint64][]*RPCCrossTransaction
type RPCCrossTransaction ¶
type RPCCrossTransaction struct {
Value *hexutil.Big `json:"value"`
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"`
V []*hexutil.Big `json:"v"`
R []*hexutil.Big `json:"r"`
S []*hexutil.Big `json:"s"`
}
RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction
type RPCOwnerCrossTransaction ¶
type RPCOwnerCrossTransaction struct {
Value *hexutil.Big `json:"value"`
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 Validator ¶
type Validator func(cws *cc.CrossTransactionWithSignatures) error
Click to show internal directories.
Click to hide internal directories.