Skip to content

Commit

Permalink
Merge pull request #15 from Chia-Network/farmer-harvester-types
Browse files Browse the repository at this point in the history
Farmer & Harvester types
  • Loading branch information
cmmarslender authored Jun 1, 2022
2 parents 821207e + 2cca729 commit ac08e12
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ type BlockEvent struct {
KSize uint8 `json:"k_size"`
HeaderHash string `json:"header_hash"`
Height uint32 `json:"height"`
ValidationTime float64 `json:"validation_time"`
PreValidationTime float64 `json:"pre_validation_time"`
BlockCost uint64 `json:"block_cost"`
BlockFees uint64 `json:"block_fees"`
TransactionGeneratorSizeBytes uint64 `json:"transaction_generator_size_bytes"`
Expand Down
29 changes: 29 additions & 0 deletions pkg/types/farmer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package types

// EventFarmerSubmittedPartial is the event data for `submitted_partial` from the farmer
type EventFarmerSubmittedPartial struct {
LauncherID string `json:"launcher_id"`
PoolURL string `json:"pool_url"`
CurrentDifficulty uint64 `json:"current_difficulty"`
PointsAcknowledgedSinceStart uint64 `json:"points_acknowledged_since_start"`
}

// EventFarmerProof is the farmer event `proof`
type EventFarmerProof struct {
Proof DeclareProofOfSpace `json:"proof"`
PassedFilter bool `json:"passed_filter"`
}

// DeclareProofOfSpace matches to the farmer protocol type
type DeclareProofOfSpace struct {
ChallengeHash string `json:"challenge_hash"`
ChallengeChainSP string `json:"challenge_chain_sp"`
SignagePointIndex uint8 `json:"signage_point_index"`
RewardChainSP string `json:"reward_chain_sp"`
ProofOfSpace ProofOfSpace `json:"proof_of_space"`
ChallengeChainSPSignature G2Element `json:"challenge_chain_sp_signature"`
RewardChainSPSignature G2Element `json:"reward_chain_sp_signature"`
FarmerPuzzleHash string `json:"farmer_puzzle_hash"`
PoolTarget *PoolTarget `json:"pool_target,omitempty"`
PoolSignature *G2Element `json:"pool_signature,omitempty"`
}
10 changes: 10 additions & 0 deletions pkg/types/harvester.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package types

// EventHarvesterFarmingInfo is the event data for `farming_info` from the harvester
type EventHarvesterFarmingInfo struct {
ChallengeHash string `json:"challenge_hash"`
TotalPlots uint64 `json:"total_plots"`
FoundProofs uint64 `json:"found_proofs"`
EligiblePlots uint64 `json:"eligible_plots"`
Time float64 `json:"time"`
}
2 changes: 1 addition & 1 deletion pkg/websocketclient/websocketclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (c *WebsocketClient) AddDisconnectHandler(onDisconnect rpcinterface.Disconn
}

func (c *WebsocketClient) reconnectLoop() {
for _, handler := range c.disconnectHandlers{
for _, handler := range c.disconnectHandlers {
handler()
}
for {
Expand Down

0 comments on commit ac08e12

Please sign in to comment.