chore: add gas_mut function (#1427)

This commit is contained in:
Matthias Seitz 2022-06-29 17:54:07 +02:00 committed by GitHub
parent f5793525f2
commit 7e85b33167
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -158,6 +158,14 @@ impl TypedTransaction {
} }
} }
pub fn gas_mut(&mut self) -> &mut Option<U256> {
match self {
Legacy(inner) => &mut inner.gas,
Eip2930(inner) => &mut inner.tx.gas,
Eip1559(inner) => &mut inner.gas,
}
}
pub fn set_gas<T: Into<U256>>(&mut self, gas: T) -> &mut Self { pub fn set_gas<T: Into<U256>>(&mut self, gas: T) -> &mut Self {
let gas = gas.into(); let gas = gas.into();
match self { match self {