From 12652cf2b372f35baf34de8ea29a665493ae3a7d Mon Sep 17 00:00:00 2001 From: gaoxin Date: Tue, 26 Nov 2024 22:53:49 +0800 Subject: [PATCH] fix: create the miner account if not exist --- src/storage.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/storage.rs b/src/storage.rs index f5ae12b..fcbb425 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -13,6 +13,7 @@ use revm::{ primitives::{Account, AccountInfo, Bytecode, EvmState, B256, BLOCK_HASH_HISTORY, U256}, CacheState, Database, DatabaseCommit, DatabaseRef, TransitionAccount, TransitionState, }; +use revm_primitives::KECCAK_EMPTY; use std::{ collections::{btree_map, hash_map, BTreeMap, HashMap}, sync::{ @@ -624,6 +625,13 @@ where } info.balance = info.balance.saturating_add(U256::from(inc_rewards)); balance = info.balance; + } else if inc_rewards != 0 { + result = Ok(Some(AccountInfo::new( + U256::from(inc_rewards), + 0, + KECCAK_EMPTY, + Bytecode::default(), + ))); } } if address != self.coinbase || self.raw_transfer {