mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-03 05:43:08 +00:00
remove utxo tree
This commit is contained in:
parent
f50ef5be9a
commit
c6a4a00fda
@ -198,7 +198,6 @@ mod tests {
|
||||
let result = account.mark_spent_utxo(utxo_nullifier_map);
|
||||
|
||||
assert!(result.is_ok());
|
||||
assert!(account.utxos.get(&account.address).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -210,7 +209,7 @@ mod tests {
|
||||
let result = account.add_new_utxo_outputs(vec![utxo1.clone(), utxo2.clone()]);
|
||||
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(account.utxos.store.len(), 2);
|
||||
assert_eq!(account.utxos.len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -230,6 +229,6 @@ mod tests {
|
||||
let result = account.add_asset(asset, amount, false);
|
||||
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(account.utxos.store.len(), 1);
|
||||
assert_eq!(account.utxos.len(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ impl NodeChainStore {
|
||||
serde_json::from_slice::<UTXO>(&decoded_data_curr_acc);
|
||||
if let Ok(utxo) = decoded_utxo_try {
|
||||
if &utxo.owner == acc_id {
|
||||
acc.utxos.insert_item(utxo)?;
|
||||
acc.utxos.insert(utxo.hash, utxo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1062,7 +1062,7 @@ impl NodeCore {
|
||||
|
||||
let acc = write_guard.acc_map.get_mut(&acc_addr).unwrap();
|
||||
|
||||
acc.utxos.get_item(new_utxo_hash)?.unwrap().clone()
|
||||
acc.utxos.get(&new_utxo_hash).unwrap().clone()
|
||||
};
|
||||
|
||||
new_utxo.log();
|
||||
@ -1103,8 +1103,7 @@ impl NodeCore {
|
||||
|
||||
let new_utxo = acc
|
||||
.utxos
|
||||
.get_item(new_utxo_hash)
|
||||
.unwrap()
|
||||
.get(&new_utxo_hash)
|
||||
.unwrap()
|
||||
.clone();
|
||||
|
||||
@ -1238,7 +1237,7 @@ impl NodeCore {
|
||||
let acc = write_guard.acc_map.get_mut(&acc_addr_rec).unwrap();
|
||||
acc.log();
|
||||
|
||||
acc.utxos.get_item(new_utxo_hash)?.unwrap().clone()
|
||||
acc.utxos.get(&new_utxo_hash).unwrap().clone()
|
||||
};
|
||||
new_utxo.log();
|
||||
info!(
|
||||
@ -1278,7 +1277,7 @@ impl NodeCore {
|
||||
let acc = write_guard.acc_map.get_mut(&acc_addr_rec).unwrap();
|
||||
acc.log();
|
||||
|
||||
acc.utxos.get_item(new_utxo_hash)?.unwrap().clone()
|
||||
acc.utxos.get(&new_utxo_hash).unwrap().clone()
|
||||
};
|
||||
new_utxo.log();
|
||||
info!(
|
||||
@ -1323,7 +1322,7 @@ impl NodeCore {
|
||||
let acc = write_guard.acc_map.get_mut(&acc_addr_rec).unwrap();
|
||||
acc.log();
|
||||
|
||||
let new_utxo = acc.utxos.get_item(new_utxo_hash)?.unwrap().clone();
|
||||
let new_utxo = acc.utxos.get(&new_utxo_hash).unwrap().clone();
|
||||
|
||||
new_utxo.log();
|
||||
info!(
|
||||
@ -1343,7 +1342,7 @@ impl NodeCore {
|
||||
let acc = write_guard.acc_map.get_mut(&acc_addr).unwrap();
|
||||
acc.log();
|
||||
|
||||
let new_utxo = acc.utxos.get_item(new_utxo_hash)?.unwrap().clone();
|
||||
let new_utxo = acc.utxos.get(&new_utxo_hash).unwrap().clone();
|
||||
|
||||
new_utxo.log();
|
||||
info!(
|
||||
@ -1558,8 +1557,7 @@ impl NodeCore {
|
||||
|
||||
let new_utxo = acc
|
||||
.utxos
|
||||
.get_item(new_utxo_hash)
|
||||
.unwrap()
|
||||
.get(&new_utxo_hash)
|
||||
.unwrap()
|
||||
.clone();
|
||||
new_utxo.log();
|
||||
|
||||
@ -269,10 +269,7 @@ impl JsonHandler {
|
||||
|
||||
let utxo = acc
|
||||
.utxos
|
||||
.get_item(utxo_hash)
|
||||
.map_err(|err| {
|
||||
RpcError::new_internal_error(None, &format!("DB fetch failure {err:?}"))
|
||||
})?
|
||||
.get(&utxo_hash)
|
||||
.ok_or(RpcError::new_internal_error(
|
||||
None,
|
||||
"UTXO does not exist in the tree",
|
||||
@ -513,10 +510,7 @@ impl JsonHandler {
|
||||
.ok_or(RpcError::new_internal_error(None, ACCOUNT_NOT_FOUND))?;
|
||||
|
||||
acc.utxos
|
||||
.get_item(utxo_hash)
|
||||
.map_err(|err| {
|
||||
RpcError::new_internal_error(None, &format!("DB fetch failure {err:?}"))
|
||||
})?
|
||||
.get(&utxo_hash)
|
||||
.ok_or(RpcError::new_internal_error(
|
||||
None,
|
||||
"UTXO does not exist in tree",
|
||||
@ -648,10 +642,7 @@ impl JsonHandler {
|
||||
.ok_or(RpcError::new_internal_error(None, ACCOUNT_NOT_FOUND))?;
|
||||
|
||||
acc.utxos
|
||||
.get_item(utxo_hash)
|
||||
.map_err(|err| {
|
||||
RpcError::new_internal_error(None, &format!("DB fetch failure {err:?}"))
|
||||
})?
|
||||
.get(&utxo_hash)
|
||||
.ok_or(RpcError::new_internal_error(
|
||||
None,
|
||||
"UTXO does not exist in tree",
|
||||
@ -736,10 +727,7 @@ impl JsonHandler {
|
||||
.ok_or(RpcError::new_internal_error(None, ACCOUNT_NOT_FOUND))?;
|
||||
|
||||
acc.utxos
|
||||
.get_item(utxo_hash)
|
||||
.map_err(|err| {
|
||||
RpcError::new_internal_error(None, &format!("DB fetch failure {err:?}"))
|
||||
})?
|
||||
.get(&utxo_hash)
|
||||
.ok_or(RpcError::new_internal_error(
|
||||
None,
|
||||
"UTXO does not exist in tree",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user