From 4bfd2e630b6aec4f08e2e156f44fdda5f45dbcc4 Mon Sep 17 00:00:00 2001 From: Kay Kurokawa Date: Fri, 2 Jun 2017 13:56:41 -0400 Subject: [PATCH] add check for old fee format and throw releveant exception --- lbrynet/lbrynet_daemon/Daemon.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lbrynet/lbrynet_daemon/Daemon.py b/lbrynet/lbrynet_daemon/Daemon.py index d8ec576cd..9492bed8b 100644 --- a/lbrynet/lbrynet_daemon/Daemon.py +++ b/lbrynet/lbrynet_daemon/Daemon.py @@ -1927,9 +1927,13 @@ class Daemon(AuthJSONRPCServer): metadata['version'] = '_0_1_0' - # original format {'currency':{'address','amount'}} - # add address to fee if unspecified {'version': ,'currency', 'address' , 'amount'} + # check for original deprecated format {'currency':{'address','amount'}} + # add address, version to fee if unspecified if 'fee' in metadata: + if len(metadata['fee'].keys()) == 1 and isinstance(metadata['fee'].values()[0], dict): + raise Exception('Old format for fee no longer supported. ' \ + 'Fee must be specified as {"currency":,"address":,"amount":}') + if 'amount' in metadata['fee'] and 'currency' in metadata['fee']: if not metadata['fee']['amount']: log.warning("Stripping empty fee from published metadata")