diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index 9524e9b46f..06a05695a6 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -297,6 +297,7 @@ impl WriteAccountMapEntry { // If it's the first non-cache insert, also bump the stored ref count self.borrow_owned_entry().add_un_ref(true); } + self.borrow_owned_entry().set_dirty(true); } } diff --git a/runtime/src/in_mem_accounts_index.rs b/runtime/src/in_mem_accounts_index.rs index b283806277..339b6b75c8 100644 --- a/runtime/src/in_mem_accounts_index.rs +++ b/runtime/src/in_mem_accounts_index.rs @@ -209,6 +209,7 @@ impl InMemAccountsIndex { Self::update_stat(&self.stats().updates_in_mem, 1); } Entry::Vacant(vacant) => { + assert!(new_value.dirty()); vacant.insert(new_value); self.stats().insert_or_delete(true, self.bin); } @@ -233,7 +234,7 @@ impl InMemAccountsIndex { if addref { current.add_un_ref(true); } - new_value.set_dirty(true); + current.set_dirty(true); } // modifies slot_list @@ -344,6 +345,7 @@ impl InMemAccountsIndex { )) } Entry::Vacant(account_entry) => { + assert!(new_entry.dirty()); account_entry.insert(new_entry); None }