Add namecoin chainparams.

2024-05-20_merge
tecnovert 5 years ago
parent c51e28103e
commit dd692fe5ef
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
  1. 14
      basicswap/basicswap.py
  2. 36
      basicswap/chainparams.py

@ -496,9 +496,8 @@ class BasicSwap():
# Defaults # Defaults
self.coin_clients = {} self.coin_clients = {}
self.coin_clients[Coins.PART] = self.setDefaultConnectParams(Coins.PART) for c in Coins:
self.coin_clients[Coins.BTC] = self.setDefaultConnectParams(Coins.BTC) self.coin_clients[c] = self.setDefaultConnectParams(c)
self.coin_clients[Coins.LTC] = self.setDefaultConnectParams(Coins.LTC)
if self.chain == 'regtest': if self.chain == 'regtest':
SMSG_SECONDS_IN_DAY = 600 SMSG_SECONDS_IN_DAY = 600
@ -557,9 +556,10 @@ class BasicSwap():
elif 'rpcpassword' in chain_client_settings: elif 'rpcpassword' in chain_client_settings:
rpcauth = chain_client_settings['rpcuser'] + ':' + chain_client_settings['rpcpassword'] rpcauth = chain_client_settings['rpcuser'] + ':' + chain_client_settings['rpcpassword']
if rpcauth is None: if rpcauth is None:
testnet_name = '' if self.chain == 'mainnet' else self.chain if self.chain == 'mainnet':
if testnet_name == 'testnet' and coin != Coins.PART: testnet_name = ''
testnet_name += '4' else:
testnet_name = chainparams[coin][self.chain].get('name', self.chain)
authcookiepath = os.path.join(datadir, testnet_name, '.cookie') authcookiepath = os.path.join(datadir, testnet_name, '.cookie')
# Wait for daemon to start # Wait for daemon to start
for i in range(10): for i in range(10):
@ -891,7 +891,7 @@ class BasicSwap():
if override_feerate: if override_feerate:
return override_feerate return override_feerate
try: try:
return self.callcoinrpc(coin_type, 'estimatesmartfee', [1])['feerate'] return self.callcoinrpc(coin_type, 'estimatesmartfee', [2])['feerate']
except Exception: except Exception:
try: try:
fee_rate = self.callcoinrpc(coin_type, 'getwalletinfo')['paytxfee'] fee_rate = self.callcoinrpc(coin_type, 'getwalletinfo')['paytxfee']

@ -15,6 +15,7 @@ class Coins(IntEnum):
BTC = 2 BTC = 2
LTC = 3 LTC = 3
# DCR = 4 # DCR = 4
NMC = 5
chainparams = { chainparams = {
@ -74,6 +75,7 @@ chainparams = {
'bip44': 1, 'bip44': 1,
'min_amount': 1000, 'min_amount': 1000,
'max_amount': 100000 * COIN, 'max_amount': 100000 * COIN,
'name': 'testnet4',
}, },
'regtest': { 'regtest': {
'rpcport': 18443, 'rpcport': 18443,
@ -106,6 +108,7 @@ chainparams = {
'bip44': 1, 'bip44': 1,
'min_amount': 1000, 'min_amount': 1000,
'max_amount': 100000 * COIN, 'max_amount': 100000 * COIN,
'name': 'testnet4',
}, },
'regtest': { 'regtest': {
'rpcport': 19443, 'rpcport': 19443,
@ -116,5 +119,38 @@ chainparams = {
'min_amount': 1000, 'min_amount': 1000,
'max_amount': 100000 * COIN, 'max_amount': 100000 * COIN,
} }
},
Coins.NMC: {
'name': 'namecoin',
'ticker': 'NMC',
'message_magic': 'Namecoin Signed Message:\n',
'mainnet': {
'rpcport': 8336,
'pubkey_address': 52,
'script_address': 13,
'hrp': 'nc',
'bip44': 7,
'min_amount': 1000,
'max_amount': 100000 * COIN,
},
'testnet': {
'rpcport': 18336,
'pubkey_address': 111,
'script_address': 196,
'hrp': 'tn',
'bip44': 1,
'min_amount': 1000,
'max_amount': 100000 * COIN,
'name': 'testnet3',
},
'regtest': {
'rpcport': 18443,
'pubkey_address': 111,
'script_address': 196,
'hrp': 'ncrt',
'bip44': 1,
'min_amount': 1000,
'max_amount': 100000 * COIN,
}
} }
} }

Loading…
Cancel
Save