New particl core version.

Display core versions on the wallets page.
2024-05-20_merge
tecnovert 5 years ago
parent 876c2234f3
commit 321ec4acb2
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
  1. 6
      .travis.yml
  2. 2
      basicswap/__init__.py
  3. 25
      basicswap/basicswap.py
  4. 1
      basicswap/http_server.py
  5. 2
      basicswap/templates/wallets.html
  6. 4
      bin/basicswap_prepare.py
  7. 13
      doc/upgrade.md
  8. 2
      tests/basicswap/test_reload.py

@ -7,7 +7,7 @@ stages:
env:
global:
- TEST_DIR=~/test_basicswap2/
- PARTICL_BINDIR=/opt/binaries/particl-0.18.0.12/bin/
- PARTICL_BINDIR=/opt/binaries/particl-0.18.1.1/bin/
- BITCOIN_BINDIR=/opt/binaries/bitcoin-0.18.0/bin/
- LITECOIN_BINDIR=/opt/binaries/litecoin-0.17.1/bin/
before_install:
@ -16,10 +16,10 @@ before_script:
- if [ ! -d "/opt/binaries" ]; then mkdir -p "/opt/binaries" ; fi
- if [ ! -d "$BITCOIN_BINDIR" ]; then cd "/opt/binaries" && wget https://bitcoincore.org/bin/bitcoin-core-0.18.0/bitcoin-0.18.0-x86_64-linux-gnu.tar.gz && tar xvf bitcoin-0.18.0-x86_64-linux-gnu.tar.gz ; fi
- if [ ! -d "$LITECOIN_BINDIR" ]; then cd "/opt/binaries" && wget https://download.litecoin.org/litecoin-0.17.1/linux/litecoin-0.17.1-x86_64-linux-gnu.tar.gz && tar xvf litecoin-0.17.1-x86_64-linux-gnu.tar.gz ; fi
- if [ ! -d "$PARTICL_BINDIR" ]; then cd "/opt/binaries" && wget https://github.com/particl/particl-core/releases/download/v0.18.0.12/particl-0.18.0.12-x86_64-linux-gnu_nousb.tar.gz && tar xvf particl-0.18.0.12-x86_64-linux-gnu_nousb.tar.gz ; fi
- if [ ! -d "$PARTICL_BINDIR" ]; then cd "/opt/binaries" && wget https://github.com/particl/particl-core/releases/download/v0.18.1.1/particl-0.18.1.1-x86_64-linux-gnu_nousb.tar.gz && tar xvf particl-0.18.1.1-x86_64-linux-gnu_nousb.tar.gz ; fi
script:
- cd $TRAVIS_BUILD_DIR
- export PARTICL_BINDIR=/opt/binaries/particl-0.18.0.12/bin/
- export PARTICL_BINDIR=/opt/binaries/particl-0.18.1.1/bin/
- export BITCOIN_BINDIR=/opt/binaries/bitcoin-0.18.0/bin/
- export LITECOIN_BINDIR=/opt/binaries/litecoin-0.17.1/bin/
- export DATADIRS=~/test_basicswap2/

@ -1,3 +1,3 @@
name = "basicswap"
__version__ = "0.0.3"
__version__ = "0.0.4"

@ -61,7 +61,6 @@ import basicswap.segwit_addr as segwit_addr
DEBUG = True
SMSG_SECONDS_IN_DAY = 86400
MIN_OFFER_VALID_TIME = 60 * 10
@ -316,7 +315,11 @@ class BasicSwap():
self.swaps_in_progress = dict()
if self.chain == 'regtest':
SMSG_SECONDS_IN_DAY = 600
self.SMSG_SECONDS_IN_DAY = 600
self.SMSG_SECONDS_IN_HOUR = 60 * 2
else:
self.SMSG_SECONDS_IN_DAY = 86400
self.SMSG_SECONDS_IN_HOUR = 60 * 60
self.prepareLogging()
self.log.info('Network: {}'.format(self.chain))
@ -445,6 +448,7 @@ class BasicSwap():
'use_csv': chain_client_settings.get('use_csv', True),
'core_version_group': chain_client_settings.get('core_version_group', 0),
'pid': None,
'core_version': None,
'explorers': [],
}
@ -504,6 +508,7 @@ class BasicSwap():
self.waitForDaemonRPC(c)
core_version = self.callcoinrpc(c, 'getnetworkinfo')['version']
self.log.info('%s Core version %d', chainparams[c]['name'].capitalize(), core_version)
self.coin_clients[c]['core_version'] = core_version
# Sanity checks
if c == Coins.PART:
@ -724,7 +729,9 @@ class BasicSwap():
else:
offer_addr = addr_send_from
self.callrpc('smsgaddlocaladdress', [offer_addr]) # Enable receiving smsg
ro = self.callrpc('smsgsend', [offer_addr, self.network_addr, payload_hex, False, 1, False, False, True])
options = {'decodehex': True, 'ttl_is_seconds': True}
msg_valid = self.SMSG_SECONDS_IN_HOUR * 1
ro = self.callrpc('smsgsend', [offer_addr, self.network_addr, payload_hex, False, msg_valid, False, options])
msg_id = ro['msgid']
offer_id = bytes.fromhex(msg_id)
@ -1035,7 +1042,9 @@ class BasicSwap():
else:
bid_addr = addr_send_from
self.callrpc('smsgaddlocaladdress', [bid_addr]) # Enable receiving smsg
ro = self.callrpc('smsgsend', [bid_addr, offer.addr_from, payload_hex, False, 1, False, False, True])
options = {'decodehex': True, 'ttl_is_seconds': True}
msg_valid = self.SMSG_SECONDS_IN_HOUR * 1
ro = self.callrpc('smsgsend', [bid_addr, offer.addr_from, payload_hex, False, msg_valid, False, options])
msg_id = ro['msgid']
bid_id = bytes.fromhex(msg_id)
@ -1177,7 +1186,10 @@ class BasicSwap():
bid_bytes = msg_buf.SerializeToString()
payload_hex = str.format('{:02x}', MessageTypes.BID_ACCEPT) + bid_bytes.hex()
ro = self.callrpc('smsgsend', [offer.addr_from, bid.bid_addr, payload_hex, False, 1, False, False, True])
options = {'decodehex': True, 'ttl_is_seconds': True}
# TODO: set msg_valid based on bid / offer parameters
msg_valid = self.SMSG_SECONDS_IN_HOUR * 48
ro = self.callrpc('smsgsend', [offer.addr_from, bid.bid_addr, payload_hex, False, msg_valid, False, options])
msg_id = ro['msgid']
accept_msg_id = bytes.fromhex(msg_id)
@ -2004,7 +2016,7 @@ class BasicSwap():
options = {'encoding': 'none'}
ro = self.callrpc('smsginbox', ['all', '', options])
for msg in ro['messages']:
expire_at = msg['sent'] + msg['daysretention'] * SMSG_SECONDS_IN_DAY
expire_at = msg['sent'] + msg['daysretention'] * self.SMSG_SECONDS_IN_DAY
if expire_at < now:
options = {'encoding': 'none', 'delete': True}
del_msg = self.callrpc('smsg', [msg['msgid'], options])
@ -2351,6 +2363,7 @@ class BasicSwap():
blockchaininfo = self.callcoinrpc(coin, 'getblockchaininfo')
walletinfo = self.callcoinrpc(coin, 'getwalletinfo')
rv = {
'version': self.coin_clients[coin]['core_version'],
'deposit_address': self.getCachedAddressForCoin(coin),
'name': chainparams[coin]['name'].capitalize(),
'blocks': blockchaininfo['blocks'],

@ -232,6 +232,7 @@ class HttpHandler(BaseHTTPRequestHandler):
est_fee = (fee_rate * tx_vsize) / 1000
wallets_formatted.append({
'name': w['name'],
'version': w['version'],
'cid': str(int(k)),
'fee_rate': format8(fee_rate * COIN),
'est_fee': format8(est_fee * COIN),

@ -13,7 +13,7 @@
{% for w in wallets %}
<h4>{{ w.name }}</h4>
<h4>{{ w.name }} {{ w.version }}</h4>
{% if w.error %}
<p>Error: {{ w.error }}</p>
{% else %}

@ -40,7 +40,7 @@ else:
BIN_ARCH = 'x86_64-linux-gnu.tar.gz'
known_coins = {
'particl': '0.18.1.0',
'particl': '0.18.1.1',
'litecoin': '0.17.1',
'bitcoin': '0.18.0',
'namecoin': '0.18.0',
@ -470,7 +470,7 @@ def main():
return 0
logger.info('With coins: %s', ', '.join(with_coins))
if os.path.exists(config_path):
if os.path.exists(config_path) and not prepare_bin_only:
exitWithError('{} exists'.format(config_path))
for c in with_coins:

@ -0,0 +1,13 @@
## Update basicswap version
If installed through pip:
cd basicswap
git pull
pip3 install .
## Update core versions
basicswap-prepare -preparebinonly

@ -8,7 +8,7 @@
"""
mkdir -p /tmp/test_basicswap/bin/{particl,bitcoin}
cp ~/tmp/particl-0.18.1.0-x86_64-linux-gnu.tar.gz /tmp/test_basicswap/bin/particl
cp ~/tmp/particl-0.18.1.1-x86_64-linux-gnu.tar.gz /tmp/test_basicswap/bin/particl
cp ~/tmp/bitcoin-0.18.0-x86_64-linux-gnu.tar.gz /tmp/test_basicswap/bin/bitcoin

Loading…
Cancel
Save