Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes related to enabling payload #605

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 4 additions & 26 deletions consensus/core/src/hashing/sighash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,6 @@ pub trait SigHashReusedValues {
fn payload_hash(&self, set: impl Fn() -> Hash) -> Hash;
}

impl<T: SigHashReusedValues> SigHashReusedValues for Arc<T> {
fn previous_outputs_hash(&self, set: impl Fn() -> Hash) -> Hash {
self.as_ref().previous_outputs_hash(set)
}

fn sequences_hash(&self, set: impl Fn() -> Hash) -> Hash {
self.as_ref().sequences_hash(set)
}

fn sig_op_counts_hash(&self, set: impl Fn() -> Hash) -> Hash {
self.as_ref().sig_op_counts_hash(set)
}

fn outputs_hash(&self, set: impl Fn() -> Hash) -> Hash {
self.as_ref().outputs_hash(set)
}

fn payload_hash(&self, set: impl Fn() -> Hash) -> Hash {
self.as_ref().outputs_hash(set)
}
}

impl SigHashReusedValues for SigHashReusedValuesUnsync {
fn previous_outputs_hash(&self, set: impl Fn() -> Hash) -> Hash {
self.previous_outputs_hash.get().unwrap_or_else(|| {
Expand Down Expand Up @@ -204,11 +182,11 @@ pub fn sig_op_counts_hash(tx: &Transaction, hash_type: SigHashType, reused_value
}

pub fn payload_hash(tx: &Transaction, reused_values: &impl SigHashReusedValues) -> Hash {
let hash = || {
if tx.subnetwork_id.is_native() && tx.payload.is_empty() {
return ZERO_HASH;
}
if tx.subnetwork_id.is_native() && tx.payload.is_empty() {
return ZERO_HASH;
}

let hash = || {
let mut hasher = TransactionSigningHash::new();
hasher.write_var_bytes(&tx.payload);
hasher.finalize()
Expand Down
5 changes: 0 additions & 5 deletions simpa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,3 @@ tokio = { workspace = true, features = ["rt", "macros", "rt-multi-thread"] }
[features]
heap = ["dhat", "kaspa-alloc/heap"]
semaphore-trace = ["kaspa-utils/semaphore-trace"]

[profile.heap]
inherits = "release"
debug = true
strip = false