Skip to content

Commit

Permalink
Moved UserRole to revaultd.rs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zshan0 committed Apr 7, 2022
1 parent 209de3e commit 6091013
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
6 changes: 2 additions & 4 deletions src/commands/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,11 +495,9 @@ mod tests {
},
schema::{DbTransaction, DbVault},
},
revaultd::{RevaultD, VaultStatus},
revaultd::{RevaultD, UserRole, VaultStatus},
setup_db,
utils::test_utils::{
dummy_revaultd, insert_vault_in_db, test_datadir, MockBitcoindThread, UserRole,
},
utils::test_utils::{dummy_revaultd, insert_vault_in_db, test_datadir, MockBitcoindThread},
};
use revault_tx::{
bitcoin::{
Expand Down
3 changes: 2 additions & 1 deletion src/communication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,14 @@ pub fn check_spend_transaction_size(revaultd: &RevaultD, spend_tx: SpendTransact

#[cfg(test)]
mod tests {
use crate::revaultd::UserRole;
use crate::{
communication::*,
database::{
bitcointx::{RevaultTx, TransactionType},
schema::DbTransaction,
},
utils::test_utils::{dummy_revaultd, test_datadir, UserRole},
utils::test_utils::{dummy_revaultd, test_datadir},
};
use revault_net::{
message, sodiumoxide::crypto::box_::curve25519xsalsa20poly1305::gen_keypair,
Expand Down
3 changes: 2 additions & 1 deletion src/database/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,8 @@ pub fn db_mark_rebroadcastable_spend(
mod test {
use super::*;
use crate::database::schema::DbSpendTransaction;
use crate::utils::test_utils::{dummy_revaultd, test_datadir, UserRole};
use crate::revaultd::UserRole;
use crate::utils::test_utils::{dummy_revaultd, test_datadir};
use revault_tx::{
bitcoin::{
Network, OutPoint, PrivateKey as BitcoinPrivKey, PublicKey as BitcoinPubKey,
Expand Down
3 changes: 2 additions & 1 deletion src/database/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,8 @@ pub fn db_vaults_with_txids_in_period(
mod test {
use super::*;
use crate::database::actions::{db_confirm_deposit, db_insert_new_unconfirmed_vault, setup_db};
use crate::utils::test_utils::{dummy_revaultd, test_datadir, UserRole};
use crate::revaultd::UserRole;
use crate::utils::test_utils::{dummy_revaultd, test_datadir};
use revault_tx::{bitcoin::OutPoint, transactions::transaction_chain};

use std::{fs, str::FromStr};
Expand Down
3 changes: 2 additions & 1 deletion src/jsonrpc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ pub fn rpcserver_loop(
#[cfg(test)]
mod tests {
use super::{read_bytes_from_stream, rpcserver_loop, rpcserver_setup, trimmed};
use crate::utils::test_utils::{dummy_rpcutil, test_datadir, UserRole};
use crate::revaultd::UserRole;
use crate::utils::test_utils::{dummy_rpcutil, test_datadir};

use std::{
fs,
Expand Down
7 changes: 7 additions & 0 deletions src/revaultd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,13 @@ pub struct BlockchainTip {
pub hash: BlockHash,
}

#[derive(Debug, Clone)]
pub enum UserRole {
Stakeholder,
Manager,
ManagerStakeholder,
}

/// Our global state
pub struct RevaultD {
// Bitcoind stuff
Expand Down
9 changes: 1 addition & 8 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub mod test_utils {
use crate::{
bitcoind::{interface::WalletTransaction, BitcoindError},
database::interface::db_exec,
revaultd::{RevaultD, VaultStatus},
revaultd::{RevaultD, UserRole, VaultStatus},
threadmessages::{
BitcoindMessageOut, BitcoindSender, BitcoindThread, SigFetcherMessageOut,
},
Expand All @@ -24,13 +24,6 @@ pub mod test_utils {

use rusqlite::params;

#[derive(Debug, Clone)]
pub enum UserRole {
Stakeholder,
Manager,
ManagerStakeholder,
}

pub fn test_datadir() -> PathBuf {
static mut COUNTER: u64 = 0;
unsafe {
Expand Down

0 comments on commit 6091013

Please sign in to comment.