Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
tinman
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
hive
tinman
Commits
74a424b2
Commit
74a424b2
authored
6 years ago
by
Anthony Martin
Browse files
Options
Downloads
Patches
Plain Diff
fixed conversion factors on empty accounts #180
parent
f6d49352
No related branches found
No related tags found
2 merge requests
!2
Eclipse Update
,
!1
steem/tinman:develop
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+1
-3
1 addition, 3 deletions
.gitignore
test/test-no-main-accounts-snapshot.json
+15
-0
15 additions, 0 deletions
test/test-no-main-accounts-snapshot.json
test/txgen_test.py
+22
-1
22 additions, 1 deletion
test/txgen_test.py
tinman/txgen.py
+10
-2
10 additions, 2 deletions
tinman/txgen.py
with
48 additions
and
6 deletions
.gitignore
+
1
−
3
View file @
74a424b2
...
...
@@ -25,7 +25,7 @@ build
.DS_Store
*.swp
*.swo
*.json
/
*.json
*.conf
# Packages
...
...
@@ -56,5 +56,3 @@ build
.Trashes
ehthumbs.db
Thumbs.db
This diff is collapsed.
Click to expand it.
test/test-no-main-accounts-snapshot.json
0 → 100644
+
15
−
0
View file @
74a424b2
{
"metadata"
:{
"snapshot:semver"
:
"0.2"
,
"snapshot:origin_api"
:
"http://calculon.local"
},
"dynamic_global_properties"
:{
"total_vesting_fund_steem"
:{
"amount"
:
"196793227573"
,
"nai"
:
"@@000000021"
,
"precision"
:
3
}
},
"accounts"
:[],
"witnesses"
:[]
}
This diff is collapsed.
Click to expand it.
test/txgen_test.py
+
22
−
1
View file @
74a424b2
...
...
@@ -47,7 +47,7 @@ FULL_CONF = {
"
STEEM_TEMP_ACCOUNT
"
:
{
"
name
"
:
"
temp
"
}
}
}
class
TxgenTest
(
unittest
.
TestCase
):
def
test_create_system_accounts_bad_args
(
self
):
...
...
@@ -262,3 +262,24 @@ class TxgenTest(unittest.TestCase):
cmd
,
args
=
action
self
.
assertIn
(
'
Unsupported snapshot
'
,
str
(
ctx
.
exception
))
def
test_build_actions_no_main_accounts_snapshot
(
self
):
system_account_names
=
[
"
init-0
"
,
"
init-1
"
,
"
init-2
"
,
"
init-3
"
,
"
init-4
"
,
"
init-5
"
,
"
init-6
"
,
"
init-7
"
,
"
init-8
"
,
"
init-9
"
,
"
init-10
"
,
"
init-11
"
,
"
init-12
"
,
"
init-13
"
,
"
init-14
"
,
"
init-15
"
,
"
init-16
"
,
"
init-17
"
,
"
init-18
"
,
"
init-19
"
,
"
init-20
"
,
"
elect-0
"
,
"
elect-1
"
,
"
elect-2
"
,
"
elect-3
"
,
"
elect-4
"
,
"
elect-5
"
,
"
elect-6
"
,
"
elect-7
"
,
"
elect-8
"
,
"
elect-9
"
,
"
tnman
"
,
"
porter
"
]
shutil
.
copyfile
(
"
test-no-main-accounts-snapshot.json
"
,
"
/tmp/test-no-main-accounts-snapshot.json
"
)
conf
=
FULL_CONF
.
copy
()
conf
[
"
snapshot_file
"
]
=
"
/tmp/test-no-main-accounts-snapshot.json
"
for
action
in
txgen
.
build_actions
(
conf
):
cmd
,
args
=
action
if
cmd
==
"
submit_transaction
"
:
for
type
,
value
in
args
[
"
tx
"
][
"
operations
"
]:
if
type
==
'
account_create_operation
'
:
new_account_name
=
value
[
'
new_account_name
'
]
self
.
assertIn
(
new_account_name
,
system_account_names
)
This diff is collapsed.
Click to expand it.
tinman/txgen.py
+
10
−
2
View file @
74a424b2
...
...
@@ -206,8 +206,16 @@ def get_proportions(account_stats, conf, silent=True):
raise
RuntimeError
(
"
Increase total_port_balance or decrease min_vesting_per_account
"
)
total_port_vesting
=
(
avail_port_balance
*
total_vesting_steem
)
//
(
total_steem
+
total_vesting_steem
)
total_port_liquid
=
(
avail_port_balance
*
total_steem
)
//
(
total_steem
+
total_vesting_steem
)
vest_conversion_factor
=
(
DENOM
*
total_port_vesting
)
//
total_vests
steem_conversion_factor
=
(
DENOM
*
total_port_liquid
)
//
total_steem
if
total_vests
==
0
:
vest_conversion_factor
=
1
else
:
vest_conversion_factor
=
(
DENOM
*
total_port_vesting
)
//
total_vests
if
total_steem
==
0
:
steem_conversion_factor
=
1
else
:
steem_conversion_factor
=
(
DENOM
*
total_port_liquid
)
//
total_steem
if
not
silent
:
print
(
"
total_vests:
"
,
total_vests
)
...
...
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