@@ -39,10 +39,6 @@ public MigrateTurkishKeyHelper(ChainBaseManager chainBaseManager) {
3939 /**
4040 * Scan AccountIdIndexStore for keys containing Turkish dotless-ı (U+0131),
4141 * replace them with ROOT-equivalent keys (ı → i), and delete the old keys.
42- *
43- * <p>Uses raw {@link IRevokingDB} access to bypass the fallback lookup
44- * logic in {@link AccountIdIndexStore#has(byte[])} — we need exact-match
45- * checks to determine whether the ROOT key already exists in the DB.
4642 */
4743 public void doWork () {
4844 long start = System .currentTimeMillis ();
@@ -51,7 +47,6 @@ public void doWork() {
5147 final IRevokingDB revokingDB = chainBaseManager .getAccountIdIndexStore ()
5248 .getRevokingDB ();
5349 long totalKeys = 0 ;
54- List <byte []> keysToDelete = new ArrayList <>();
5550 List <Map .Entry <byte [], byte []>> entriesToMigrate = new ArrayList <>();
5651
5752 // Phase 1: scan for keys containing 'ı' (U+0131)
@@ -63,25 +58,20 @@ public void doWork() {
6358 }
6459 }
6560
66- // Phase 2: migrate each Turkish key to its ROOT equivalent
61+ // Phase 2: for each Turkish key, write the ROOT-equivalent (if absent)
62+ // and delete the legacy key.
6763 for (Map .Entry <byte [], byte []> entry : entriesToMigrate ) {
6864 String keyStr = new String (entry .getKey (), StandardCharsets .UTF_8 );
6965 byte [] rootKey = keyStr .replace (DOTLESS_I , 'i' )
7066 .getBytes (StandardCharsets .UTF_8 );
7167 // Only write if ROOT key doesn't already exist
72- byte [] existing = revokingDB .getUnchecked (rootKey );
73- if (ArrayUtils .isEmpty (existing )) {
68+ if (ArrayUtils .isEmpty (revokingDB .getUnchecked (rootKey ))) {
7469 revokingDB .put (rootKey , entry .getValue ());
7570 }
76- keysToDelete . add (entry .getKey ());
71+ revokingDB . delete (entry .getKey ());
7772 }
7873
79- // Phase 3: delete old Turkish keys
80- for (byte [] key : keysToDelete ) {
81- revokingDB .delete (key );
82- }
83-
84- // Phase 4: mark migration as done
74+ // Phase 3: mark migration as done
8575 chainBaseManager .getDynamicPropertiesStore ().saveTurkishKeyMigrationDone (1 );
8676
8777 logger .info (
0 commit comments