Raise Bitcoin, Particl and Monero versions.

This commit is contained in:
tecnovert 2021-06-25 23:02:54 +02:00
parent c1039c425d
commit 398ef268a6
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
3 changed files with 39 additions and 23 deletions

View file

@ -791,28 +791,32 @@ class BasicSwap(BaseApp):
self.log.info('Upgrading database from version %d to %d.', db_version, CURRENT_DB_VERSION)
while True:
if db_version == 6:
session = scoped_session(self.session_factory)
session = scoped_session(self.session_factory)
current_version = db_version
if current_version == 6:
session.execute('ALTER TABLE bids ADD COLUMN security_token BLOB')
session.execute('ALTER TABLE offers ADD COLUMN security_token BLOB')
db_version += 1
self.db_version = db_version
self.setIntKVInSession('db_version', db_version, session)
session.commit()
session.close()
session.remove()
self.log.info('Upgraded database to version {}'.format(self.db_version))
continue
if db_version == 7:
session = scoped_session(self.session_factory)
elif current_version == 7:
session.execute('ALTER TABLE transactions ADD COLUMN block_hash BLOB')
session.execute('ALTER TABLE transactions ADD COLUMN block_height INTEGER')
session.execute('ALTER TABLE transactions ADD COLUMN block_time INTEGER')
db_version += 1
elif current_version == 8:
session.execute('''
CREATE TABLE wallets (
record_id INTEGER NOT NULL,
coin_id INTEGER,
wallet_name VARCHAR,
balance_type INTEGER,
amount BIGINT,
updated_at BIGINT,
created_at BIGINT,
PRIMARY KEY (record_id))''')
db_version += 1
if current_version != db_version:
self.db_version = db_version
self.setIntKVInSession('db_version', db_version, session)
session.commit()

View file

@ -4,18 +4,23 @@
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import struct
import time
import struct
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from enum import IntEnum, auto
from sqlalchemy.ext.declarative import declarative_base
CURRENT_DB_VERSION = 8
Base = declarative_base()
class TableTypes(IntEnum):
OFFER = auto()
BID = auto()
class DBKVInt(Base):
__tablename__ = 'kv_int'
@ -349,6 +354,13 @@ class RevokedMessage(Base):
expires_at = sa.Column(sa.BigInteger)
class TableTypes(IntEnum):
OFFER = auto()
BID = auto()
class Wallets(Base):
__tablename__ = 'wallets'
record_id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
coin_id = sa.Column(sa.Integer)
wallet_name = sa.Column(sa.String)
balance_type = sa.Column(sa.Integer)
amount = sa.Column(sa.BigInteger)
updated_at = sa.Column(sa.BigInteger)
created_at = sa.Column(sa.BigInteger)

View file

@ -41,11 +41,11 @@ else:
FILE_EXT = 'tar.gz'
known_coins = {
'particl': ('0.21.0.2', 'rc1'),
'particl': ('0.21.1.2', ''),
'litecoin': ('0.18.1', ''),
'bitcoin': ('0.21.0', ''),
'bitcoin': ('0.21.1', ''),
'namecoin': ('0.18.0', ''),
'monero': ('0.17.1.9', ''),
'monero': ('0.17.2.0', ''),
}
logger = logging.getLogger()
@ -60,7 +60,7 @@ BASE_XMR_WALLET_PORT = int(os.getenv('BASE_XMR_WALLET_PORT', 29998))
XMR_WALLET_RPC_HOST = os.getenv('XMR_WALLET_RPC_HOST', '127.0.0.1')
XMR_WALLET_RPC_USER = os.getenv('XMR_WALLET_RPC_USER', 'xmr_wallet_user')
XMR_WALLET_RPC_PWD = os.getenv('XMR_WALLET_RPC_PWD', 'xmr_wallet_pwd')
XMR_SITE_COMMIT = 'd27c1eee9fe0e8daa011d07baae8b67dd2b62a04' # Lock hashes.txt to monero version
XMR_SITE_COMMIT = 'b86dac8b74e3e8663f8f468c19c2fea6ec523b62' # Lock hashes.txt to monero version
DEFAULT_XMR_RESTORE_HEIGHT = 2245107