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

fix: update hash script data #351

Merged
Merged
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
7 changes: 5 additions & 2 deletions chain/rust/src/crypto/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ pub fn hash_script_data(
let mut buf = cbor_event::se::Serializer::new_vec();
match datums {
Some(datums) if redeemers.is_empty() => {
/*
/* (Deprecated)
; Finally, note that in the case that a transaction includes datums but does not
; include any redeemers, the script data format becomes (in hex):
; [ 80 | datums | A0 ]
; corresponding to a CBOR empty list and an empty map (our apologies).
*/
buf.write_raw_bytes(&[0x80]).unwrap();
/* Post Babbage:
; [ A0 | datums | A0 ]
*/
buf.write_raw_bytes(&[0xA0]).unwrap();
datums.serialize(&mut buf, false).unwrap();
buf.write_raw_bytes(&[0xA0]).unwrap();
}
Expand Down
Loading