ido incomplete c02
This commit is contained in:
parent
ce9dba23cf
commit
0629e168c3
6 changed files with 698 additions and 273 deletions
|
|
@ -51,3 +51,9 @@ name = "moria_read_slots"
|
|||
type = "u32"
|
||||
doc = "Number of read connection pool slots for the Moria lending database (default: 8)"
|
||||
default = "8"
|
||||
|
||||
[[param]]
|
||||
name = "ido_read_slots"
|
||||
type = "u32"
|
||||
doc = "Number of read connection pool slots for the Moria lending database (default: 8)"
|
||||
default = "8"
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -18,6 +18,7 @@ use crate::db::cauldron::tokentoken::create_table as tokentoken_prepare_tables;
|
|||
use crate::db::crc20::prepare_tables as crc20_prepare_tables;
|
||||
use crate::db::moria::prepare_tables as moria_prepare_tables;
|
||||
use crate::db::oracle::prepare_tables as oracle_prepare_tables;
|
||||
use crate::db::ido::prepare_tables as ido_prepare_tables;
|
||||
|
||||
/// Create read and write database pools for a given database path
|
||||
async fn create_db_pool(db_path: &str, read_max_size: u32) -> (bool, SqlitePool, SqlitePool) {
|
||||
|
|
@ -89,6 +90,7 @@ pub struct ReadSlots {
|
|||
pub crc20: u32,
|
||||
pub oracle: u32,
|
||||
pub moria: u32,
|
||||
pub ido: u32,
|
||||
}
|
||||
|
||||
/// Initialize all databases and return a DB struct
|
||||
|
|
@ -135,6 +137,15 @@ pub async fn initialize_databases(network: &str, read_slots: ReadSlots) -> Resul
|
|||
moria_prepare_tables(&moria_db_write).await;
|
||||
}
|
||||
|
||||
// Initialize ido database
|
||||
let (db_exists, ido_db_write, ido_db_read) =
|
||||
create_db_pool(&db_path(db_dir, "ido.db"), read_slots.ido).await;
|
||||
if !db_exists {
|
||||
cauldron_prepare_tables(&ido_db_write).await;
|
||||
} else {
|
||||
check_db_version(&ido_db_read).await?;
|
||||
}
|
||||
|
||||
Ok(DB {
|
||||
cauldron_w: cauldron_db_write,
|
||||
cauldron_r: cauldron_db_read,
|
||||
|
|
@ -146,5 +157,7 @@ pub async fn initialize_databases(network: &str, read_slots: ReadSlots) -> Resul
|
|||
oracle_r: oracle_db_read,
|
||||
moria_w: moria_db_write,
|
||||
moria_r: moria_db_read,
|
||||
ido_r: ido_db_read,
|
||||
ido_w: ido_db_write,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,4 +35,7 @@ pub struct DB {
|
|||
// moria lending protocol
|
||||
pub moria_w: SqlitePool,
|
||||
pub moria_r: SqlitePool,
|
||||
// ido
|
||||
pub ido_w: SqlitePool,
|
||||
pub ido_r: SqlitePool,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -449,6 +449,7 @@ pub async fn index_blocks(
|
|||
&sorted_txs,
|
||||
&blockhash,
|
||||
mtp as i64,
|
||||
block_height as i64,
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ async fn start_program(
|
|||
crc20: config.crc20_read_slots,
|
||||
oracle: config.oracle_read_slots,
|
||||
moria: config.moria_read_slots,
|
||||
ido: config.ido_read_slots,
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue