mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
runtime::{smt, merkle}: add missing call_idx to db_roots data
This commit is contained in:
@@ -271,12 +271,9 @@ pub(crate) fn merkle_add(mut ctx: FunctionEnvMut<Env>, ptr: WasmPtr<u8>, len: u3
|
||||
let latest_root_data = serialize(latest_root);
|
||||
assert_eq!(latest_root_data.len(), 32);
|
||||
|
||||
// This is hardcoded but should not be
|
||||
let call_idx: u16 = 0;
|
||||
|
||||
let mut value_data = Vec::with_capacity(32 + 2);
|
||||
env.tx_hash.inner().encode(&mut value_data).expect("Unable to serialize tx_hash");
|
||||
call_idx.encode(&mut value_data).expect("Unable to serialize call_idx");
|
||||
(env.call_idx as u16).encode(&mut value_data).expect("Unable to serialize call_idx");
|
||||
assert_eq!(value_data.len(), 32 + 2);
|
||||
|
||||
if overlay.insert(&db_roots.tree, &latest_root_data, &value_data).is_err() {
|
||||
|
||||
@@ -245,12 +245,9 @@ pub(crate) fn sparse_merkle_insert_batch(
|
||||
let latest_root_data = serialize(&latest_root);
|
||||
assert_eq!(latest_root_data.len(), 32);
|
||||
|
||||
// This is hardcoded but should not be
|
||||
let call_idx: u16 = 0;
|
||||
|
||||
let mut value_data = Vec::with_capacity(32 + 2);
|
||||
env.tx_hash.inner().encode(&mut value_data).expect("Unable to serialize tx_hash");
|
||||
call_idx.encode(&mut value_data).expect("Unable to serialize call_idx");
|
||||
(env.call_idx as u16).encode(&mut value_data).expect("Unable to serialize call_idx");
|
||||
assert_eq!(value_data.len(), 32 + 2);
|
||||
|
||||
if overlay.insert(&db_roots.tree, &latest_root_data, &value_data).is_err() {
|
||||
|
||||
Reference in New Issue
Block a user