Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Node simpler #29

Merged
merged 30 commits into from
Mar 11, 2022
Merged

Node simpler #29

merged 30 commits into from
Mar 11, 2022

Conversation

BryceAgent
Copy link
Contributor

Refactor that also addresses several issues:

#28

see checkConnection

#26

see orderedBlockClients struct which associates all client properties together

…ys holding BlockClients, fixed array and dynamic functions
…onditional (in main as implemented always evaluates true)
manager/main.go Outdated
if m.miningAvailable[i] {
m.fetchPendingBlocks(i)
for _, blockClient := range m.orderedBlockClients {
if blockClient.chainMining && checkConnection(blockClient.chainAvailable) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have an explicit check for the current mining slice, even if one of the three clients is not available, we don't even get the pending blocks.

miningAvailable := make([]bool, 3)
func getMiningClients(config util.Config) ([]orderedBlockClient, int) {
allClients := []orderedBlockClient{}
var intendedCount int = 0 // count how many connections there should be for error checking
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in golang you dont have to initalize it as zero. It is default as zero.

@alanorwick alanorwick merged commit 62199ab into main Mar 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants