Skip to content

Commit

Permalink
Remove references to NPCResult (#699)
Browse files Browse the repository at this point in the history
* rename npc_result

* rename osbc to `conditions`
  • Loading branch information
matt-o-how authored Sep 17, 2024
1 parent 76bca31 commit 2aa206c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/chia-consensus/src/spendbundle_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ pub fn validate_clvm_and_signature(
let mut a = make_allocator(LIMIT_HEAP);
let sbc = get_conditions_from_spendbundle(&mut a, spend_bundle, max_cost, height, constants)
.map_err(|e| e.1)?;
let npcresult = OwnedSpendBundleConditions::from(&a, sbc);
let conditions = OwnedSpendBundleConditions::from(&a, sbc);

// Collect all pairs in a single vector to avoid multiple iterations
let mut pairs = Vec::new();

let mut aug_msg = Vec::<u8>::new();
let mut final_msg = Vec::<u8>::new();

for spend in &npcresult.spends {
for spend in &conditions.spends {
let condition_items_pairs = [
(AGG_SIG_PARENT, &spend.agg_sig_parent),
(AGG_SIG_PUZZLE, &spend.agg_sig_puzzle),
Expand All @@ -67,7 +67,7 @@ pub fn validate_clvm_and_signature(
}

// Adding unsafe items
for (pk, msg) in &npcresult.agg_sig_unsafe {
for (pk, msg) in &conditions.agg_sig_unsafe {
let mut aug_msg = pk.to_bytes().to_vec();
aug_msg.extend_from_slice(msg.as_ref());
let aug_hash = hash_to_g2(&aug_msg);
Expand All @@ -85,7 +85,7 @@ pub fn validate_clvm_and_signature(
}

// Collect results
Ok((npcresult, pairs, start_time.elapsed()))
Ok((conditions, pairs, start_time.elapsed()))
}

fn hash_pk_and_msg(pk: &[u8], msg: &[u8]) -> [u8; 32] {
Expand Down

0 comments on commit 2aa206c

Please sign in to comment.