TODO(ddimaria): remove
(&mut self, key: &Account, nonce: U256)
| 88 | |
| 89 | // TODO(ddimaria): remove |
| 90 | pub(crate) fn update_nonce(&mut self, key: &Account, nonce: U256) -> Result<U256> { |
| 91 | let mut account_data = self.get_account(key)?; |
| 92 | |
| 93 | // the passed in nonce is lower than the current nonce + 1 |
| 94 | if nonce < account_data.nonce + 1 { |
| 95 | return Err(ChainError::NonceTooLow(nonce.to_string(), key.to_string())); |
| 96 | } |
| 97 | |
| 98 | // the passed in nonce is higher than the current nonce + 1 |
| 99 | if nonce > account_data.nonce + 1 { |
| 100 | return Err(ChainError::NonceTooHigh(nonce.to_string(), key.to_string())); |
| 101 | } |
| 102 | |
| 103 | account_data.nonce = nonce; |
| 104 | self.upsert(key, &account_data)?; |
| 105 | |
| 106 | Ok(account_data.nonce) |
| 107 | } |
| 108 | |
| 109 | pub(crate) fn get_account_balance_by_block( |
| 110 | &self, |