[−][src]Struct cita_state::StateObject
Fields
balance: U256
nonce: U256
storage_root: H256
code_hash: H256
code: Vec<u8>
code_size: usize
code_state: CodeState
storage_changes: HashMap<H256, H256>
Methods
impl StateObject
[src]
pub fn new(balance: U256, nonce: U256) -> StateObject
[src]
Create a new account.
Note: If contract account generated, make sure you use init_code
on
this before commit
ing.
pub fn from_rlp(data: &[u8]) -> Result<StateObject, Error>
[src]
Create a new account from rlp bytes.
Note: make sure you use read_code
after this.
pub fn account(&self) -> Account
[src]
Get the account from state object.
pub fn rlp(&self) -> Vec<u8>
[src]
Get the rlp data.
pub fn is_empty(&self) -> bool
[src]
Function is_empty returns whether the given account is empty. Empty is defined according to EIP161 (balance = nonce = code = 0).
pub fn init_code(&mut self, code: Vec<u8>)
[src]
Init the code by given data.
pub fn read_code<B: DB>(&mut self, db: Arc<B>) -> Result<(), Error>
[src]
Read the code from database by it's codehash.
pub fn inc_nonce(&mut self)
[src]
Add nonce by 1.
pub fn add_balance(&mut self, x: U256)
[src]
Add balance. Note: overflowing is not allowed.
pub fn sub_balance(&mut self, x: U256)
[src]
Sub balance. Note: overflowing is not allowed.
pub fn set_storage(&mut self, key: H256, value: H256)
[src]
Set (key, value) in storage cache.
pub fn get_storage_at_backend<B: DB>(
&self,
db: Arc<B>,
key: &H256
) -> Result<Option<H256>, Error>
[src]
&self,
db: Arc<B>,
key: &H256
) -> Result<Option<H256>, Error>
Get value by key from database.
pub fn get_storage_at_changes(&self, key: &H256) -> Option<H256>
[src]
Get value by key from storage cache.
pub fn get_storage<B: DB>(
&self,
db: Arc<B>,
key: &H256
) -> Result<Option<H256>, Error>
[src]
&self,
db: Arc<B>,
key: &H256
) -> Result<Option<H256>, Error>
Get value by key.
pub fn get_storage_proof<B: DB>(
&self,
db: Arc<B>,
key: &H256
) -> Result<Vec<Vec<u8>>, Error>
[src]
&self,
db: Arc<B>,
key: &H256
) -> Result<Vec<Vec<u8>>, Error>
Get storage proof
pub fn commit_storage<B: DB>(&mut self, db: Arc<B>) -> Result<(), Error>
[src]
Flush data in storage cache to database.
pub fn commit_code<B: DB>(&mut self, db: Arc<B>) -> Result<(), Error>
[src]
Flush code to database if necessary.
pub fn clone_clean(&self) -> StateObject
[src]
Clone without storage changes.
pub fn clone_dirty(&self) -> StateObject
[src]
Clone with storage changes.
pub fn merge(&mut self, other: StateObject)
[src]
Merge with others.
Trait Implementations
impl Clone for StateObject
[src]
fn clone(&self) -> StateObject
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl From<Account> for StateObject
[src]
impl Debug for StateObject
[src]
Auto Trait Implementations
impl Send for StateObject
impl Sync for StateObject
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self