Skip to content
GitLab
Explore
Sign in
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
c9556140
Commit
c9556140
authored
6 years ago
by
Anthony Martin
Browse files
Options
Downloads
Patches
Plain Diff
backfill signals #165
parent
910179ae
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tinman/submit.py
+24
-12
24 additions, 12 deletions
tinman/submit.py
tinman/txgen.py
+5
-0
5 additions, 0 deletions
tinman/txgen.py
tinman/util.py
+1
-1
1 addition, 1 deletion
tinman/util.py
with
30 additions
and
13 deletions
tinman/submit.py
+
24
−
12
View file @
c9556140
...
...
@@ -19,6 +19,7 @@ from . import util
ACTIONS_MAJOR_VERSION_SUPPORTED
=
0
ACTIONS_MINOR_VERSION_SUPPORTED
=
2
STEEM_BLOCK_INTERVAL
=
3
class
TransactionSigner
(
object
):
def
__init__
(
self
,
sign_transaction_exe
=
None
,
chain_id
=
None
):
...
...
@@ -168,19 +169,30 @@ def main(argv):
try
:
if
cmd
==
"
metadata
"
:
metadata
=
args
transactions_per_block
=
metadata
.
get
(
"
txgen:transactions_per_block
"
,
transactions_per_block
)
semver
=
metadata
.
get
(
"
txgen:semver
"
,
'
0.0
'
)
major_version
,
minor_version
=
semver
.
split
(
'
.
'
)
major_version
=
int
(
major_version
)
minor_version
=
int
(
minor_version
)
if
major_version
==
ACTIONS_MAJOR_VERSION_SUPPORTED
:
print
(
"
metadata:
"
,
metadata
)
else
:
raise
RuntimeError
(
"
Unsupported actions:
"
,
metadata
)
if
args
.
get
(
"
post_backfill
"
):
dgpo
=
cached_dgpo
.
get
()
now
=
datetime
.
datetime
.
utcnow
()
head_block_time
=
datetime
.
datetime
.
strptime
(
dgpo
[
"
time
"
],
"
%Y-%m-%dT%H:%M:%S
"
)
join_head
=
int
((
now
-
head_block_time
).
total_seconds
())
//
STEEM_BLOCK_INTERVAL
if
minor_version
<
ACTIONS_MINOR_VERSION_SUPPORTED
:
print
(
"
WARNING: Older actions encountered.
"
,
file
=
sys
.
stderr
)
if
join_head
>
STEEM_BLOCK_INTERVAL
:
generate_blocks
(
steemd
,
{
"
count
"
:
join_head
},
cached_dgpo
=
cached_dgpo
,
produce_realtime
=
produce_realtime
)
cached_dgpo
.
reset
()
else
:
transactions_per_block
=
metadata
.
get
(
"
txgen:transactions_per_block
"
,
transactions_per_block
)
semver
=
metadata
.
get
(
"
txgen:semver
"
,
'
0.0
'
)
major_version
,
minor_version
=
semver
.
split
(
'
.
'
)
major_version
=
int
(
major_version
)
minor_version
=
int
(
minor_version
)
if
major_version
==
ACTIONS_MAJOR_VERSION_SUPPORTED
:
print
(
"
metadata:
"
,
metadata
)
else
:
raise
RuntimeError
(
"
Unsupported actions:
"
,
metadata
)
if
minor_version
<
ACTIONS_MINOR_VERSION_SUPPORTED
:
print
(
"
WARNING: Older actions encountered.
"
,
file
=
sys
.
stderr
)
elif
cmd
==
"
wait_blocks
"
:
if
metadata
and
args
.
get
(
"
count
"
)
==
1
and
args
.
get
(
"
miss_blocks
"
):
if
args
[
"
miss_blocks
"
]
<
metadata
[
"
recommend:miss_blocks
"
]:
...
...
This diff is collapsed.
Click to expand it.
tinman/txgen.py
+
5
−
0
View file @
c9556140
...
...
@@ -30,6 +30,7 @@ NUM_BLOCKS_TO_CLEAR_WITNESS_ROUND = 21
TRANSACTION_WITNESS_SETUP_PAD
=
100
STEEM_MAX_AUTHORITY_MEMBERSHIP
=
10
DENOM
=
10
**
12
# we need stupidly high precision because VESTS
STEEM_BLOCKS_PER_DAY
=
28800
def
create_system_accounts
(
conf
,
keydb
,
name
):
desc
=
conf
[
"
accounts
"
][
name
]
...
...
@@ -431,6 +432,8 @@ def build_actions(conf, silent=True):
if
num_lines
>
0
:
metadata
[
"
backfill_actions:count
"
]
=
num_lines
metadata
[
"
actions:count
"
]
+=
num_lines
miss_blocks
-=
max
(
num_lines
//
transactions_per_block
,
STEEM_BLOCKS_PER_DAY
*
30
)
metadata
[
"
recommend:miss_blocks
"
]
=
miss_blocks
has_backfill
=
True
yield
[
"
metadata
"
,
metadata
]
...
...
@@ -444,6 +447,8 @@ def build_actions(conf, silent=True):
with
open
(
backfill_file
,
"
r
"
)
as
f
:
for
line
in
f
:
yield
json
.
loads
(
line
)
yield
[
"
metadata
"
,
{
"
post_backfill
"
:
True
}]
for
tx
in
update_witnesses
(
conf
,
keydb
,
"
init
"
):
yield
[
"
submit_transaction
"
,
{
"
tx
"
:
tx
}]
...
...
This diff is collapsed.
Click to expand it.
tinman/util.py
+
1
−
1
View file @
c9556140
...
...
@@ -130,7 +130,7 @@ def action_to_str(action):
This serializes actions, picking a string that does not occur in the JSON
serialization to escape public/private key notes.
"""
if
"
esc
"
in
action
:
if
action
and
action
[
1
]
and
"
esc
"
in
action
[
1
]
:
return
json
.
dumps
(
action
,
separators
=
(
"
,
"
,
"
:
"
),
sort_keys
=
True
)
json_empty_esc
=
json
.
dumps
(
action
,
separators
=
(
"
,
"
,
"
:
"
),
default
=
prockey
.
PubkeySerializer
(
esc
=
""
),
sort_keys
=
True
)
...
...
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