use crate::prelude::{ExecutableTransaction, Interpreter, InterpreterStorage, RuntimeError};
use crate::interpreter::{InitialBalances, RuntimeBalances};
use fuel_tx::ConsensusParameters;
use fuel_types::Word;
use std::io;
impl<S, T> Interpreter<S, T>
where
S: InterpreterStorage,
{
pub(crate) fn finalize_outputs<Tx>(
tx: &mut Tx,
revert: bool,
remaining_gas: Word,
initial_balances: &InitialBalances,
balances: &RuntimeBalances,
params: &ConsensusParameters,
) -> Result<(), RuntimeError>
where
Tx: ExecutableTransaction,
{
tx.update_outputs(params, revert, remaining_gas, initial_balances, balances)
.map_err(|e| io::Error::new(
io::ErrorKind::Other,
format!("a valid VM execution shouldn't result in a state where it can't compute its refund. This is a bug! {e}")
))?;
Ok(())
}
}