Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ğecko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kapis
Ğecko
Commits
d3e52ae3
Commit
d3e52ae3
authored
4 years ago
by
poka
Browse files
Options
Downloads
Patches
Plain Diff
amend todo
parent
97558c9f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/models/home.dart
+17
-6
17 additions, 6 deletions
lib/models/home.dart
with
17 additions
and
6 deletions
lib/models/home.dart
+
17
−
6
View file @
d3e52ae3
import
'dart:collection'
;
import
'dart:convert'
;
import
'dart:io'
;
import
'dart:math'
;
...
...
@@ -49,13 +50,23 @@ class HomeProvider with ChangeNotifier {
}
Future
<
List
<
String
>>
scanNetwork
()
async
{
// TODO: return 5 endpoints from current window
// - Request all bootstrap endpoints to get theres current bloc number and hash, and theres known endpoinds
// - Store them in the Map endpoints with all endpoints sorted by highest current bloc with
// - Request all endpoints known by the last slave, only theses we don't even know
// - Do it 3 times, and return 5 highest endpoints, only theses in the current window (exclude these with another hashs)
// TODO: return all known endpoints from current window
// - Request all bootstrap endpoints to get theres current bloc number and hash (blockstamps), and theres known endpoinds
// - Store them in an ordered Map (SplayTreeMap<Blockstamp, HashSet<String>>) (the HashSet is a endpoint)
// - Request 5 randoms endpoints known by the last slave, only theses we don't even know
// - Do it 3 times
// - We iterate the Map to determinat the consensus with for loop, intinital consensus variable to null
// - if consensus == null -> if blockstamp > (1/3 known endpoints) -> consensus = blockstamp
// - elif blockstamp.number == consensus.number && blockstamp.endpointNumbers > consensus.endpointNumbers -> consensus = blockstamp
// - else break;
// - return map.get(key: consensus).toList
var
endpoints
=
SplayTreeMap
<
String
,
HashSet
<
String
>>();
for
(
String
endpoint
in
endPointGVA
)
{
// gva request
}
var
endpoints
=
Map
();
List
<
String
>
currentWindow
=
[];
return
currentWindow
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment