Compare commits
1 Commits
813ad2aecd
...
bcd377a03d
Author | SHA1 | Date | |
---|---|---|---|
bcd377a03d |
16
src/data.rs
16
src/data.rs
@ -295,10 +295,7 @@ impl BrainData {
|
|||||||
Some(op) if op.escrow > 5000 => 5,
|
Some(op) if op.escrow > 5000 => 5,
|
||||||
_ => 1,
|
_ => 1,
|
||||||
};
|
};
|
||||||
self.add_nano_to_wallet(
|
self.add_nano_to_wallet(&operator_wallet, nanolp_to_collect * escrow_multiplier);
|
||||||
&operator_wallet,
|
|
||||||
nanolp_to_collect * escrow_multiplier,
|
|
||||||
);
|
|
||||||
if c.locked_nano == 0 {
|
if c.locked_nano == 0 {
|
||||||
deleted_contracts.push((c.uuid.clone(), c.node_pubkey.clone()));
|
deleted_contracts.push((c.uuid.clone(), c.node_pubkey.clone()));
|
||||||
}
|
}
|
||||||
@ -796,17 +793,6 @@ impl BrainData {
|
|||||||
nodes.iter().cloned().find(|n| n.public_key == public_key)
|
nodes.iter().cloned().find(|n| n.public_key == public_key)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_user_banned_by_node(&self, user_wallet: &str, node_pubkey: &str) -> bool {
|
|
||||||
if let Some(node) = self.find_node_by_pubkey(&node_pubkey) {
|
|
||||||
if let Some(account) = self.accounts.get(user_wallet) {
|
|
||||||
if account.banned_by.contains(&node.operator_wallet) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn add_vmnode_to_operator(&self, operator_wallet: &str, node_pubkey: &str) {
|
pub fn add_vmnode_to_operator(&self, operator_wallet: &str, node_pubkey: &str) {
|
||||||
self.operators
|
self.operators
|
||||||
.entry(operator_wallet.to_string())
|
.entry(operator_wallet.to_string())
|
||||||
|
@ -160,14 +160,6 @@ impl BrainCli for BrainCliMock {
|
|||||||
async fn new_vm(&self, req: Request<NewVmReq>) -> Result<Response<NewVmResp>, Status> {
|
async fn new_vm(&self, req: Request<NewVmReq>) -> Result<Response<NewVmResp>, Status> {
|
||||||
let req = check_sig_from_req(req)?;
|
let req = check_sig_from_req(req)?;
|
||||||
info!("New VM requested via CLI: {req:?}");
|
info!("New VM requested via CLI: {req:?}");
|
||||||
if self
|
|
||||||
.data
|
|
||||||
.is_user_banned_by_node(&req.admin_pubkey, &req.node_pubkey)
|
|
||||||
{
|
|
||||||
return Err(Status::permission_denied(
|
|
||||||
"This operator banned you. What did you do?",
|
|
||||||
));
|
|
||||||
}
|
|
||||||
let admin_pubkey = req.admin_pubkey.clone();
|
let admin_pubkey = req.admin_pubkey.clone();
|
||||||
let (oneshot_tx, oneshot_rx) = tokio::sync::oneshot::channel();
|
let (oneshot_tx, oneshot_rx) = tokio::sync::oneshot::channel();
|
||||||
self.data.submit_newvm_req(req, oneshot_tx).await;
|
self.data.submit_newvm_req(req, oneshot_tx).await;
|
||||||
|
Loading…
Reference in New Issue
Block a user