Skip to content

Commit

Permalink
fix: update hash script data
Browse files Browse the repository at this point in the history
  • Loading branch information
hadelive committed Aug 29, 2024
1 parent 25ff92b commit cedb4e1
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit cedb4e1

Please sign in to comment.