Compare commits
6 Commits
master
...
natsoni/fi
Author | SHA1 | Date | |
---|---|---|---|
|
af7e5fa498 | ||
|
ac62e28656 | ||
|
1c55eef276 | ||
|
13aa62878e | ||
|
2c676ae06e | ||
|
f897679ed6 |
@ -7,7 +7,7 @@ import cpfpRepository from '../repositories/CpfpRepository';
|
||||
import { RowDataPacket } from 'mysql2';
|
||||
|
||||
class DatabaseMigration {
|
||||
private static currentVersion = 78;
|
||||
private static currentVersion = 82;
|
||||
private queryTimeout = 3600_000;
|
||||
private statisticsAddedIndexed = false;
|
||||
private uniqueLogs: string[] = [];
|
||||
@ -652,11 +652,6 @@ class DatabaseMigration {
|
||||
await this.$executeQuery('ALTER TABLE `prices` ADD `THB` float DEFAULT "-1"');
|
||||
await this.$executeQuery('ALTER TABLE `prices` ADD `TRY` float DEFAULT "-1"');
|
||||
await this.$executeQuery('ALTER TABLE `prices` ADD `ZAR` float DEFAULT "-1"');
|
||||
|
||||
await this.$executeQuery('TRUNCATE hashrates');
|
||||
await this.$executeQuery('TRUNCATE difficulty_adjustments');
|
||||
await this.$executeQuery(`UPDATE state SET string = NULL WHERE name = 'pools_json_sha'`);
|
||||
|
||||
await this.updateToSchemaVersion(75);
|
||||
}
|
||||
|
||||
@ -674,6 +669,34 @@ class DatabaseMigration {
|
||||
await this.$executeQuery('ALTER TABLE `prices` CHANGE `time` `time` datetime NOT NULL');
|
||||
await this.updateToSchemaVersion(78);
|
||||
}
|
||||
|
||||
if (databaseSchemaVersion < 79 && isBitcoin === true) {
|
||||
await this.$executeQuery('TRUNCATE hashrates');
|
||||
await this.updateToSchemaVersion(79);
|
||||
}
|
||||
|
||||
if (databaseSchemaVersion < 80 && isBitcoin === true) {
|
||||
await this.$executeQuery('TRUNCATE difficulty_adjustments');
|
||||
await this.updateToSchemaVersion(80);
|
||||
}
|
||||
|
||||
if (databaseSchemaVersion < 81 && isBitcoin === true) {
|
||||
await this.$executeQuery(`UPDATE state SET string = NULL WHERE name = 'pools_json_sha'`);
|
||||
await this.updateToSchemaVersion(81);
|
||||
}
|
||||
|
||||
if (databaseSchemaVersion < 82 && config.MEMPOOL.NETWORK === 'liquid') {
|
||||
await this.$executeQuery('TRUNCATE TABLE elements_pegs');
|
||||
await this.$executeQuery('TRUNCATE TABLE federation_txos');
|
||||
await this.$executeQuery('SET FOREIGN_KEY_CHECKS = 0');
|
||||
await this.$executeQuery('TRUNCATE TABLE federation_addresses');
|
||||
await this.$executeQuery('SET FOREIGN_KEY_CHECKS = 1');
|
||||
await this.$executeQuery(`INSERT INTO federation_addresses (bitcoinaddress) VALUES ('bc1qxvay4an52gcghxq5lavact7r6qe9l4laedsazz8fj2ee2cy47tlqff4aj4')`); // Federation change address
|
||||
await this.$executeQuery(`INSERT INTO federation_addresses (bitcoinaddress) VALUES ('3EiAcrzq1cELXScc98KeCswGWZaPGceT1d')`); // Federation change address
|
||||
await this.$executeQuery(`UPDATE state SET number = 0 WHERE name = 'last_elements_block';`);
|
||||
await this.$executeQuery(`UPDATE state SET number = 0 WHERE name = 'last_bitcoin_block_audit';`);
|
||||
await this.updateToSchemaVersion(71);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -306,7 +306,7 @@ class ElementsParser {
|
||||
|
||||
for (const utxo of unspentAsTip) {
|
||||
if (utxo.expiredAt === 0 && block.height >= utxo.blocknumber + utxo.timelock) { // The UTXO is expiring in this block
|
||||
await DB.query(`UPDATE federation_txos SET unspent = 0, lastblockupdate = ?, expiredAt = ? WHERE txid = ? AND txindex = ?`, [confirmedTip, block.time, utxo.txid, utxo.txindex]);
|
||||
await DB.query(`UPDATE federation_txos SET lastblockupdate = ?, expiredAt = ? WHERE txid = ? AND txindex = ?`, [confirmedTip, block.time, utxo.txid, utxo.txindex]);
|
||||
} else if (utxo.expiredAt === 0 && confirmedTip >= utxo.blocknumber + utxo.timelock) { // The UTXO is expiring before the tip: we need to keep track of it
|
||||
await DB.query(`UPDATE federation_txos SET lastblockupdate = ? WHERE txid = ? AND txindex = ?`, [utxo.blocknumber + utxo.timelock - 1, utxo.txid, utxo.txindex]);
|
||||
} else {
|
||||
|
@ -122,8 +122,8 @@ export class FederationUtxosListComponent implements OnInit {
|
||||
|
||||
getGradientColor(value: number): string {
|
||||
const distanceToGreen = Math.abs(4032 - value);
|
||||
const green = 'var(--green)';
|
||||
const red = 'var(--red)';
|
||||
const green = '#3bcc49';
|
||||
const red = '#dc3545';
|
||||
|
||||
if (value < 0) {
|
||||
return red;
|
||||
|
Loading…
x
Reference in New Issue
Block a user