1616public class DelegatedResourceAccountIndexStore extends
1717 TronStoreWithRevoking <DelegatedResourceAccountIndexCapsule > {
1818
19- private static final byte [] fromPrefix = {0x01 };
20- private static final byte [] toPrefix = {0x02 };
19+ private static final byte [] FROM_PREFIX = {0x01 };
20+ private static final byte [] TO_PREFIX = {0x02 };
2121
2222 @ Autowired
2323 public DelegatedResourceAccountIndexStore (@ Value ("DelegatedResourceAccountIndex" ) String dbName ) {
@@ -61,23 +61,23 @@ public void convert(byte[] address) {
6161 }
6262
6363 public void delegate (byte [] from , byte [] to , long time ) {
64- byte [] fromKey = createKey (fromPrefix , from , to );
64+ byte [] fromKey = createKey (FROM_PREFIX , from , to );
6565 DelegatedResourceAccountIndexCapsule toIndexCapsule =
6666 new DelegatedResourceAccountIndexCapsule (ByteString .copyFrom (to ));
6767 toIndexCapsule .setTimestamp (time );
6868 this .put (fromKey , toIndexCapsule );
6969
70- byte [] toKey = createKey (toPrefix , to , from );
70+ byte [] toKey = createKey (TO_PREFIX , to , from );
7171 DelegatedResourceAccountIndexCapsule fromIndexCapsule =
7272 new DelegatedResourceAccountIndexCapsule (ByteString .copyFrom (from ));
7373 fromIndexCapsule .setTimestamp (time );
7474 this .put (toKey , fromIndexCapsule );
7575 }
7676
7777 public void unDelegate (byte [] from , byte [] to ) {
78- byte [] fromKey = createKey (fromPrefix , from , to );
78+ byte [] fromKey = createKey (FROM_PREFIX , from , to );
7979 this .delete (fromKey );
80- byte [] toKey = createKey (toPrefix , to , from );
80+ byte [] toKey = createKey (TO_PREFIX , to , from );
8181 this .delete (toKey );
8282 }
8383
@@ -89,10 +89,10 @@ public DelegatedResourceAccountIndexCapsule getIndex(byte[] address) {
8989
9090 DelegatedResourceAccountIndexCapsule tmpIndexCapsule =
9191 new DelegatedResourceAccountIndexCapsule (ByteString .copyFrom (address ));
92- byte [] key = new byte [fromPrefix .length + address .length ];
92+ byte [] key = new byte [FROM_PREFIX .length + address .length ];
9393
94- System .arraycopy (fromPrefix , 0 , key , 0 , fromPrefix .length );
95- System .arraycopy (address , 0 , key , fromPrefix .length , address .length );
94+ System .arraycopy (FROM_PREFIX , 0 , key , 0 , FROM_PREFIX .length );
95+ System .arraycopy (address , 0 , key , FROM_PREFIX .length , address .length );
9696 List <DelegatedResourceAccountIndexCapsule > tmpToList =
9797 new ArrayList <>(this .prefixQuery (key ).values ());
9898
@@ -101,8 +101,8 @@ public DelegatedResourceAccountIndexCapsule getIndex(byte[] address) {
101101 .map (DelegatedResourceAccountIndexCapsule ::getAccount ).collect (Collectors .toList ());
102102 tmpIndexCapsule .setAllToAccounts (list );
103103
104- System .arraycopy (toPrefix , 0 , key , 0 , toPrefix .length );
105- System .arraycopy (address , 0 , key , toPrefix .length , address .length );
104+ System .arraycopy (TO_PREFIX , 0 , key , 0 , TO_PREFIX .length );
105+ System .arraycopy (address , 0 , key , TO_PREFIX .length , address .length );
106106 List <DelegatedResourceAccountIndexCapsule > tmpFromList =
107107 new ArrayList <>(this .prefixQuery (key ).values ());
108108 tmpFromList .sort (Comparator .comparing (DelegatedResourceAccountIndexCapsule ::getTimestamp ));
0 commit comments