Skip to content

Commit 4fbfc16

Browse files
author
Eason
committed
follow review opinion
1 parent d5a0fbe commit 4fbfc16

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

protocol/src/traits/interoperation.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ pub const SIGNATURE_HASH_CELL_OCCUPIED_CAPACITY: u64 = signature_hash_cell_bytes
1717
/// args: 0x
1818
/// hash_type: data
1919
/// data: signature hash(32 bytes)
20-
/// capacity: 0x1ad274800
20+
/// capacity: 1b31d2900
2121
/// ```
22-
/// So the occupied bytes is 32 + 32 + 8 = 72 bytes.
22+
/// So the occupied bytes is 32 + 32 + 1 + 8 = 73 bytes.
2323
const fn signature_hash_cell_bytes() -> u64 {
24-
32 + 32 + 8
24+
32 + 32 + 1 + 8
2525
}
2626

2727
pub trait Interoperation: Sync + Send {
@@ -111,3 +111,20 @@ pub trait Interoperation: Sync + Send {
111111
.build()
112112
}
113113
}
114+
115+
#[cfg(test)]
116+
mod tests {
117+
use super::*;
118+
use ckb_types::core::Capacity;
119+
120+
#[test]
121+
fn test_const_signature_hash_cell_bytes() {
122+
let data_capacity = Capacity::bytes(32).unwrap();
123+
let actual = packed::CellOutputBuilder::default()
124+
.build()
125+
.occupied_capacity(data_capacity)
126+
.unwrap()
127+
.as_u64();
128+
assert_eq!(SIGNATURE_HASH_CELL_OCCUPIED_CAPACITY, actual);
129+
}
130+
}

0 commit comments

Comments
 (0)