Skip to content

Commit

Permalink
log(wallet_state): More info in case of error on new block
Browse files Browse the repository at this point in the history
Cf. #272.
  • Loading branch information
Sword-Smith committed Nov 28, 2024
1 parent 388b2fe commit 55c4028
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/models/state/wallet/wallet_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,16 +813,16 @@ impl WalletState {
.get_membership_proof_for_block(new_block.kernel.header.prev_block_digest)
{
Some(ms_mp) => {
debug!("Found valid mp for UTXO");
let replacement_success = valid_membership_proofs_and_own_utxo_count
.insert(
StrongUtxoKey::new(utxo_digest, ms_mp.aocl_leaf_index),
(ms_mp, i),
let aocl_leaf_index = ms_mp.aocl_leaf_index;
debug!("Found valid mp for UTXO with leaf index: {aocl_leaf_index}");
let replaced = valid_membership_proofs_and_own_utxo_count
.insert(StrongUtxoKey::new(utxo_digest, aocl_leaf_index), (ms_mp, i));

if let Some(replaced) = replaced {
panic!(
"Strong key must be unique in wallet DB. utxo_digest: {utxo_digest}; ms_mp.aocl_leaf_index: {}.\n\n Existing value was: {replaced:?}", aocl_leaf_index
);
assert!(
replacement_success.is_none(),
"Strong key must be unique in wallet DB"
);
}
}
None => {
// Was MUTXO marked as abandoned? Then this is fine. Otherwise, log a warning.
Expand Down

0 comments on commit 55c4028

Please sign in to comment.