mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 18:38:09 +01:00
nmc: Add to test_xmr_persistent.
This commit is contained in:
@@ -117,7 +117,9 @@ known_coins = {
|
||||
"dogecoin": (DOGECOIN_VERSION, DOGECOIN_VERSION_TAG, ("tecnovert",)),
|
||||
}
|
||||
|
||||
disabled_coins = ["navcoin"]
|
||||
disabled_coins = [
|
||||
"navcoin",
|
||||
]
|
||||
|
||||
expected_key_ids = {
|
||||
"tecnovert": ("13F13651C9CF0D6B",),
|
||||
@@ -207,6 +209,7 @@ DCR_RPC_PWD = os.getenv("DCR_RPC_PWD", random.randbytes(random.randint(14, 18)).
|
||||
|
||||
NMC_RPC_HOST = os.getenv("NMC_RPC_HOST", "127.0.0.1")
|
||||
NMC_RPC_PORT = int(os.getenv("NMC_RPC_PORT", 19698))
|
||||
NMC_PORT = int(os.getenv("NMC_PORT", 8134))
|
||||
NMC_ONION_PORT = int(os.getenv("NMC_ONION_PORT", 9698))
|
||||
NMC_RPC_USER = os.getenv("NMC_RPC_USER", "")
|
||||
NMC_RPC_PWD = os.getenv("NMC_RPC_PWD", "")
|
||||
@@ -1349,6 +1352,8 @@ def prepareDataDir(coin, settings, chain, particl_mnemonic, extra_opts={}):
|
||||
fp.write("printtoconsole=0\n")
|
||||
fp.write("daemon=0\n")
|
||||
fp.write(f"wallet={wallet_name}\n")
|
||||
if "watch_wallet_name" in core_settings:
|
||||
fp.write("wallet={}\n".format(core_settings["watch_wallet_name"]))
|
||||
|
||||
if tor_control_password is not None:
|
||||
writeTorSettings(fp, coin, core_settings, tor_control_password)
|
||||
@@ -1408,6 +1413,7 @@ def prepareDataDir(coin, settings, chain, particl_mnemonic, extra_opts={}):
|
||||
fp.write("deprecatedrpc=create_bdb\n")
|
||||
fp.write("addresstype=bech32\n")
|
||||
fp.write("changetype=bech32\n")
|
||||
fp.write("fallbackfee=0.001\n") # minrelaytxfee
|
||||
elif coin == "pivx":
|
||||
params_dir = os.path.join(data_dir, "pivx-params")
|
||||
downloadPIVXParams(params_dir)
|
||||
@@ -2391,22 +2397,6 @@ def main():
|
||||
"core_version_no": getKnownVersion("bitcoin"),
|
||||
"core_version_group": 28,
|
||||
},
|
||||
"bitcoincash": {
|
||||
"connection_type": "rpc",
|
||||
"manage_daemon": shouldManageDaemon("BCH"),
|
||||
"rpchost": BCH_RPC_HOST,
|
||||
"rpcport": BCH_RPC_PORT + port_offset,
|
||||
"onionport": BCH_ONION_PORT + port_offset,
|
||||
"datadir": os.getenv("BCH_DATA_DIR", os.path.join(data_dir, "bitcoincash")),
|
||||
"bindir": os.path.join(bin_dir, "bitcoincash"),
|
||||
"port": BCH_PORT + port_offset,
|
||||
"config_filename": "bitcoin.conf",
|
||||
"use_segwit": False,
|
||||
"blocks_confirmed": 1,
|
||||
"conf_target": 2,
|
||||
"core_version_no": getKnownVersion("bitcoincash"),
|
||||
"core_version_group": 22,
|
||||
},
|
||||
"litecoin": {
|
||||
"connection_type": "rpc",
|
||||
"manage_daemon": shouldManageDaemon("LTC"),
|
||||
@@ -2422,22 +2412,6 @@ def main():
|
||||
"core_version_group": 20,
|
||||
"min_relay_fee": 0.00001,
|
||||
},
|
||||
"dogecoin": {
|
||||
"connection_type": "rpc",
|
||||
"manage_daemon": shouldManageDaemon("DOGE"),
|
||||
"rpchost": DOGE_RPC_HOST,
|
||||
"rpcport": DOGE_RPC_PORT + port_offset,
|
||||
"onionport": DOGE_ONION_PORT + port_offset,
|
||||
"datadir": os.getenv("DOGE_DATA_DIR", os.path.join(data_dir, "dogecoin")),
|
||||
"bindir": os.path.join(bin_dir, "dogecoin"),
|
||||
"use_segwit": False,
|
||||
"use_csv": False,
|
||||
"blocks_confirmed": 2,
|
||||
"conf_target": 2,
|
||||
"core_version_no": getKnownVersion("dogecoin"),
|
||||
"core_version_group": 23,
|
||||
"min_relay_fee": 0.01, # RECOMMENDED_MIN_TX_FEE
|
||||
},
|
||||
"decred": {
|
||||
"connection_type": "rpc",
|
||||
"manage_daemon": shouldManageDaemon("DCR"),
|
||||
@@ -2468,6 +2442,7 @@ def main():
|
||||
"onionport": NMC_ONION_PORT + port_offset,
|
||||
"datadir": os.getenv("NMC_DATA_DIR", os.path.join(data_dir, "namecoin")),
|
||||
"bindir": os.path.join(bin_dir, "namecoin"),
|
||||
"port": NMC_PORT + port_offset,
|
||||
"use_segwit": True,
|
||||
"use_csv": True,
|
||||
"blocks_confirmed": 1,
|
||||
@@ -2499,6 +2474,28 @@ def main():
|
||||
"core_version_no": getKnownVersion("monero"),
|
||||
"core_type_group": "xmr",
|
||||
},
|
||||
"wownero": {
|
||||
"connection_type": "rpc",
|
||||
"manage_daemon": shouldManageDaemon("WOW"),
|
||||
"manage_wallet_daemon": shouldManageDaemon("WOW_WALLET"),
|
||||
"rpcport": WOW_RPC_PORT + port_offset,
|
||||
"zmqport": WOW_ZMQ_PORT + port_offset,
|
||||
"walletrpcport": WOW_WALLET_RPC_PORT + port_offset,
|
||||
"rpchost": WOW_RPC_HOST,
|
||||
"trusted_daemon": extra_opts.get("trust_remote_node", "auto"),
|
||||
"walletrpchost": WOW_WALLET_RPC_HOST,
|
||||
"walletrpcuser": WOW_WALLET_RPC_USER,
|
||||
"walletrpcpassword": WOW_WALLET_RPC_PWD,
|
||||
"datadir": os.getenv("WOW_DATA_DIR", os.path.join(data_dir, "wownero")),
|
||||
"bindir": os.path.join(bin_dir, "wownero"),
|
||||
"restore_height": wow_restore_height,
|
||||
"blocks_confirmed": 2,
|
||||
"rpctimeout": 60,
|
||||
"walletrpctimeout": 120,
|
||||
"walletrpctimeoutlong": 300,
|
||||
"core_version_no": getKnownVersion("wownero"),
|
||||
"core_type_group": "xmr",
|
||||
},
|
||||
"pivx": {
|
||||
"connection_type": "rpc",
|
||||
"manage_daemon": shouldManageDaemon("PIVX"),
|
||||
@@ -2562,27 +2559,37 @@ def main():
|
||||
"chain_lookups": "local",
|
||||
"startup_tries": 40,
|
||||
},
|
||||
"wownero": {
|
||||
"bitcoincash": {
|
||||
"connection_type": "rpc",
|
||||
"manage_daemon": shouldManageDaemon("WOW"),
|
||||
"manage_wallet_daemon": shouldManageDaemon("WOW_WALLET"),
|
||||
"rpcport": WOW_RPC_PORT + port_offset,
|
||||
"zmqport": WOW_ZMQ_PORT + port_offset,
|
||||
"walletrpcport": WOW_WALLET_RPC_PORT + port_offset,
|
||||
"rpchost": WOW_RPC_HOST,
|
||||
"trusted_daemon": extra_opts.get("trust_remote_node", "auto"),
|
||||
"walletrpchost": WOW_WALLET_RPC_HOST,
|
||||
"walletrpcuser": WOW_WALLET_RPC_USER,
|
||||
"walletrpcpassword": WOW_WALLET_RPC_PWD,
|
||||
"datadir": os.getenv("WOW_DATA_DIR", os.path.join(data_dir, "wownero")),
|
||||
"bindir": os.path.join(bin_dir, "wownero"),
|
||||
"restore_height": wow_restore_height,
|
||||
"manage_daemon": shouldManageDaemon("BCH"),
|
||||
"rpchost": BCH_RPC_HOST,
|
||||
"rpcport": BCH_RPC_PORT + port_offset,
|
||||
"onionport": BCH_ONION_PORT + port_offset,
|
||||
"datadir": os.getenv("BCH_DATA_DIR", os.path.join(data_dir, "bitcoincash")),
|
||||
"bindir": os.path.join(bin_dir, "bitcoincash"),
|
||||
"port": BCH_PORT + port_offset,
|
||||
"config_filename": "bitcoin.conf",
|
||||
"use_segwit": False,
|
||||
"blocks_confirmed": 1,
|
||||
"conf_target": 2,
|
||||
"core_version_no": getKnownVersion("bitcoincash"),
|
||||
"core_version_group": 22,
|
||||
},
|
||||
"dogecoin": {
|
||||
"connection_type": "rpc",
|
||||
"manage_daemon": shouldManageDaemon("DOGE"),
|
||||
"rpchost": DOGE_RPC_HOST,
|
||||
"rpcport": DOGE_RPC_PORT + port_offset,
|
||||
"onionport": DOGE_ONION_PORT + port_offset,
|
||||
"datadir": os.getenv("DOGE_DATA_DIR", os.path.join(data_dir, "dogecoin")),
|
||||
"bindir": os.path.join(bin_dir, "dogecoin"),
|
||||
"use_segwit": False,
|
||||
"use_csv": False,
|
||||
"blocks_confirmed": 2,
|
||||
"rpctimeout": 60,
|
||||
"walletrpctimeout": 120,
|
||||
"walletrpctimeoutlong": 300,
|
||||
"core_version_no": getKnownVersion("wownero"),
|
||||
"core_type_group": "xmr",
|
||||
"conf_target": 2,
|
||||
"core_version_no": getKnownVersion("dogecoin"),
|
||||
"core_version_group": 23,
|
||||
"min_relay_fee": 0.01, # RECOMMENDED_MIN_TX_FEE
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -265,7 +265,11 @@ def getCoreBinArgs(coin_id: int, coin_settings, prepare=False, use_tor_proxy=Fal
|
||||
# As BCH may use port 8334, disable it here.
|
||||
# When tor is enabled a bind option for the onionport will be added to bitcoin.conf.
|
||||
# https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-28.0.md?plain=1#L84
|
||||
if prepare is False and use_tor_proxy is False and coin_id == Coins.BTC:
|
||||
if (
|
||||
prepare is False
|
||||
and use_tor_proxy is False
|
||||
and coin_id in (Coins.BTC, Coins.NMC)
|
||||
):
|
||||
port: int = coin_settings.get("port", 8333)
|
||||
extra_args.append(f"--bind=0.0.0.0:{port}")
|
||||
return extra_args
|
||||
|
||||
BIN
basicswap/static/images/coins/Namecoin-20.png
Normal file
BIN
basicswap/static/images/coins/Namecoin-20.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 743 B |
BIN
basicswap/static/images/coins/Namecoin.png
Normal file
BIN
basicswap/static/images/coins/Namecoin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -10,6 +10,7 @@ const COIN_NAME_TO_SYMBOL = {
|
||||
'Firo': 'FIRO',
|
||||
'Dash': 'DASH',
|
||||
'Decred': 'DCR',
|
||||
'Namecoin': 'NMC',
|
||||
'Wownero': 'WOW',
|
||||
'Bitcoin Cash': 'BCH',
|
||||
'Dogecoin': 'DOGE'
|
||||
@@ -383,7 +384,6 @@ const createBidTableRow = async (bid) => {
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<!-- You Get Column -->
|
||||
<td class="py-0">
|
||||
<div class="py-3 px-4 text-right">
|
||||
|
||||
@@ -220,7 +220,7 @@ const ApiManager = (function() {
|
||||
.filter(coin => coin.usesCoinGecko)
|
||||
.map(coin => coin.name)
|
||||
.join(',') :
|
||||
'bitcoin,monero,particl,bitcoincash,pivx,firo,dash,litecoin,dogecoin,decred';
|
||||
'bitcoin,monero,particl,bitcoincash,pivx,firo,dash,litecoin,dogecoin,decred,namecoin';
|
||||
|
||||
//console.log('Fetching coin prices for:', coins);
|
||||
const response = await this.fetchCoinPrices(coins);
|
||||
@@ -254,7 +254,7 @@ const ApiManager = (function() {
|
||||
.filter(coin => coin.usesCoinGecko)
|
||||
.map(coin => getCoinBackendId ? getCoinBackendId(coin.name) : coin.name)
|
||||
.join(',') :
|
||||
'bitcoin,monero,particl,bitcoin-cash,pivx,firo,dash,litecoin,dogecoin,decred';
|
||||
'bitcoin,monero,particl,bitcoin-cash,pivx,firo,dash,litecoin,dogecoin,decred,namecoin';
|
||||
|
||||
const url = `https://api.coingecko.com/api/v3/simple/price?ids=${coins}&vs_currencies=usd&include_24hr_vol=true&include_24hr_change=true`;
|
||||
|
||||
|
||||
@@ -504,13 +504,14 @@ const CacheManager = (function() {
|
||||
'bitcoin': 'BTC',
|
||||
'litecoin': 'LTC',
|
||||
'monero': 'XMR',
|
||||
'wownero': 'WOW',
|
||||
'particl': 'PART',
|
||||
'pivx': 'PIVX',
|
||||
'firo': 'FIRO',
|
||||
'zcoin': 'FIRO',
|
||||
'dash': 'DASH',
|
||||
'decred': 'DCR',
|
||||
'wownero': 'WOW',
|
||||
'namecoin': 'NMR',
|
||||
'bitcoin-cash': 'BCH',
|
||||
'dogecoin': 'DOGE'
|
||||
};
|
||||
|
||||
@@ -72,6 +72,7 @@ const ConfigManager = (function() {
|
||||
{ symbol: 'LTC', name: 'litecoin', usesCryptoCompare: true, usesCoinGecko: true, historicalDays: 30 },
|
||||
{ symbol: 'DOGE', name: 'dogecoin', usesCryptoCompare: true, usesCoinGecko: true, historicalDays: 30 },
|
||||
{ symbol: 'DCR', name: 'decred', usesCryptoCompare: true, usesCoinGecko: true, historicalDays: 30 },
|
||||
{ symbol: 'NMC', name: 'namecoin', usesCryptoCompare: true, usesCoinGecko: true, historicalDays: 30 },
|
||||
{ symbol: 'WOW', name: 'wownero', usesCryptoCompare: false, usesCoinGecko: true, historicalDays: 30 }
|
||||
],
|
||||
|
||||
@@ -88,6 +89,7 @@ const ConfigManager = (function() {
|
||||
'Zcoin': 'FIRO',
|
||||
'Dash': 'DASH',
|
||||
'Decred': 'DCR',
|
||||
'Namecoin': 'NMC',
|
||||
'Wownero': 'WOW',
|
||||
'Bitcoin Cash': 'BCH',
|
||||
'Dogecoin': 'DOGE'
|
||||
@@ -105,13 +107,14 @@ const ConfigManager = (function() {
|
||||
'Zcoin': 'Firo',
|
||||
'Dash': 'Dash',
|
||||
'Decred': 'Decred',
|
||||
'Namecoin': 'Namecoin',
|
||||
'Wownero': 'Wownero',
|
||||
'Bitcoin Cash': 'Bitcoin Cash',
|
||||
'Dogecoin': 'Dogecoin'
|
||||
},
|
||||
|
||||
idToName: {
|
||||
1: 'particl', 2: 'bitcoin', 3: 'litecoin', 4: 'decred',
|
||||
1: 'particl', 2: 'bitcoin', 3: 'litecoin', 4: 'decred', 5: 'namecoin',
|
||||
6: 'monero', 7: 'particl blind', 8: 'particl anon',
|
||||
9: 'wownero', 11: 'pivx', 13: 'firo', 17: 'bitcoincash',
|
||||
18: 'dogecoin'
|
||||
@@ -130,6 +133,7 @@ const ConfigManager = (function() {
|
||||
'litecoin': 'litecoin',
|
||||
'dogecoin': 'dogecoin',
|
||||
'decred': 'decred',
|
||||
'namecoin': 'namecoin',
|
||||
'wownero': 'wownero'
|
||||
}
|
||||
},
|
||||
@@ -367,6 +371,7 @@ const ConfigManager = (function() {
|
||||
'dash': { usd: null, btc: null },
|
||||
'dogecoin': { usd: null, btc: null },
|
||||
'decred': { usd: null, btc: null },
|
||||
'namecoin': { usd: null, btc: null },
|
||||
'litecoin': { usd: null, btc: null },
|
||||
'particl': { usd: null, btc: null },
|
||||
'pivx': { usd: null, btc: null },
|
||||
|
||||
@@ -35,6 +35,7 @@ const WalletManager = (function() {
|
||||
'Dash': 'DASH',
|
||||
'PIVX': 'PIVX',
|
||||
'Decred': 'DCR',
|
||||
'Namecoin': 'NMC',
|
||||
'Bitcoin Cash': 'BCH'
|
||||
},
|
||||
|
||||
@@ -49,6 +50,7 @@ const WalletManager = (function() {
|
||||
'DASH': 'dash',
|
||||
'PIVX': 'pivx',
|
||||
'DCR': 'dcr',
|
||||
'NMC': 'nmc',
|
||||
'BCH': 'bch'
|
||||
},
|
||||
|
||||
@@ -63,6 +65,7 @@ const WalletManager = (function() {
|
||||
'Dash': 'DASH',
|
||||
'PIVX': 'PIVX',
|
||||
'Decred': 'DCR',
|
||||
'Namecoin': 'NMC',
|
||||
'Bitcoin Cash': 'BCH',
|
||||
'Dogecoin': 'DOGE'
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ window.tableRateModule = {
|
||||
'Dash': 'DASH',
|
||||
'PIVX': 'PIVX',
|
||||
'Decred': 'DCR',
|
||||
'Namecoin': 'NMC',
|
||||
'Zano': 'ZANO',
|
||||
'Bitcoin Cash': 'BCH',
|
||||
'Dogecoin': 'DOGE'
|
||||
@@ -306,6 +307,7 @@ async function calculateProfitLoss(fromCoin, toCoin, fromAmount, toAmount, isOwn
|
||||
'ltc': 'litecoin',
|
||||
'doge': 'dogecoin',
|
||||
'dcr': 'decred',
|
||||
'nmc': 'namecoin',
|
||||
'wow': 'wownero'
|
||||
};
|
||||
|
||||
@@ -406,7 +408,7 @@ async function fetchLatestPrices() {
|
||||
const coinIds = [
|
||||
'bitcoin', 'particl', 'monero', 'litecoin',
|
||||
'dogecoin', 'firo', 'dash', 'pivx',
|
||||
'decred', 'bitcoincash'
|
||||
'decred', 'namecoin', 'bitcoincash'
|
||||
];
|
||||
|
||||
let processedData = {};
|
||||
@@ -1365,6 +1367,7 @@ function createRateColumn(offer, coinFrom, coinTo) {
|
||||
'ltc': 'litecoin',
|
||||
'doge': 'dogecoin',
|
||||
'dcr': 'decred',
|
||||
'nmc': 'namecoin',
|
||||
'wow': 'wownero'
|
||||
};
|
||||
|
||||
@@ -1655,6 +1658,7 @@ function createTooltipContent(isSentOffers, coinFrom, coinTo, fromAmount, toAmou
|
||||
'ltc': 'litecoin',
|
||||
'doge': 'dogecoin',
|
||||
'dcr': 'decred',
|
||||
'nmc': 'namecoin',
|
||||
'wow': 'wownero'
|
||||
};
|
||||
|
||||
@@ -1757,6 +1761,7 @@ function createCombinedRateTooltip(offer, coinFrom, coinTo, treatAsSentOffer) {
|
||||
'ltc': 'litecoin',
|
||||
'doge': 'dogecoin',
|
||||
'dcr': 'decred',
|
||||
'nmc': 'namecoin',
|
||||
'wow': 'wownero'
|
||||
};
|
||||
|
||||
|
||||
@@ -548,7 +548,7 @@ const ui = {
|
||||
},
|
||||
|
||||
setActiveContainer: (containerId) => {
|
||||
const containerIds = ['btc', 'xmr', 'part', 'pivx', 'firo', 'dash', 'ltc', 'doge', 'eth', 'dcr', 'zano', 'wow', 'bch'].map(id => `${id}-container`);
|
||||
const containerIds = ['btc', 'xmr', 'part', 'pivx', 'firo', 'dash', 'ltc', 'doge', 'eth', 'dcr', 'nmc', 'zano', 'wow', 'bch'].map(id => `${id}-container`);
|
||||
containerIds.forEach(id => {
|
||||
const container = document.getElementById(id);
|
||||
if (container) {
|
||||
|
||||
@@ -10,6 +10,7 @@ const COIN_NAME_TO_SYMBOL = {
|
||||
'Firo': 'FIRO',
|
||||
'Dash': 'DASH',
|
||||
'Decred': 'DCR',
|
||||
'Namecoin': 'NMC',
|
||||
'Wownero': 'WOW',
|
||||
'Bitcoin Cash': 'BCH',
|
||||
'Dogecoin': 'DOGE'
|
||||
|
||||
@@ -136,11 +136,12 @@
|
||||
'ETH': {'name': 'Ethereum', 'symbol': 'ETH', 'image': 'Ethereum.png', 'show': false},
|
||||
'DOGE': {'name': 'Dogecoin', 'symbol': 'DOGE', 'image': 'Dogecoin.png', 'show': true},
|
||||
'DCR': {'name': 'Decred', 'symbol': 'DCR', 'image': 'Decred.png', 'show': true},
|
||||
'NMC': {'name': 'Namecoin', 'symbol': 'NMC', 'image': 'Namecoin.png', 'show': true},
|
||||
'ZANO': {'name': 'Zano', 'symbol': 'ZANO', 'image': 'Zano.png', 'show': false},
|
||||
'WOW': {'name': 'Wownero', 'symbol': 'WOW', 'image': 'Wownero.png', 'show': true}
|
||||
}
|
||||
%}
|
||||
{% set custom_order = ['BTC', 'ETH', 'XMR', 'PART', 'LTC', 'BCH', 'FIRO', 'PIVX', 'DASH', 'DOGE', 'DCR', 'ZANO', 'WOW'] %}
|
||||
{% set custom_order = ['BTC', 'ETH', 'XMR', 'PART', 'LTC', 'BCH', 'FIRO', 'PIVX', 'DASH', 'DOGE', 'DCR', 'NMC', 'ZANO', 'WOW'] %}
|
||||
|
||||
{% if enabled_chart_coins is string %}
|
||||
{% if enabled_chart_coins == "" %}
|
||||
|
||||
@@ -34,6 +34,11 @@ from tests.basicswap.common import (
|
||||
PIVX_BASE_PORT,
|
||||
BTC_USE_DESCRIPTORS,
|
||||
)
|
||||
from tests.basicswap.extended.test_nmc import (
|
||||
NMC_BASE_PORT,
|
||||
NMC_BASE_RPC_PORT,
|
||||
NMC_BASE_TOR_PORT,
|
||||
)
|
||||
from tests.basicswap.extended.test_dcr import (
|
||||
DCR_BASE_PORT,
|
||||
DCR_BASE_RPC_PORT,
|
||||
@@ -50,13 +55,6 @@ from tests.basicswap.extended.test_doge import (
|
||||
import basicswap.config as cfg
|
||||
import basicswap.bin.run as runSystem
|
||||
|
||||
XMR_BASE_P2P_PORT = 17792
|
||||
XMR_BASE_RPC_PORT = 29798
|
||||
XMR_BASE_WALLET_RPC_PORT = 29998
|
||||
|
||||
FIRO_BASE_PORT = 34832
|
||||
FIRO_BASE_RPC_PORT = 35832
|
||||
FIRO_RPC_PORT_BASE = int(os.getenv("FIRO_RPC_PORT_BASE", FIRO_BASE_RPC_PORT))
|
||||
|
||||
TEST_PATH = os.path.expanduser(os.getenv("TEST_PATH", "~/test_basicswap1"))
|
||||
|
||||
@@ -68,7 +66,21 @@ BITCOIN_RPC_PORT_BASE = int(os.getenv("BITCOIN_RPC_PORT_BASE", BTC_BASE_RPC_PORT
|
||||
BITCOIN_TOR_PORT_BASE = int(os.getenv("BITCOIN_TOR_PORT_BASE", BTC_BASE_TOR_PORT))
|
||||
|
||||
LITECOIN_RPC_PORT_BASE = int(os.getenv("LITECOIN_RPC_PORT_BASE", LTC_BASE_RPC_PORT))
|
||||
|
||||
DECRED_RPC_PORT_BASE = int(os.getenv("DECRED_RPC_PORT_BASE", DCR_BASE_RPC_PORT))
|
||||
|
||||
NAMECOIN_PORT_BASE = int(os.getenv("NAMECOIN_PORT_BASE", NMC_BASE_PORT))
|
||||
NAMECOIN_RPC_PORT_BASE = int(os.getenv("NAMECOIN_RPC_PORT_BASE", NMC_BASE_RPC_PORT))
|
||||
NAMECOIN_TOR_PORT_BASE = int(os.getenv("NAMECOIN_TOR_PORT_BASE", NMC_BASE_TOR_PORT))
|
||||
|
||||
XMR_BASE_P2P_PORT = 17792
|
||||
XMR_BASE_RPC_PORT = 29798
|
||||
XMR_BASE_WALLET_RPC_PORT = 29998
|
||||
|
||||
FIRO_BASE_PORT = 34832
|
||||
FIRO_BASE_RPC_PORT = 35832
|
||||
FIRO_RPC_PORT_BASE = int(os.getenv("FIRO_RPC_PORT_BASE", FIRO_BASE_RPC_PORT))
|
||||
|
||||
BITCOINCASH_RPC_PORT_BASE = int(
|
||||
os.getenv("BITCOINCASH_RPC_PORT_BASE", BCH_BASE_RPC_PORT)
|
||||
)
|
||||
@@ -130,19 +142,21 @@ def run_prepare(
|
||||
os.environ["BTC_RPC_PORT"] = str(BITCOIN_RPC_PORT_BASE)
|
||||
os.environ["BTC_PORT"] = str(BITCOIN_PORT_BASE)
|
||||
os.environ["BTC_USE_DESCRIPTORS"] = str(BTC_USE_DESCRIPTORS)
|
||||
os.environ["BTC_ONION_PORT"] = str(BITCOIN_TOR_PORT_BASE)
|
||||
os.environ["LTC_RPC_PORT"] = str(LITECOIN_RPC_PORT_BASE)
|
||||
os.environ["DCR_RPC_PORT"] = str(DECRED_RPC_PORT_BASE)
|
||||
os.environ["DCR_RPC_PWD"] = "dcr_pwd"
|
||||
os.environ["NMC_RPC_PORT"] = str(NAMECOIN_RPC_PORT_BASE)
|
||||
os.environ["NMC_PORT"] = str(NMC_BASE_PORT)
|
||||
os.environ["NMC_ONION_PORT"] = str(NAMECOIN_TOR_PORT_BASE)
|
||||
os.environ["XMR_RPC_USER"] = "xmr_user"
|
||||
os.environ["XMR_RPC_PWD"] = "xmr_pwd"
|
||||
os.environ["FIRO_RPC_PORT"] = str(FIRO_RPC_PORT_BASE)
|
||||
os.environ["BCH_PORT"] = str(BCH_BASE_PORT)
|
||||
os.environ["BCH_RPC_PORT"] = str(BITCOINCASH_RPC_PORT_BASE)
|
||||
os.environ["DOGE_PORT"] = str(DOGE_BASE_PORT)
|
||||
os.environ["DOGE_RPC_PORT"] = str(DOGECOIN_RPC_PORT_BASE)
|
||||
|
||||
os.environ["XMR_RPC_USER"] = "xmr_user"
|
||||
os.environ["XMR_RPC_PWD"] = "xmr_pwd"
|
||||
|
||||
os.environ["DCR_RPC_PWD"] = "dcr_pwd"
|
||||
|
||||
import basicswap.bin.prepare as prepareSystem
|
||||
|
||||
# Hack: Reload module to set env vars as the basicswap_prepare module is initialised if imported from elsewhere earlier
|
||||
@@ -320,6 +334,62 @@ def run_prepare(
|
||||
with open(config_filename, "a") as fp:
|
||||
fp.write("enablevoting=1\n")
|
||||
|
||||
if "namecoin" in coins_array:
|
||||
# Pruned nodes don't provide blocks
|
||||
config_filename = os.path.join(datadir_path, "namecoin", "namecoin.conf")
|
||||
with open(config_filename, "r") as fp:
|
||||
lines = fp.readlines()
|
||||
with open(config_filename, "w") as fp:
|
||||
for line in lines:
|
||||
if not line.startswith("prune"):
|
||||
fp.write(line)
|
||||
# fp.write("bind=127.0.0.1\n") # Causes BTC v28 to try and bind to bind=127.0.0.1:8444, even with a bind...=onion present
|
||||
# listenonion=0 does not stop the node from trying to bind to the tor port
|
||||
# https://github.com/bitcoin/bitcoin/issues/22726
|
||||
fp.write(
|
||||
"bind=127.0.0.1:{}=onion\n".format(
|
||||
NAMECOIN_TOR_PORT_BASE + node_id + port_ofs
|
||||
)
|
||||
)
|
||||
fp.write("dnsseed=0\n")
|
||||
fp.write("discover=0\n")
|
||||
fp.write("listenonion=0\n")
|
||||
fp.write("upnp=0\n")
|
||||
if use_rpcauth:
|
||||
salt = generate_salt(16)
|
||||
rpc_user = "test_nmc_" + str(node_id)
|
||||
rpc_pass = "test_nmc_pwd_" + str(node_id)
|
||||
fp.write(
|
||||
"rpcauth={}:{}${}\n".format(
|
||||
rpc_user, salt, password_to_hmac(salt, rpc_pass)
|
||||
)
|
||||
)
|
||||
settings["chainclients"]["namecoin"]["rpcuser"] = rpc_user
|
||||
settings["chainclients"]["namecoin"]["rpcpassword"] = rpc_pass
|
||||
for ip in range(num_nodes):
|
||||
if ip != node_id:
|
||||
fp.write(
|
||||
"connect=127.0.0.1:{}\n".format(
|
||||
NAMECOIN_PORT_BASE + ip + port_ofs
|
||||
)
|
||||
)
|
||||
for opt in EXTRA_CONFIG_JSON.get("ncm{}".format(node_id), []):
|
||||
fp.write(opt + "\n")
|
||||
|
||||
if "monero" in coins_array:
|
||||
with open(os.path.join(datadir_path, "monero", "monerod.conf"), "a") as fp:
|
||||
fp.write("p2p-bind-ip=127.0.0.1\n")
|
||||
fp.write(
|
||||
"p2p-bind-port={}\n".format(XMR_BASE_P2P_PORT + node_id + port_ofs)
|
||||
)
|
||||
for ip in range(num_nodes):
|
||||
if ip != node_id:
|
||||
fp.write(
|
||||
"add-exclusive-node=127.0.0.1:{}\n".format(
|
||||
XMR_BASE_P2P_PORT + ip + port_ofs
|
||||
)
|
||||
)
|
||||
|
||||
if "pivx" in coins_array:
|
||||
# Pruned nodes don't provide blocks
|
||||
config_filename = os.path.join(datadir_path, "pivx", "pivx.conf")
|
||||
@@ -388,20 +458,6 @@ def run_prepare(
|
||||
for opt in EXTRA_CONFIG_JSON.get("firo{}".format(node_id), []):
|
||||
fp.write(opt + "\n")
|
||||
|
||||
if "monero" in coins_array:
|
||||
with open(os.path.join(datadir_path, "monero", "monerod.conf"), "a") as fp:
|
||||
fp.write("p2p-bind-ip=127.0.0.1\n")
|
||||
fp.write(
|
||||
"p2p-bind-port={}\n".format(XMR_BASE_P2P_PORT + node_id + port_ofs)
|
||||
)
|
||||
for ip in range(num_nodes):
|
||||
if ip != node_id:
|
||||
fp.write(
|
||||
"add-exclusive-node=127.0.0.1:{}\n".format(
|
||||
XMR_BASE_P2P_PORT + ip + port_ofs
|
||||
)
|
||||
)
|
||||
|
||||
if "bitcoincash" in coins_array:
|
||||
config_filename = os.path.join(datadir_path, "bitcoincash", "bitcoin.conf")
|
||||
with open(config_filename, "r") as fp:
|
||||
|
||||
@@ -58,6 +58,7 @@ NMC_USE_DESCRIPTORS = toBool(os.getenv("NMC_USE_DESCRIPTORS", True))
|
||||
|
||||
NMC_BASE_PORT = 8136
|
||||
NMC_BASE_RPC_PORT = 8146
|
||||
NMC_BASE_TOR_PORT = 8156
|
||||
|
||||
|
||||
def prepareNMCDataDir(datadir, nodeId, conf_file="namecoin.conf"):
|
||||
|
||||
@@ -60,6 +60,7 @@ from tests.basicswap.common_xmr import (
|
||||
prepare_nodes,
|
||||
XMR_BASE_RPC_PORT,
|
||||
DOGE_BASE_RPC_PORT,
|
||||
NMC_BASE_RPC_PORT,
|
||||
)
|
||||
from basicswap.interface.dcr.rpc import callrpc as callrpc_dcr
|
||||
import basicswap.bin.run as runSystem
|
||||
@@ -73,12 +74,13 @@ UI_PORT = 12700 + PORT_OFS
|
||||
PARTICL_RPC_PORT_BASE = int(os.getenv("PARTICL_RPC_PORT_BASE", BASE_RPC_PORT))
|
||||
BITCOIN_RPC_PORT_BASE = int(os.getenv("BITCOIN_RPC_PORT_BASE", BTC_BASE_RPC_PORT))
|
||||
LITECOIN_RPC_PORT_BASE = int(os.getenv("LITECOIN_RPC_PORT_BASE", LTC_BASE_RPC_PORT))
|
||||
DOGECOIN_RPC_PORT_BASE = int(os.getenv("DOGECOIN_RPC_PORT_BASE", DOGE_BASE_RPC_PORT))
|
||||
DECRED_WALLET_RPC_PORT_BASE = int(os.getenv("DECRED_WALLET_RPC_PORT_BASE", 9210))
|
||||
NAMECOIN_RPC_PORT_BASE = int(os.getenv("NAMECOIN_RPC_PORT_BASE", NMC_BASE_RPC_PORT))
|
||||
XMR_BASE_RPC_PORT = int(os.getenv("XMR_BASE_RPC_PORT", XMR_BASE_RPC_PORT))
|
||||
BITCOINCASH_RPC_PORT_BASE = int(
|
||||
os.getenv("BITCOINCASH_RPC_PORT_BASE", BCH_BASE_RPC_PORT)
|
||||
)
|
||||
DECRED_WALLET_RPC_PORT_BASE = int(os.getenv("DECRED_WALLET_RPC_PORT_BASE", 9210))
|
||||
XMR_BASE_RPC_PORT = int(os.getenv("XMR_BASE_RPC_PORT", XMR_BASE_RPC_PORT))
|
||||
DOGECOIN_RPC_PORT_BASE = int(os.getenv("DOGECOIN_RPC_PORT_BASE", DOGE_BASE_RPC_PORT))
|
||||
TEST_COINS_LIST = os.getenv("TEST_COINS_LIST", "bitcoin,monero")
|
||||
|
||||
NUM_NODES = int(os.getenv("NUM_NODES", 3))
|
||||
@@ -130,6 +132,17 @@ def calldcrrpc(
|
||||
return callrpc_dcr(base_rpc_port + node_id, auth, method, params)
|
||||
|
||||
|
||||
def callnmcrpc(
|
||||
node_id,
|
||||
method,
|
||||
params=[],
|
||||
wallet="wallet.dat",
|
||||
base_rpc_port=NAMECOIN_RPC_PORT_BASE + PORT_OFS,
|
||||
):
|
||||
auth = "test_nmc_{0}:test_nmc_pwd_{0}".format(node_id)
|
||||
return callrpc(base_rpc_port + node_id, auth, method, params, wallet)
|
||||
|
||||
|
||||
def callbchrpc(
|
||||
node_id,
|
||||
method,
|
||||
@@ -163,6 +176,8 @@ def updateThread(cls):
|
||||
callbchrpc(0, "generatetoaddress", [1, cls.bch_addr])
|
||||
if cls.doge_addr is not None:
|
||||
calldogerpc(0, "generatetoaddress", [1, cls.doge_addr])
|
||||
if cls.nmc_addr is not None:
|
||||
callnmcrpc(0, "generatetoaddress", [1, cls.nmc_addr])
|
||||
except Exception as e:
|
||||
print("updateThread error", str(e))
|
||||
cls.delay_event.wait(random.randrange(cls.update_min, cls.update_max))
|
||||
@@ -388,6 +403,18 @@ def start_processes(self):
|
||||
0, "generatetoaddress", [num_blocks - have_blocks, self.doge_addr]
|
||||
)
|
||||
|
||||
if "namecoin" in TEST_COINS_LIST:
|
||||
self.nmc_addr = callnmcrpc(0, "getnewaddress", ["mining_addr", "bech32"])
|
||||
num_blocks: int = 500
|
||||
have_blocks: int = callnmcrpc(0, "getblockcount")
|
||||
if have_blocks < num_blocks:
|
||||
logging.info(
|
||||
f"Mining {num_blocks - have_blocks} Namecoin blocks to {self.nmc_addr}"
|
||||
)
|
||||
callnmcrpc(
|
||||
0, "generatetoaddress", [num_blocks - have_blocks, self.nmc_addr]
|
||||
)
|
||||
|
||||
if RESET_TEST:
|
||||
# Lower output split threshold for more stakeable outputs
|
||||
for i in range(NUM_NODES):
|
||||
@@ -444,6 +471,7 @@ class BaseTestWithPrepare(unittest.TestCase):
|
||||
dcr_addr = "SsYbXyjkKAEXXcGdFgr4u4bo4L8RkCxwQpH"
|
||||
dcr_acc = None
|
||||
doge_addr = None
|
||||
nmc_addr = None
|
||||
|
||||
initialised = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user