File tree Expand file tree Collapse file tree 4 files changed +7
-6
lines changed
chainbase/src/main/java/org/tron/common/utils
crypto/src/main/java/org/tron/common/crypto
framework/src/main/java/org/tron/core/metrics/node Expand file tree Collapse file tree 4 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ public LocalWitnesses(List<String> privateKeys) {
4646 }
4747
4848 public byte [] getWitnessAccountAddress (boolean isECKeyCryptoEngine ) {
49- if (witnessAccountAddress == null && !this . privateKeys . isEmpty ()) {
49+ if (witnessAccountAddress == null && !CollectionUtils . isEmpty (privateKeys )) {
5050 byte [] privateKey = ByteArray .fromHexString (getPrivateKey ());
5151 final SignInterface cryptoEngine = SignUtils .fromPrivate (privateKey , isECKeyCryptoEngine );
5252 this .witnessAccountAddress = cryptoEngine .getAddress ();
@@ -59,7 +59,7 @@ public void setWitnessAccountAddress(final byte[] localWitnessAccountAddress) {
5959 }
6060
6161 public void initWitnessAccountAddress (boolean isECKeyCryptoEngine ) {
62- if (witnessAccountAddress == null && !this . privateKeys . isEmpty ()) {
62+ if (witnessAccountAddress == null && !CollectionUtils . isEmpty (privateKeys )) {
6363 byte [] privateKey = ByteArray .fromHexString (getPrivateKey ());
6464 final SignInterface ecKey = SignUtils .fromPrivate (privateKey ,
6565 isECKeyCryptoEngine );
Original file line number Diff line number Diff line change @@ -285,7 +285,7 @@ public static ECKey fromPrivate(BigInteger privKey) {
285285 * @return -
286286 */
287287 public static ECKey fromPrivate (byte [] privKeyBytes ) {
288- if (Objects . isNull (privKeyBytes ) || privKeyBytes . length == 0 ) {
288+ if (ByteUtil . isNullOrZeroArray (privKeyBytes )) {
289289 return null ;
290290 }
291291 return fromPrivate (new BigInteger (1 , privKeyBytes ));
Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ public static SM2 fromPrivate(BigInteger privKey) {
247247 * @return -
248248 */
249249 public static SM2 fromPrivate (byte [] privKeyBytes ) {
250- if (Objects . isNull (privKeyBytes ) || privKeyBytes . length == 0 ) {
250+ if (ByteUtil . isNullOrZeroArray (privKeyBytes )) {
251251 return null ;
252252 }
253253 return fromPrivate (new BigInteger (1 , privKeyBytes ));
Original file line number Diff line number Diff line change 55import org .springframework .stereotype .Component ;
66import org .tron .common .backup .BackupManager ;
77import org .tron .common .parameter .CommonParameter ;
8+ import org .tron .common .utils .ByteUtil ;
89import org .tron .core .ChainBaseManager ;
910import org .tron .core .config .args .Args ;
1011import org .tron .program .Version ;
@@ -38,8 +39,8 @@ private void setNodeInfo(NodeInfo nodeInfo) {
3839
3940 byte [] witnessAccountAddress = Args .getLocalWitnesses ()
4041 .getWitnessAccountAddress (CommonParameter .getInstance ().isECKeyCryptoEngine ());
41- ByteString witnessAddress =
42- witnessAccountAddress != null ? ByteString .copyFrom (witnessAccountAddress ) : null ;
42+ ByteString witnessAddress = ! ByteUtil . isNullOrZeroArray ( witnessAccountAddress ) ? ByteString
43+ .copyFrom (witnessAccountAddress ) : null ;
4344 if (chainBaseManager .getWitnessScheduleStore ().getActiveWitnesses ().contains (witnessAddress )) {
4445 nodeInfo .setNodeType (1 );
4546 } else {
You can’t perform that action at this time.
0 commit comments