Documentation ¶
Index ¶
- Constants
- type Blockchain
- type Client
- type ClientFactory
- type Host
- func (host *Host) AddTransactions(request *neighborhood.TransactionRequest)
- func (host *Host) Amount(request *neighborhood.AmountRequest) (res p2p.Data)
- func (host *Host) GetBlocks() (res p2p.Data)
- func (host *Host) GetTransactions() (res p2p.Data)
- func (host *Host) PostTargets(request []neighborhood.TargetRequest)
- func (host *Host) Run() error
- type Neighbor
- func (neighbor *Neighbor) AddTransaction(request neighborhood.TransactionRequest) (err error)
- func (neighbor *Neighbor) GetAmount(request neighborhood.AmountRequest) (amountResponse *neighborhood.AmountResponse, err error)
- func (neighbor *Neighbor) GetBlocks() (blockResponses []*neighborhood.BlockResponse, err error)
- func (neighbor *Neighbor) GetTransactions() (transactionResponses []neighborhood.TransactionResponse, err error)
- func (neighbor *Neighbor) Ip() string
- func (neighbor *Neighbor) Mine() (err error)
- func (neighbor *Neighbor) Port() uint16
- func (neighbor *Neighbor) SendTargets(request []neighborhood.TargetRequest) (err error)
- func (neighbor *Neighbor) StartMining() (err error)
- func (neighbor *Neighbor) StopMining() (err error)
- func (neighbor *Neighbor) Target() string
- type Server
- type Synchronizer
- func (synchronizer *Synchronizer) AddTargets(targetRequests []neighborhood.TargetRequest)
- func (synchronizer *Synchronizer) Neighbors() []neighborhood.Neighbor
- func (synchronizer *Synchronizer) StartSynchronization()
- func (synchronizer *Synchronizer) Synchronize()
- func (synchronizer *Synchronizer) Wait()
- type Target
- type TransactionsPool
- type Validator
Constants ¶
View Source
const ( // TODO rename and extract ParticlesCount to a config file ParticlesCount = 100000000 GetBlocksRequest = "GET BLOCKS REQUEST" GetTransactionsRequest = "GET TRANSACTIONS REQUEST" MineRequest = "MINE REQUEST" StartMiningRequest = "START MINING REQUEST" StopMiningRequest = "STOP MINING REQUEST" )
View Source
const (
DefaultPort = 8106
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blockchain ¶
type Blockchain interface { Verify() StartVerification() Blocks() []*neighborhood.BlockResponse CalculateTotalAmount(currentTimestamp int64, blockchainAddress string) uint64 AddBlock(blockResponse *neighborhood.BlockResponse) }
type ClientFactory ¶ added in v1.0.3
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
func NewHost ¶
func NewHost( server Server, blockchain Blockchain, pool TransactionsPool, validator Validator, synchronizer *Synchronizer, watch clock.Time, logger *log.Logger, ) *Host
func (*Host) AddTransactions ¶
func (host *Host) AddTransactions(request *neighborhood.TransactionRequest)
func (*Host) Amount ¶
func (host *Host) Amount(request *neighborhood.AmountRequest) (res p2p.Data)
func (*Host) GetTransactions ¶
func (*Host) PostTargets ¶
func (host *Host) PostTargets(request []neighborhood.TargetRequest)
type Neighbor ¶
type Neighbor struct {
// contains filtered or unexported fields
}
func NewNeighbor ¶
func (*Neighbor) AddTransaction ¶
func (neighbor *Neighbor) AddTransaction(request neighborhood.TransactionRequest) (err error)
func (*Neighbor) GetAmount ¶
func (neighbor *Neighbor) GetAmount(request neighborhood.AmountRequest) (amountResponse *neighborhood.AmountResponse, err error)
func (*Neighbor) GetBlocks ¶
func (neighbor *Neighbor) GetBlocks() (blockResponses []*neighborhood.BlockResponse, err error)
func (*Neighbor) GetTransactions ¶
func (neighbor *Neighbor) GetTransactions() (transactionResponses []neighborhood.TransactionResponse, err error)
func (*Neighbor) SendTargets ¶
func (neighbor *Neighbor) SendTargets(request []neighborhood.TargetRequest) (err error)
func (*Neighbor) StartMining ¶
func (*Neighbor) StopMining ¶
type Synchronizer ¶
type Synchronizer struct {
// contains filtered or unexported fields
}
func NewSynchronizer ¶
func NewSynchronizer(hostPort uint16, time clock.Time, clientFactory ClientFactory, configurationPath string, logger *log.Logger) (synchronizer *Synchronizer, err error)
func (*Synchronizer) AddTargets ¶
func (synchronizer *Synchronizer) AddTargets(targetRequests []neighborhood.TargetRequest)
func (*Synchronizer) Neighbors ¶
func (synchronizer *Synchronizer) Neighbors() []neighborhood.Neighbor
func (*Synchronizer) StartSynchronization ¶
func (synchronizer *Synchronizer) StartSynchronization()
func (*Synchronizer) Synchronize ¶
func (synchronizer *Synchronizer) Synchronize()
func (*Synchronizer) Wait ¶
func (synchronizer *Synchronizer) Wait()
type TransactionsPool ¶
type TransactionsPool interface { AddTransaction(transactionRequest *neighborhood.TransactionRequest, blockchain Blockchain, neighbors []neighborhood.Neighbor) Transactions() []*neighborhood.TransactionResponse }
Click to show internal directories.
Click to hide internal directories.