update fee parameter to match lbryschema

This commit is contained in:
Jack Robison 2017-05-30 10:49:22 -04:00
parent f258df95e6
commit 61cb3e2a8d

View file

@ -1834,26 +1834,13 @@ class Daemon(AuthJSONRPCServer):
# original format {'currency':{'address','amount'}} # original format {'currency':{'address','amount'}}
# add address to fee if unspecified {'version': ,'currency', 'address' , 'amount'} # add address to fee if unspecified {'version': ,'currency', 'address' , 'amount'}
if 'fee' in metadata: if 'fee' in metadata:
assert len(metadata['fee']) == 1, "Too many fees" if 'amount' in metadata['fee'] and 'currency' in metadata['fee']:
currency, fee_dict = metadata['fee'].items()[0] if not metadata['fee']['amount']:
if 'address' not in fee_dict: log.warning("Stripping empty fee from published metadata")
address = yield self.session.wallet.get_new_address() del metadata['fee']
else: elif 'address' not in metadata['fee']:
address = fee_dict['address'] address = yield self.session.wallet.get_unused_address()
metadata['fee'] = { metadata['fee']['address'] = address
'version': '_0_0_1',
'currency': currency,
'address': address,
'amount': fee_dict['amount']
}
log.info("Publish: %s", {
'name': name,
'file_path': file_path,
'bid': bid,
'metadata': metadata,
'fee': fee,
})
claim_dict = { claim_dict = {
'version': '_0_0_1', 'version': '_0_0_1',
@ -1867,6 +1854,13 @@ class Daemon(AuthJSONRPCServer):
if sources is not None: if sources is not None:
claim_dict['stream']['source'] = sources claim_dict['stream']['source'] = sources
log.info("Publish: %s", {
'name': name,
'file_path': file_path,
'bid': bid,
'claim_dict': claim_dict,
})
if channel_id: if channel_id:
certificate_id = channel_id certificate_id = channel_id
elif channel_name: elif channel_name: