Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
hivemind
Commits
da70ba3d
Commit
da70ba3d
authored
5 years ago
by
roadscape
Browse files
Options
Downloads
Patches
Plain Diff
tidy custom_json op auth read
parent
ce150a56
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hive/indexer/custom_op.py
+17
-9
17 additions, 9 deletions
hive/indexer/custom_op.py
with
17 additions
and
9 deletions
hive/indexer/custom_op.py
+
17
−
9
View file @
da70ba3d
...
...
@@ -17,6 +17,21 @@ DB = Db.instance()
log
=
logging
.
getLogger
(
__name__
)
def
_get_auth
(
op
):
"""
get account name submitting a custom_json op.
Hive custom_json op processing requires `required_posting_auths`
is always used and length 1. It may be that some ops will require
`required_active_auths` in the future. For now, these are ignored.
"""
if
op
[
'
required_active_auths
'
]:
log
.
warning
(
"
unexpected active auths: %s
"
,
op
)
return
None
if
len
(
op
[
'
required_posting_auths
'
])
!=
1
:
log
.
warning
(
"
unexpected auths: %s
"
,
op
)
return
None
return
op
[
'
required_posting_auths
'
][
0
]
class
CustomOp
:
"""
Processes custom ops and dispatches updates.
"""
...
...
@@ -27,18 +42,11 @@ class CustomOp:
if
op
[
'
id
'
]
not
in
[
'
follow
'
,
'
com.steemit.community
'
]:
continue
# we assume `required_posting_auths` is always used and length 1.
# it may be that some ops require `required_active_auths` instead.
# (e.g. if we use that route for admin action of acct creation)
# if op['required_active_auths']:
# log.warning("unexpected active auths: %s" % op)
if
len
(
op
[
'
required_posting_auths
'
])
!=
1
:
log
.
warning
(
"
unexpected auths: %s
"
,
op
)
account
=
_get_auth
(
op
)
if
not
account
:
continue
account
=
op
[
'
required_posting_auths
'
][
0
]
op_json
=
load_json_key
(
op
,
'
json
'
)
if
op
[
'
id
'
]
==
'
follow
'
:
if
block_num
<
6000000
and
not
isinstance
(
op_json
,
list
):
op_json
=
[
'
follow
'
,
op_json
]
# legacy compat
...
...
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