@@ -27,7 +27,6 @@ pub enum MaskImpl {
2727 Attached {
2828 parent : Mask ,
2929 owning_account : HashMap < AccountIndex , Account > ,
30- token_owners : HashMap < TokenId , AccountId > ,
3130 id_to_addr : HashMap < AccountId , Address > ,
3231 last_location : Option < Address > ,
3332 depth : u8 ,
@@ -39,7 +38,6 @@ pub enum MaskImpl {
3938 depth : u8 ,
4039 childs : HashMap < Uuid , Mask > ,
4140 owning_account : HashMap < AccountIndex , Account > ,
42- token_owners : HashMap < TokenId , AccountId > ,
4341 id_to_addr : HashMap < AccountId , Address > ,
4442 last_location : Option < Address > ,
4543 hashes : HashesMatrix ,
@@ -68,7 +66,6 @@ impl Clone for MaskImpl {
6866 Self :: Attached {
6967 parent,
7068 owning_account,
71- token_owners,
7269 id_to_addr,
7370 last_location,
7471 depth,
@@ -78,7 +75,6 @@ impl Clone for MaskImpl {
7875 } => Self :: Attached {
7976 parent : parent. clone ( ) ,
8077 owning_account : owning_account. clone ( ) ,
81- token_owners : token_owners. clone ( ) ,
8278 id_to_addr : id_to_addr. clone ( ) ,
8379 last_location : last_location. clone ( ) ,
8480 depth : * depth,
@@ -90,7 +86,6 @@ impl Clone for MaskImpl {
9086 depth,
9187 childs,
9288 owning_account,
93- token_owners,
9489 id_to_addr,
9590 last_location,
9691 hashes,
@@ -99,7 +94,6 @@ impl Clone for MaskImpl {
9994 depth : * depth,
10095 childs : childs. clone ( ) ,
10196 owning_account : owning_account. clone ( ) ,
102- token_owners : token_owners. clone ( ) ,
10397 id_to_addr : id_to_addr. clone ( ) ,
10498 last_location : last_location. clone ( ) ,
10599 hashes : hashes. clone ( ) ,
@@ -121,7 +115,6 @@ impl std::fmt::Debug for MaskImpl {
121115 Self :: Attached {
122116 parent,
123117 owning_account,
124- token_owners,
125118 id_to_addr,
126119 last_location,
127120 depth,
@@ -133,7 +126,6 @@ impl std::fmt::Debug for MaskImpl {
133126 . field ( "uuid" , uuid)
134127 . field ( "parent" , & parent. get_uuid ( ) )
135128 . field ( "owning_account" , & owning_account. len ( ) )
136- . field ( "token_owners" , & token_owners. len ( ) )
137129 . field ( "id_to_addr" , & id_to_addr. len ( ) )
138130 . field ( "last_location" , last_location)
139131 . field ( "depth" , depth)
@@ -145,7 +137,6 @@ impl std::fmt::Debug for MaskImpl {
145137 depth,
146138 childs,
147139 owning_account,
148- token_owners,
149140 id_to_addr,
150141 last_location,
151142 hashes,
@@ -155,7 +146,6 @@ impl std::fmt::Debug for MaskImpl {
155146 . field ( "depth" , depth)
156147 . field ( "childs" , & childs. len ( ) )
157148 . field ( "owning_account" , & owning_account. len ( ) )
158- . field ( "token_owners" , & token_owners. len ( ) )
159149 . field ( "id_to_addr" , & id_to_addr. len ( ) )
160150 . field ( "last_location" , last_location)
161151 . field ( "uuid" , uuid)
@@ -298,7 +288,6 @@ impl MaskImpl {
298288 childs,
299289 uuid,
300290 owning_account,
301- token_owners,
302291 id_to_addr,
303292 last_location,
304293 hashes,
@@ -308,7 +297,6 @@ impl MaskImpl {
308297 * self = Attached {
309298 parent,
310299 owning_account : take ( owning_account) ,
311- token_owners : take ( token_owners) ,
312300 id_to_addr : take ( id_to_addr) ,
313301 last_location : take ( last_location) ,
314302 depth : * depth,
@@ -378,15 +366,13 @@ impl MaskImpl {
378366 Attached {
379367 parent,
380368 owning_account,
381- token_owners,
382369 id_to_addr,
383370 hashes,
384371 ..
385372 } => {
386373 assert_ne ! ( parent. get_uuid( ) , self_uuid) ;
387374
388375 let ( accounts, hashes) = {
389- token_owners. clear ( ) ;
390376 id_to_addr. clear ( ) ;
391377 ( std:: mem:: take ( owning_account) , hashes. take ( ) )
392378 } ;
@@ -485,7 +471,6 @@ impl MaskImpl {
485471 let Self :: Attached {
486472 parent,
487473 owning_account,
488- token_owners,
489474 id_to_addr,
490475 last_location,
491476 depth,
@@ -502,15 +487,13 @@ impl MaskImpl {
502487 let owning_account = std:: mem:: take ( owning_account) ;
503488 let depth = std:: mem:: take ( depth) ;
504489 let childs = std:: mem:: take ( childs) ;
505- let token_owners = std:: mem:: take ( token_owners) ;
506490 let id_to_addr = std:: mem:: take ( id_to_addr) ;
507491 let last_location = std:: mem:: take ( last_location) ;
508492 let hashes = std:: mem:: replace ( hashes, HashesMatrix :: new ( depth as usize ) ) ;
509493 let uuid = std:: mem:: replace ( uuid, "temporary" . to_string ( ) ) ;
510494
511495 * self = Self :: Unattached {
512496 owning_account,
513- token_owners,
514497 id_to_addr,
515498 last_location,
516499 depth,
@@ -790,15 +773,13 @@ impl MaskImpl {
790773 Root { .. } => todo ! ( ) ,
791774 Unattached {
792775 owning_account,
793- token_owners,
794776 id_to_addr,
795777 last_location,
796778 hashes,
797779 ..
798780 }
799781 | Attached {
800782 owning_account,
801- token_owners,
802783 id_to_addr,
803784 last_location,
804785 hashes,
@@ -814,10 +795,7 @@ impl MaskImpl {
814795 let account_index = addr. to_index ( ) ;
815796 hashes. invalidate_hashes ( account_index) ;
816797
817- let account = owning_account. remove ( & account_index) . unwrap ( ) ;
818- token_owners
819- . remove ( & account. id ( ) . derive_token_id ( ) )
820- . unwrap ( ) ;
798+ let _account = owning_account. remove ( & account_index) . unwrap ( ) ;
821799
822800 if last_location
823801 . as_ref ( )
@@ -854,14 +832,12 @@ impl MaskImpl {
854832 Root { database, .. } => database. set ( addr, account) ,
855833 Unattached {
856834 owning_account,
857- token_owners,
858835 id_to_addr,
859836 last_location,
860837 ..
861838 }
862839 | Attached {
863840 owning_account,
864- token_owners,
865841 id_to_addr,
866842 last_location,
867843 ..
@@ -870,7 +846,6 @@ impl MaskImpl {
870846
871847 owning_account. insert ( account_index, * account) ;
872848 id_to_addr. insert ( account_id. clone ( ) , addr. clone ( ) ) ;
873- token_owners. insert ( account_id. derive_token_id ( ) , account_id) ;
874849
875850 if last_location
876851 . as_ref ( )
@@ -1112,32 +1087,6 @@ impl BaseLedger for MaskImpl {
11121087 set
11131088 }
11141089
1115- fn token_owner ( & self , token_id : TokenId ) -> Option < AccountId > {
1116- let ( parent, token_owners) = match self {
1117- Root { database, .. } => return database. token_owner ( token_id) ,
1118- Attached {
1119- parent,
1120- token_owners,
1121- ..
1122- } => ( Some ( parent) , token_owners) ,
1123- Unattached { token_owners, .. } => ( None , token_owners) ,
1124- } ;
1125-
1126- if let Some ( account_id) = token_owners. get ( & token_id) . cloned ( ) {
1127- return Some ( account_id) ;
1128- } ;
1129-
1130- parent. as_ref ( ) ?. token_owner ( token_id)
1131- }
1132-
1133- fn token_owners ( & self ) -> HashSet < AccountId > {
1134- // TODO: Not sure if it's the correct impl
1135- self . to_list ( )
1136- . into_iter ( )
1137- . map ( |account| account. id ( ) )
1138- . collect ( )
1139- }
1140-
11411090 fn tokens ( & self , public_key : CompressedPubKey ) -> HashSet < TokenId > {
11421091 let mut set = HashSet :: with_capacity ( 1024 ) ;
11431092
@@ -1194,15 +1143,13 @@ impl BaseLedger for MaskImpl {
11941143 Root { database, .. } => database. get_or_create_account ( account_id, account) ?,
11951144 Unattached {
11961145 owning_account,
1197- token_owners,
11981146 id_to_addr,
11991147 last_location,
12001148 depth,
12011149 ..
12021150 }
12031151 | Attached {
12041152 owning_account,
1205- token_owners,
12061153 id_to_addr,
12071154 last_location,
12081155 depth,
@@ -1217,7 +1164,6 @@ impl BaseLedger for MaskImpl {
12171164
12181165 id_to_addr. insert ( account_id. clone ( ) , location. clone ( ) ) ;
12191166 * last_location = Some ( location. clone ( ) ) ;
1220- token_owners. insert ( account_id. derive_token_id ( ) , account_id) ;
12211167 owning_account. insert ( account_index, account) ;
12221168
12231169 self . invalidate_hashes ( account_index) ;
0 commit comments