From 8805b20334a6e7625a338b704d5f3d457dd61e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C5=A9=20Ho=C3=A0ng?= <127402781+hadelive@users.noreply.github.com> Date: Tue, 3 Sep 2024 13:03:45 +0700 Subject: [PATCH] fix: update hash script data (#351) --- chain/rust/src/crypto/hash.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chain/rust/src/crypto/hash.rs b/chain/rust/src/crypto/hash.rs index c8fbe5f0..c9f281a5 100644 --- a/chain/rust/src/crypto/hash.rs +++ b/chain/rust/src/crypto/hash.rs @@ -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(); }