Consume from AccountsDataMeter (backport #21994) (#22323)

* Consume from AccountsDataMeter (#21994)

(cherry picked from commit 1460f00e0f)

# Conflicts:
#	program-runtime/src/invoke_context.rs

* fixup! conflicts

* fix tests for v1.9

* fixup! clippy

Co-authored-by: Brooks Prumo <brooks@solana.com>
This commit is contained in:
mergify[bot]
2022-01-06 17:01:02 +00:00
committed by GitHub
parent 4be6e52a4f
commit 7267ebaaf2
3 changed files with 215 additions and 2 deletions

View File

@@ -64,10 +64,21 @@ impl AccountsDataMeter {
let amount = amount.abs() as u64;
self.current = self.current.saturating_sub(amount);
}
Ok(())
}
}
#[cfg(test)]
impl AccountsDataMeter {
pub fn set_maximum(&mut self, maximum: u64) {
self.maximum = maximum;
}
pub fn set_current(&mut self, current: u64) {
self.current = current;
}
}
#[cfg(test)]
mod tests {
use super::*;