Browse Source

Add interest rate option to config file

master
chris-belcher 5 years ago
parent
commit
eb0a738d67
No known key found for this signature in database
GPG Key ID: EF734EA677F31129
  1. 2
      jmclient/jmclient/__init__.py
  2. 14
      jmclient/jmclient/configure.py

2
jmclient/jmclient/__init__.py

@ -24,7 +24,7 @@ from .configure import (load_test_config, process_shutdown,
load_program_config, jm_single, get_network, update_persist_config, load_program_config, jm_single, get_network, update_persist_config,
validate_address, is_burn_destination, get_irc_mchannels, validate_address, is_burn_destination, get_irc_mchannels,
get_blockchain_interface_instance, set_config, is_segwit_mode, get_blockchain_interface_instance, set_config, is_segwit_mode,
is_native_segwit_mode, JMPluginService) is_native_segwit_mode, JMPluginService, get_interest_rate)
from .blockchaininterface import (BlockchainInterface, from .blockchaininterface import (BlockchainInterface,
RegtestBitcoinCoreInterface, BitcoinCoreInterface) RegtestBitcoinCoreInterface, BitcoinCoreInterface)
from .snicker_receiver import SNICKERError, SNICKERReceiver from .snicker_receiver import SNICKERError, SNICKERReceiver

14
jmclient/jmclient/configure.py

@ -88,6 +88,8 @@ required_options = {'BLOCKCHAIN': ['blockchain_source', 'network'],
'POLICY': ['absurd_fee_per_kb', 'taker_utxo_retries', 'POLICY': ['absurd_fee_per_kb', 'taker_utxo_retries',
'taker_utxo_age', 'taker_utxo_amtpercent']} 'taker_utxo_age', 'taker_utxo_amtpercent']}
_DEFAULT_INTEREST_RATE = "0.015"
defaultconfig = \ defaultconfig = \
""" """
[DAEMON] [DAEMON]
@ -291,6 +293,14 @@ minimum_makers = 4
# whatever the value of it, and this is set with the value -1. # whatever the value of it, and this is set with the value -1.
max_sats_freeze_reuse = -1 max_sats_freeze_reuse = -1
# Interest rate used when calculating the value of fidelity bonds created
# by locking bitcoins in timelocked addresses
# See also:
# https://gist.github.com/chris-belcher/87ebbcbb639686057a389acb9ab3e25b#determining-interest-rate-r
# Set as a real number, i.e. 1 = 100% and 0.01 = 1%
interest_rate = """ + _DEFAULT_INTEREST_RATE + """
############################## ##############################
#THE FOLLOWING SETTINGS ARE REQUIRED TO DEFEND AGAINST SNOOPERS. #THE FOLLOWING SETTINGS ARE REQUIRED TO DEFEND AGAINST SNOOPERS.
#DON'T ALTER THEM UNLESS YOU UNDERSTAND THE IMPLICATIONS. #DON'T ALTER THEM UNLESS YOU UNDERSTAND THE IMPLICATIONS.
@ -538,6 +548,10 @@ _BURN_DESTINATION = "BURN"
def is_burn_destination(destination): def is_burn_destination(destination):
return destination == _BURN_DESTINATION return destination == _BURN_DESTINATION
def get_interest_rate():
return float(global_singleton.config.get('POLICY', 'interest_rate',
fallback=_DEFAULT_INTEREST_RATE))
def remove_unwanted_default_settings(config): def remove_unwanted_default_settings(config):
for section in config.sections(): for section in config.sections():
if section.startswith('MESSAGING:'): if section.startswith('MESSAGING:'):

Loading…
Cancel
Save