Skip to content

Conversation

@MozirDmitriy
Copy link
Contributor

DiscoveryConfig.Bootnodes could be null and was concatenated using '+=' with chainspec bootnodes, producing a leading comma in the final enode list. At the same time the code tried to guard against a null ChainSpec.Bootnodes array using 'is not null', even though the array is always initialized by the chainspec loader.

Normalized discovery bootnodes handling by treating null and empty as the same state using string.IsNullOrEmpty and by relying on ChainSpec.Bootnodes.Length != 0 instead of a misleading null check. As a result, the merged bootnodes string is well-formed and better matches the actual contracts of both configs.


// Was in `UpdateDiscoveryConfig` step.
if (discoveryConfig.Bootnodes != string.Empty)
if (!string.IsNullOrEmpty(discoveryConfig.Bootnodes))
Copy link
Member

Choose a reason for hiding this comment

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

How this could be null as it is string.Empty by default?

@LukaszRozmej
Copy link
Member

it fails checks

@LukaszRozmej
Copy link
Member

Not worht it/meaningful in the end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants