forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ethereum#58 from status-im/feature/ulc-config-refa…
…ctoring-#52 config refactoring
- Loading branch information
Showing
13 changed files
with
77 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,9 @@ | ||
package eth | ||
|
||
import ( | ||
"github.com/ethereum/go-ethereum/log" | ||
"github.com/ethereum/go-ethereum/p2p" | ||
"github.com/ethereum/go-ethereum/p2p/discover" | ||
) | ||
|
||
const defaultUTCMinTrustedFraction = 75 | ||
const DefaultUTCMinTrustedFraction = 75 | ||
|
||
// ULCConfig is a Ultra Light client options. | ||
type ULCConfig struct { | ||
TrustedNodes []string `toml:",omitempty"` // A list of trusted servers | ||
TrustedServers []string `toml:",omitempty"` // A list of trusted servers | ||
MinTrustedFraction int `toml:",omitempty"` // Minimum percentage of connected trusted servers to validate trusted (1-100) | ||
} | ||
|
||
// SetULC properties into eth and p2p configs. | ||
func SetULC(ulc *ULCConfig, p2pCfg *p2p.Config) { | ||
if ulc == nil || len(ulc.TrustedNodes) == 0 { | ||
return | ||
} | ||
|
||
if ulc.MinTrustedFraction < 0 || ulc.MinTrustedFraction >= 100 { | ||
ulc.MinTrustedFraction = defaultUTCMinTrustedFraction | ||
} | ||
|
||
p2pCfg.TrustedNodes = make([]*discover.Node, 0, len(ulc.TrustedNodes)) | ||
for _, url := range ulc.TrustedNodes { | ||
node, err := discover.ParseNode(url) | ||
if err != nil { | ||
log.Error("Trusted node URL invalid", "enode", url, "err", err) | ||
continue | ||
} | ||
p2pCfg.TrustedNodes = append(p2pCfg.TrustedNodes, node) | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters