Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Scheduling Scripts
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
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
xx network
Scheduling Scripts
Commits
67c80cb3
Commit
67c80cb3
authored
Jun 23, 2022
by
Jonah Husson
Browse files
Options
Downloads
Patches
Plain Diff
Points should maintain an external list of wallet to country mappings
parent
aaa01e07
Branches
Branches containing commit
No related tags found
1 merge request
!10
Points should maintain an external list of wallet to country mappings
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
points.py
+22
-1
22 additions, 1 deletion
points.py
with
22 additions
and
1 deletion
points.py
+
22
−
1
View file @
67c80cb3
...
...
@@ -28,6 +28,8 @@ state_key = "consensus_points_timestamp" # Static key used for states table
positive_points_func
=
'
submit_cmix_points
'
negative_points_func
=
'
submit_cmix_deductions
'
raw_points_log
=
''
wallet_list_path
=
''
wallet_list
=
None
#################
...
...
@@ -127,6 +129,8 @@ def process_period(conn, substrate, keypair, point_info, start_period, end_perio
# Calculate points for the retrieved round information
wallet_points
,
raw_points
=
round_point_computation
(
point_info
,
round_info
,
active_nodes
)
update_wallet_country_list
(
active_nodes
,
wallet_list_path
)
# Define Lists
positive
=
[]
negative
=
[]
...
...
@@ -412,7 +416,7 @@ def get_args():
get_args controls the argparse usage for the script. It sets up and parses
arguments and returns them in dict format
"""
global
raw_points_log
global
raw_points_log
,
wallet_list_path
parser
=
argparse
.
ArgumentParser
(
description
=
"
Options for point assignment script
"
)
parser
.
add_argument
(
"
--verbose
"
,
action
=
"
store_true
"
,
help
=
"
Print debug logs
"
,
default
=
False
)
...
...
@@ -441,6 +445,7 @@ def get_args():
default
=
"
cmix
"
)
parser
.
add_argument
(
"
--pass
"
,
type
=
str
,
help
=
"
DB password
"
)
parser
.
add_argument
(
"
--wallet-list-path
"
,
type
=
str
,
help
=
"
List of wallet-country
"
)
args
=
vars
(
parser
.
parse_args
())
log
.
basicConfig
(
format
=
'
[%(levelname)s] %(asctime)s: %(message)s
'
,
...
...
@@ -448,6 +453,7 @@ def get_args():
datefmt
=
'
%d-%b-%y %H:%M:%S
'
,
filename
=
args
[
"
log
"
])
raw_points_log
=
args
[
'
raw_points_log
'
]
wallet_list_path
=
args
[
'
wallet_list_path
'
]
return
args
...
...
@@ -474,6 +480,21 @@ def parse_bins(countries_list):
return
ret
def
update_wallet_country_list
(
active_nodes
,
list_path
):
global
wallet_list
with
open
(
list_path
,
"
a+
"
)
as
f
:
if
not
wallet_list
:
wallet_list
=
{}
lines
=
f
.
readlines
()
for
line
in
lines
:
parts
=
line
.
split
(
"
,
"
)
wallet_list
[
parts
[
0
]]
=
wallet_list
[
parts
[
1
]]
for
line
in
active_nodes
:
if
line
[
0
]
not
in
wallet_list
:
wallet_list
[
line
[
0
]]
=
line
[
2
]
f
.
write
(
f
"
{
line
[
0
]
}
,
{
line
[
2
]
}
\n
"
)
########################
# Connection Functions #
########################
...
...
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