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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tools
py-g1-migrator
Commits
c7432d85
Commit
c7432d85
authored
1 year ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
fix: remove address switches
parent
92f9bc09
No related branches found
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
generate_transactions_history.py
+2
-7
2 additions, 7 deletions
generate_transactions_history.py
lib/functions.py
+1
-12
1 addition, 12 deletions
lib/functions.py
with
3 additions
and
19 deletions
generate_transactions_history.py
+
2
−
7
View file @
c7432d85
...
...
@@ -21,7 +21,6 @@ print("Generate v2s-indexer up-to-date Ğ1 history transactions")
history_final
=
{}
history_brut
=
load_json_url
(
'
inputs/transactions_history.json
'
)
addresses_switches
=
load_json
(
'
custom/addresses_switches.json
'
)
for
transaction
in
history_brut
:
written_time
=
transaction
[
'
time
'
]
...
...
@@ -38,12 +37,8 @@ for transaction in history_brut:
receiver_pubkey_lenght
=
len
(
receiver_pubkey_bytes
)
if
issuer_pubkey_lenght
>
32
or
receiver_pubkey_lenght
>
32
:
continue
issuer
=
v1_pubkey_to_v2_address
(
issuer_v1
)
receiver
=
v1_pubkey_to_v2_address
(
receiver_v1
)
for
switches
in
addresses_switches
:
if
issuer_v1
in
switches
[
'
v1
'
]:
issuer
=
switches
[
'
v2
'
]
if
receiver_v1
in
switches
[
'
v1
'
]:
receiver
=
switches
[
'
v2
'
]
issuer
=
issuer_v1
receiver
=
receiver_v1
comment
=
transaction
[
'
comment
'
]
...
...
This diff is collapsed.
Click to expand it.
lib/functions.py
+
1
−
12
View file @
c7432d85
...
...
@@ -46,7 +46,7 @@ def get_wallets_data(leveldb_path: str) -> tuple:
ignored_money
+=
balance
continue
wallets
.
update
({
v1_
pubkey
_to_v2_address
(
pubkey
)
:
int
(
balance
)})
wallets
.
update
({
pubkey
:
int
(
balance
)})
total_money
+=
balance
return
wallets
,
total_money
,
ignored_money
...
...
@@ -80,8 +80,6 @@ def get_identities_and_wallets(start_timestamp: int, leveldb_path: str) -> tuple
certifications_repository
=
LevelDBCertificationsRepository
(
leveldb_path
)
blocks_repository
=
LevelDBBlocksRepository
(
leveldb_path
)
# Get identities switches
addresses_switches
=
load_json
(
"
custom/addresses_switches.json
"
)
# Get custom identities
custom_identities
=
load_json
(
"
custom/identities.json
"
)
...
...
@@ -133,13 +131,6 @@ def get_identities_and_wallets(start_timestamp: int, leveldb_path: str) -> tuple
"
certs_received
"
:
{},
}
# Switch address to custom if exist
if
uid
in
addresses_switches
.
keys
():
identities
[
uid
][
"
owner_key
"
]
=
addresses_switches
[
uid
][
"
v2
"
]
identities
[
uid
][
"
old_owner_key
"
]
=
v1_pubkey_to_v2_address
(
addresses_switches
[
uid
][
"
v1
"
]
)
# Add custom identities
identities
.
update
(
custom_identities
)
...
...
@@ -150,7 +141,6 @@ def get_identities_and_wallets(start_timestamp: int, leveldb_path: str) -> tuple
# get certifications updated to their last state
for
i_pubkey
,
issuer
in
certifications_repository
:
i_uid
=
identity_names
[
i_pubkey
]
i_address
=
v1_pubkey_to_v2_address
(
i_pubkey
)
# get certifications updated to their last state
for
cert
in
issuer
[
"
issued
"
]:
...
...
@@ -160,7 +150,6 @@ def get_identities_and_wallets(start_timestamp: int, leveldb_path: str) -> tuple
r_pubkey
=
cert
[
"
receiver
"
]
r_uid
=
identity_names
[
r_pubkey
]
r_address
=
v1_pubkey_to_v2_address
(
r_pubkey
)
# get expiration of certification
# timestamp of cert creation
...
...
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