Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
py-g1-migrator
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tools
py-g1-migrator
Commits
3b766e0e
Commit
3b766e0e
authored
1 year ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
fix: do not convert timestamps to Duniter V2 block number
parent
c7432d85
Branches
Branches containing commit
No related tags found
1 merge request
!4
import data from Duniter 1.8 leveldb database
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/functions.py
+4
-6
4 additions, 6 deletions
lib/functions.py
main.py
+1
-1
1 addition, 1 deletion
main.py
with
5 additions
and
7 deletions
lib/functions.py
+
4
−
6
View file @
3b766e0e
...
@@ -7,7 +7,7 @@ from adapters.duniter_v18.memberships import LevelDBMembershipsRepository
...
@@ -7,7 +7,7 @@ from adapters.duniter_v18.memberships import LevelDBMembershipsRepository
from
adapters.duniter_v18.wallets
import
LevelDBWalletsRepository
from
adapters.duniter_v18.wallets
import
LevelDBWalletsRepository
from
adapters.duniter_v18.ud_value
import
LevelDBUDValueRepository
from
adapters.duniter_v18.ud_value
import
LevelDBUDValueRepository
from
custom.parameters
import
CERT_PERIOD
,
CERT_MIN_RECEIVED_CERT_TO_ISSUE_CERT
from
custom.parameters
import
CERT_PERIOD
,
CERT_MIN_RECEIVED_CERT_TO_ISSUE_CERT
from
lib.utility
import
v1_pubkey_to_v2_address
,
load_json
,
date_to_bloc_number
from
lib.utility
import
load_json
def
get_wallets_data
(
leveldb_path
:
str
)
->
tuple
:
def
get_wallets_data
(
leveldb_path
:
str
)
->
tuple
:
...
@@ -108,7 +108,7 @@ def get_identities_and_wallets(start_timestamp: int, leveldb_path: str) -> tuple
...
@@ -108,7 +108,7 @@ def get_identities_and_wallets(start_timestamp: int, leveldb_path: str) -> tuple
uid
=
identity
[
"
uid
"
]
uid
=
identity
[
"
uid
"
]
is_member
=
identity
[
"
member
"
]
is_member
=
identity
[
"
member
"
]
identity_names
[
pubkey
]
=
uid
identity_names
[
pubkey
]
=
uid
membership_expire_on
=
date_to_bloc_number
(
memberships_repository
.
get
(
pubkey
)[
"
expires_on
"
]
,
start_timestamp
)
membership_expire_on
=
memberships_repository
.
get
(
pubkey
)[
"
expires_on
"
]
if
membership_expire_on
<
0
:
if
membership_expire_on
<
0
:
membership_expire_on
=
0
# forget old expiry date
membership_expire_on
=
0
# forget old expiry date
...
@@ -154,13 +154,11 @@ def get_identities_and_wallets(start_timestamp: int, leveldb_path: str) -> tuple
...
@@ -154,13 +154,11 @@ def get_identities_and_wallets(start_timestamp: int, leveldb_path: str) -> tuple
# get expiration of certification
# get expiration of certification
# timestamp of cert creation
# timestamp of cert creation
created_at
=
blocks_repository
.
get
(
cert
[
"
created_on
"
])[
"
medianTime
"
]
created_at
=
blocks_repository
.
get
(
cert
[
"
created_on
"
])[
"
medianTime
"
]
# block of cert creation
created_on
=
date_to_bloc_number
(
created_at
,
start_timestamp
)
# block of next issuable cert
# block of next issuable cert
next_issuable_on
=
created_
on
+
CERT_PERIOD
next_issuable_on
=
created_
at
+
CERT_PERIOD
# timestamp of cert expiration
# timestamp of cert expiration
cert_expire_at
=
cert
[
"
expires_on
"
]
cert_expire_at
=
cert
[
"
expires_on
"
]
cert_expire_on
=
date_to_bloc_number
(
cert_expire_at
,
start_timestamp
)
cert_expire_on
=
cert_expire_at
# if certification expiration date is before export,
# if certification expiration date is before export,
# it is a renewed certification and can be ignored
# it is a renewed certification and can be ignored
...
...
This diff is collapsed.
Click to expand it.
main.py
+
1
−
1
View file @
3b766e0e
...
@@ -57,7 +57,7 @@ def main():
...
@@ -57,7 +57,7 @@ def main():
last_block_time
=
last_block
[
"
medianTime
"
]
last_block_time
=
last_block
[
"
medianTime
"
]
first_ud_value
=
last_block
[
"
dividend
"
]
first_ud_value
=
last_block
[
"
dividend
"
]
first_ud_reeval
=
date_to_bloc_number
(
last_block
[
"
udReevalTime
"
]
,
start_timestamp
)
first_ud_reeval
=
last_block
[
"
udReevalTime
"
]
inital_monetary_mass
=
last_block
[
"
mass
"
]
inital_monetary_mass
=
last_block
[
"
mass
"
]
last_block_time
=
last_block
[
"
medianTime
"
]
last_block_time
=
last_block
[
"
medianTime
"
]
...
...
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