Skip to content

Commit

Permalink
get_amount
Browse files Browse the repository at this point in the history
  • Loading branch information
YeahNotSewerSide committed Apr 27, 2024
1 parent 7a154ab commit 87b2712
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/blockchaintree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ impl BlockChainTree {

Ok(())
}
pub async fn get_amount(&self, owner: &[u8; 32]) -> Result<U256, Report<BlockChainTreeError>> {
match self
.summary_db
.get(owner)
.change_context(BlockChainTreeError::BlockChainTree(
BCTreeErrorKind::GetFunds,
))
.attach_printable("failed to read config")?
{
Some(v) => Ok(tools::load_u256(&v).unwrap().0),
None => Ok(U256::zero()),
}
}

pub async fn send_amount(
&self,
Expand Down

0 comments on commit 87b2712

Please sign in to comment.