Skip to content

Commit

Permalink
bug fix+tests
Browse files Browse the repository at this point in the history
  • Loading branch information
YeahNotSewerSide committed Apr 27, 2024
1 parent 87b2712 commit 340510f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2,768 deletions.
12 changes: 6 additions & 6 deletions src/blockchaintree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl BlockChainTree {

pub async fn add_amount(
&self,
owner: &[u8; 32],
owner: &[u8],
amount: U256,
) -> Result<(), Report<BlockChainTreeError>> {
self.summary_db
Expand All @@ -119,7 +119,7 @@ impl BlockChainTree {

pub async fn sub_amount(
&self,
owner: &[u8; 32],
owner: &[u8],
amount: U256,
) -> Result<(), Report<BlockChainTreeError>> {
self.summary_db
Expand All @@ -143,7 +143,7 @@ impl BlockChainTree {

Ok(())
}
pub async fn get_amount(&self, owner: &[u8; 32]) -> Result<U256, Report<BlockChainTreeError>> {
pub async fn get_amount(&self, owner: &[u8; 33]) -> Result<U256, Report<BlockChainTreeError>> {
match self
.summary_db
.get(owner)
Expand All @@ -159,8 +159,8 @@ impl BlockChainTree {

pub async fn send_amount(
&self,
from: &[u8; 32],
to: &[u8; 32],
from: &[u8],
to: &[u8],
amount: U256,
) -> Result<(), Report<BlockChainTreeError>> {
self.summary_db
Expand All @@ -186,7 +186,7 @@ impl BlockChainTree {
db.insert(from, buf)?;

let mut buf: Vec<u8> = Vec::with_capacity(tools::u256_size(&to_amount));
tools::dump_u256(&from_amount, &mut buf).unwrap();
tools::dump_u256(&to_amount, &mut buf).unwrap();
db.insert(to, buf)?;
Ok(())
},
Expand Down
Loading

0 comments on commit 340510f

Please sign in to comment.