-
Notifications
You must be signed in to change notification settings - Fork 211
/
node.go
79 lines (67 loc) · 2.79 KB
/
node.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package api
import (
"context"
"time"
"github.com/spacemeshos/go-spacemesh/activation"
"github.com/spacemeshos/go-spacemesh/common/types"
"github.com/spacemeshos/go-spacemesh/p2p/pubsub"
)
// Publisher interface for publishing messages.
type Publisher = pubsub.Publisher
// PostSetupAPI is an alias to PostSetupProvider.
type PostSetupAPI = activation.PostSetupProvider
// SmeshingAPI is an alias to SmeshingProvider.
type SmeshingAPI = activation.SmeshingProvider
// GenesisTimeAPI is an API to get genesis time and current layer of the system.
type GenesisTimeAPI interface {
GetGenesisTime() time.Time
GetCurrentLayer() types.LayerID
}
// LoggingAPI is an API to system loggers.
type LoggingAPI interface {
SetLogLevel(loggerName, severity string) error
}
// Syncer is the API to get sync status and to start sync.
type Syncer interface {
IsSynced(context.Context) bool
Start(context.Context)
}
// TxAPI is an api for getting transaction status.
type TxAPI interface {
AddressExists(types.Address) bool
ValidateNonceAndBalance(*types.Transaction) error
GetATXs(context.Context, []types.ATXID) (map[types.ATXID]*types.ActivationTx, []types.ATXID)
GetLayer(types.LayerID) (*types.Layer, error)
GetRewards(types.Address) ([]types.Reward, error)
GetTransactions([]types.TransactionID) ([]*types.Transaction, map[types.TransactionID]struct{})
GetMeshTransactions([]types.TransactionID) ([]*types.MeshTransaction, map[types.TransactionID]struct{})
GetTransactionsByDestination(types.LayerID, types.Address) ([]types.TransactionID, error)
GetTransactionsByOrigin(types.LayerID, types.Address) ([]types.TransactionID, error)
LatestLayer() types.LayerID
GetLayerApplied(types.TransactionID) *types.LayerID
GetMeshTransaction(types.TransactionID) (*types.MeshTransaction, error)
GetProjection(types.Address, uint64, uint64) (uint64, uint64, error)
LatestLayerInState() types.LayerID
ProcessedLayer() types.LayerID
GetStateRoot() types.Hash32
GetLayerStateRoot(types.LayerID) (types.Hash32, error)
GetBalance(types.Address) uint64
GetNonce(types.Address) uint64
GetAllAccounts() (*types.MultipleAccountsState, error)
GetRewardsBySmesherID(types.NodeID) ([]types.Reward, error)
// TODO: fix the discrepancy between SmesherID and NodeID (see https://github.com/spacemeshos/go-spacemesh/issues/2269)
}
// PeerCounter is an api to get amount of connected peers.
type PeerCounter interface {
PeerCount() uint64
}
// MempoolAPI is an API for reading mempool data that's useful for API services.
type MempoolAPI interface {
Get(types.TransactionID) (*types.Transaction, error)
GetTxsByAddress(types.Address) []*types.Transaction
GetProjection(types.Address, uint64, uint64) (uint64, uint64)
}
// ActivationAPI is an API for activation module.
type ActivationAPI interface {
UpdatePoETServer(context.Context, string) error
}