Skip to content

Commit

Permalink
Use .to_bytes to get the blsscalar in little endian
Browse files Browse the repository at this point in the history
  • Loading branch information
Daksh14 committed Dec 23, 2023
1 parent e083cd1 commit e64107f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Binary file modified assets/dusk_wallet_core.wasm
Binary file not shown.
Binary file modified dusk-wallet-core-0.21.0.wasm
Binary file not shown.
15 changes: 14 additions & 1 deletion src/compat/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::{
};

use alloc::{
format,
string::{String, ToString},
vec::Vec,
};
Expand Down Expand Up @@ -225,7 +226,7 @@ pub fn get_history(args: i32, len: i32) -> i64 {
block_height: note_data.block_height,
amount: note_amount - inputs_amount,
fee: gas_spent * t.fee().gas_price,
id: hash_to_find.to_string(),
id: transaction_hash(hash_to_find),
}),
}
} else {
Expand Down Expand Up @@ -256,6 +257,18 @@ pub fn get_history(args: i32, len: i32) -> i64 {
utils::into_ptr(types::GetHistoryResponse { history: ret })
}

fn transaction_hash(hash: BlsScalar) -> String {
let mut f = String::new();

let tmp = hash.to_bytes();

for &b in tmp.iter() {
f.push_str(&format!("{:02x}", b))
}

f
}

/// Serialize a unprovenTx we recieved from the wallet-core
/// this is copied from old wallet-core (0.20.0-piecrust.0.6)
fn utx_to_var_bytes(
Expand Down

0 comments on commit e64107f

Please sign in to comment.