Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jussi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
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
jussi
Commits
bf654bc2
Commit
bf654bc2
authored
4 years ago
by
Dariusz Kędzierski
Browse files
Options
Downloads
Patches
Plain Diff
More generic validator
parent
72686810
No related branches found
No related tags found
3 merge requests
!9
finally merge old fixes with master
,
!6
cleanup merge
,
!3
Fix for key error when sending broadcast trx
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jussi/validators.py
+16
-12
16 additions, 12 deletions
jussi/validators.py
with
16 additions
and
12 deletions
jussi/validators.py
+
16
−
12
View file @
bf654bc2
...
@@ -184,18 +184,22 @@ def limit_broadcast_transaction_request(request: JSONRPCRequest, limits=None) ->
...
@@ -184,18 +184,22 @@ def limit_broadcast_transaction_request(request: JSONRPCRequest, limits=None) ->
else
:
else
:
raise
ValueError
(
raise
ValueError
(
f
'
Unknown request params type:
{
type
(
request
.
urn
.
params
)
}
urn:
{
request
.
urn
}
'
)
f
'
Unknown request params type:
{
type
(
request
.
urn
.
params
)
}
urn:
{
request
.
urn
}
'
)
ops
=
[
op
for
op
in
request_params
[
'
operations
'
]
if
op
[
'
type
'
]
==
'
custom_json
'
]
ops
=
[]
if
not
ops
:
for
op
in
request_params
[
'
operations
'
]:
return
if
isinstance
(
op
,
list
)
and
op
[
0
]
==
'
custom_json
'
:
blacklist_accounts
=
set
()
ops
.
append
(
op
)
try
:
if
isinstance
(
op
,
dict
)
and
op
[
'
type
'
]
==
'
custom_json
'
:
blacklist_accounts
=
limits
[
'
accounts_blacklist
'
]
ops
.
append
(
op
)
except
Exception
as
e
:
if
ops
:
logger
.
warning
(
'
using empty accounts_blacklist
'
,
e
=
e
,
blacklist_accounts
=
set
()
jid
=
request
.
jussi_request_id
,
)
try
:
blacklist_accounts
=
limits
[
'
accounts_blacklist
'
]
limit_custom_json_op_length
(
ops
,
size_limit
=
CUSTOM_JSON_SIZE_LIMIT
)
except
Exception
as
e
:
limit_custom_json_account
(
ops
,
blacklist_accounts
=
blacklist_accounts
)
logger
.
warning
(
'
using empty accounts_blacklist
'
,
e
=
e
,
jid
=
request
.
jussi_request_id
,
)
limit_custom_json_op_length
(
ops
,
size_limit
=
CUSTOM_JSON_SIZE_LIMIT
)
limit_custom_json_account
(
ops
,
blacklist_accounts
=
blacklist_accounts
)
def
limit_custom_json_op_length
(
ops
:
list
,
size_limit
=
None
):
def
limit_custom_json_op_length
(
ops
:
list
,
size_limit
=
None
):
...
...
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