Skip to content

Commit

Permalink
Minor fix-up to allow go-live:
Browse files Browse the repository at this point in the history
Re-add (for now) Ed25519 HSQLDB conversion.
Catch DataException in BlockChain.isGenesisBlockValid and return false.
Remove duplicate bug-fix for LeaveGroupTransactions DB table.

Interim, near-final blockchain.json
  • Loading branch information
catbref committed Jun 26, 2020
1 parent 2c14a12 commit 3c139f3
Show file tree
Hide file tree
Showing 4 changed files with 424 additions and 264 deletions.
4 changes: 3 additions & 1 deletion src/main/java/org/qortal/block/BlockChain.java
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ public static void validate() throws DataException {
}
}

private static boolean isGenesisBlockValid() throws DataException {
private static boolean isGenesisBlockValid() {
try (final Repository repository = RepositoryManager.getRepository()) {
BlockRepository blockRepository = repository.getBlockRepository();

Expand All @@ -523,6 +523,8 @@ private static boolean isGenesisBlockValid() throws DataException {
return false;

return GenesisBlock.isGenesisBlock(blockData);
} catch (DataException e) {
return false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,11 +618,6 @@ private static boolean databaseUpdating(Connection connection) throws SQLExcepti
stmt.execute("CREATE TABLE PublicizeTransactions (signature Signature, nonce INT NOT NULL, " + TRANSACTION_KEYS + ")");
break;

case 20:
// XXX Bug-fix, but remove when we build new genesis
stmt.execute("ALTER TABLE LeaveGroupTransactions ADD COLUMN IF NOT EXISTS previous_group_id GroupID");
break;

default:
// nothing to do
return false;
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/org/qortal/repository/hsqldb/HSQLDBRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.qortal.account.PrivateKeyAccount;
import org.qortal.crypto.Crypto;
import org.qortal.repository.ATRepository;
import org.qortal.repository.AccountRepository;
import org.qortal.repository.ArbitraryRepository;
Expand Down Expand Up @@ -744,4 +746,18 @@ private void assertEmptyTransaction(String context) throws DataException {
}
}

public static byte[] ed25519PrivateToPublicKey(byte[] privateKey) {
if (privateKey == null)
return null;

return PrivateKeyAccount.toPublicKey(privateKey);
}

public static String ed25519PublicKeyToAddress(byte[] publicKey) {
if (publicKey == null)
return null;

return Crypto.toAddress(publicKey);
}

}
Loading

0 comments on commit 3c139f3

Please sign in to comment.