Compare commits
1 Commits
ef5672b7a8
...
4ad07f7fe1
Author | SHA1 | Date | |
---|---|---|---|
4ad07f7fe1 |
@ -225,6 +225,7 @@ impl BrainData {
|
||||
|
||||
/// This is written to run every minute
|
||||
pub async fn vm_nodes_cron(&self) {
|
||||
log::debug!("Running vm nodes cron...");
|
||||
let mut nodes = self.vm_nodes.write().unwrap();
|
||||
let mut vm_contracts = self.vm_contracts.write().unwrap();
|
||||
for node in nodes.iter_mut() {
|
||||
@ -243,7 +244,10 @@ impl BrainData {
|
||||
node.offline_minutes += 1;
|
||||
// compensate contract admin if the node is offline more then 5 minutes
|
||||
if node.offline_minutes > 5 {
|
||||
for c in vm_contracts.iter() {
|
||||
for c in vm_contracts
|
||||
.iter()
|
||||
.filter(|c| c.node_pubkey == node.public_key)
|
||||
{
|
||||
let compensation = c.price_per_minute() * 24;
|
||||
if compensation < operator.escrow {
|
||||
operator.escrow -= compensation;
|
||||
|
Loading…
Reference in New Issue
Block a user