Documentation
¶
Index ¶
- Variables
- func WithNode(config Config, peers *PeersList, peerUpdates <-chan PeerInfo, ...) error
- func WithRpcServer(hostPort string, handlers map[string]interface{}, callback func() error) error
- type API
- type Account
- type Block
- type BlockTemplate
- type Config
- type Connection
- type Node
- type Operation
- type Peer
- type PeerInfo
- type PeersList
- func (this *PeersList) Add(address string, peer *Peer) bool
- func (this *PeersList) AddSerialized(serialized []byte) error
- func (p *PeersList) Forbid(address string)
- func (this *PeersList) GetAllSeen() map[string]Peer
- func (this *PeersList) ScheduleReconnect(maxActive int) []*Peer
- func (this *PeersList) SetDisconnected(peer *Peer)
- type SubmitBlock
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDuplicateConnection = errors.New("Duplicate connection") ErrLoopbackConnection = errors.New("Loopback connection") )
Functions ¶
Types ¶
type API ¶
type API interface {
GetBlockCount(ctx context.Context) (int, error)
GetBlock(ctx context.Context, params *struct{ Block uint32 }) (*Block, error)
GetAccount(ctx context.Context, params *struct{ Account uint32 }) (*Account, error)
GetPending(ctx context.Context) ([]Operation, error)
ExecuteOperations(ctx context.Context, params *struct{ RawOperations string }) (bool, error)
FindOperation(ctx context.Context, params *struct{ Ophash string }) (*Operation, error)
GetAccountOperations(ctx context.Context, params *struct{ Account uint32 }) ([]Operation, error)
GetBlockOperations(ctx context.Context, params *struct{ Block uint32 }) ([]Operation, error)
GetBlockTemplate(_ context.Context, params *struct {
Reserve_size uint64
Wallet_address string
}) (*BlockTemplate, error)
SubmitBlock(_ context.Context, params []string) (*SubmitBlock, error)
}
type Block ¶
type Block struct {
Block uint32 `json:"block"`
EncPubkey string `json:"enc_pubkey"`
Fee float64 `json:"fee"`
Hashratekhs uint64 `json:"hashratekhs"`
Maturation uint32 `json:"maturation"`
Nonce uint32 `json:"nonce"`
Operations uint64 `json:"operations"`
Oph string `json:"oph"`
Payload string `json:"payload"`
Pow string `json:"pow"`
Reward float64 `json:"reward"`
Sbh string `json:"sbh"`
Target uint32 `json:"target"`
Timestamp uint32 `json:"timestamp"`
Ver uint16 `json:"ver"`
VerA uint16 `json:"ver_a"`
}
type BlockTemplate ¶
type BlockTemplate struct {
Difficulty uint64 `json:"difficulty"`
Height uint64 `json:"height"`
Reserved_offset uint64 `json:"reserved_offset"`
Expected_reward uint64 `json:"expected_reward"`
Prev_hash string `json:"prev_hash"`
Blocktemplate_blob string `json:"blocktemplate_blob"`
Blockhashing_blob string `json:"blockhashing_blob"`
Status string `json:"status"`
}
type Connection ¶
type Connection struct {
Address string
Outgoing bool
Transport io.ReadWriteCloser
OnStateUpdated func()
}
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) AddPeerSerialized ¶
type Operation ¶
type Operation struct {
Account uint32 `json:"account"`
Amount float64 `json:"amount"`
Block uint32 `json:"block"`
Dest_account uint32 `json:"dest_account"`
Fee float64 `json:"fee"`
Opblock uint32 `json:"opblock"`
Ophash string `json:"ophash"`
Optxt *string `json:"optxt"`
Optype uint8 `json:"optype"`
Payload string `json:"payload"`
Sender_account uint32 `json:"sender_account"`
Time uint32 `json:"time"`
}
type PeersList ¶
type PeersList struct {
Connected map[string]*Peer
Forbidden map[string]struct{}
Queued *ordered_map.OrderedMap
Lock sync.RWMutex
}
func NewPeersList ¶
func NewPeersList() *PeersList
func (*PeersList) AddSerialized ¶
func (*PeersList) GetAllSeen ¶
func (*PeersList) ScheduleReconnect ¶
func (*PeersList) SetDisconnected ¶
type SubmitBlock ¶
type SubmitBlock struct {
Status string `json:"status"`
}
Click to show internal directories.
Click to hide internal directories.