|
@@ -86,9 +86,15 @@ public class WalletUtil {
|
|
@SneakyThrows
|
|
@SneakyThrows
|
|
public static AirdropWallet getWalletByKeystore(String keystore, String userId, String groupName, String password) {
|
|
public static AirdropWallet getWalletByKeystore(String keystore, String userId, String groupName, String password) {
|
|
Credentials credentials = WalletUtils.loadCredentials(password, WALLET_FILE_PATH + userId + File.separator + getEncryptPwd(groupName) + File.separator + keystore);
|
|
Credentials credentials = WalletUtils.loadCredentials(password, WALLET_FILE_PATH + userId + File.separator + getEncryptPwd(groupName) + File.separator + keystore);
|
|
- String privateKey = credentials.getEcKeyPair().getPrivateKey().toString(16);
|
|
|
|
|
|
+ StringBuilder privateKey = new StringBuilder(credentials.getEcKeyPair().getPrivateKey().toString(16));
|
|
AirdropWallet wallet = new AirdropWallet();
|
|
AirdropWallet wallet = new AirdropWallet();
|
|
- wallet.setPrivateKey(privateKey);
|
|
|
|
|
|
+ if (privateKey.length() < 64) {
|
|
|
|
+ int priLenth = 64 - privateKey.length();
|
|
|
|
+ for (int i = 0; i < priLenth; i++) {
|
|
|
|
+ privateKey.insert(0, "0");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ wallet.setPrivateKey(privateKey.toString());
|
|
wallet.setAddress(credentials.getAddress());
|
|
wallet.setAddress(credentials.getAddress());
|
|
return wallet;
|
|
return wallet;
|
|
}
|
|
}
|