Merge pull request #667 from lbryio/old_fee_check
Add check for old fee format and throw releveant exception
This commit is contained in:
commit
8112658d70
2 changed files with 7 additions and 3 deletions
|
@ -22,7 +22,7 @@ at anytime.
|
|||
*
|
||||
|
||||
### Deprecated
|
||||
*
|
||||
* Old fee metadata format in publish API command is deprecated, throw relevant exception
|
||||
*
|
||||
|
||||
### Removed
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue