From 726868109584c8adc7eaf8f573eb75ef51ab6341 Mon Sep 17 00:00:00 2001
From: Dariusz Kedzierski <dkedzierski@syncad.com>
Date: Mon, 19 Oct 2020 11:01:23 +0200
Subject: [PATCH] Fix for key error when sending broadcast trx

Fix for:
{"exception":"KeyError(0,)","message":"Internal Error","error_id":"65c8a0e4-ecd4-4424-a490-7f87cb0c889a","jrpc_request_id":1,"jussi_request_id":"001113248166147000","event":"Internal Error","logger":"jussi.errors","level":"error"}

while sending:
curl -s --data '{"jsonrpc":"2.0", "method":"network_broadcast_api.broadcast_transaction", "params":{"trx":{"ref_block_num":1097,"ref_block_prefix":2181793527,"expiration":"2016-03-24T18:00:21","operations":[{"type":"vote_operation","value":{"voter":"hiveio","author":"alice","permlink":"a-post-by-alice","weight":10000}}],"extensions":[],"signatures":[]},"max_block_age":50}, "id":1}' https://beta.openhive.network
---
 jussi/validators.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jussi/validators.py b/jussi/validators.py
index 9e5c086..2827d1f 100644
--- a/jussi/validators.py
+++ b/jussi/validators.py
@@ -184,7 +184,7 @@ def limit_broadcast_transaction_request(request: JSONRPCRequest, limits=None) ->
         else:
             raise ValueError(
                 f'Unknown request params type: {type(request.urn.params)} urn:{request.urn}')
-        ops = [op for op in request_params['operations'] if op[0] == 'custom_json']
+        ops = [op for op in request_params['operations'] if op['type'] == 'custom_json']
         if not ops:
             return
         blacklist_accounts = set()
-- 
GitLab