File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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.
2323const fn signature_hash_cell_bytes ( ) -> u64 {
24- 32 + 32 + 8
24+ 32 + 32 + 1 + 8
2525}
2626
2727pub 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+ }
You can’t perform that action at this time.
0 commit comments