DB.rebuild() to shutdown and delete database, then rebuild it (schema only).
DB.callIdentity() to fetch value of IDENTITY column after an INSERT.
Added basic Asset class.
Added TODOs to Account.
BULK REFACTOR to rename "generation target" back to "generating balance" and
"generation signature" back to "generator signature" to ease compatibility with
old QORA for now. (Maybe change again in the future if we change from PoS).
Added support for Block's totalFees which is either loaded from DB
or recalculated as transactions are added to the block.
Also in Block:
* We can't assume generator's public key is the correct length
in case we encounter the GenesisAccount's special 8-byte public key. Fix applied to
Block's ResultSet-based constructor.
* Forgot to save "signature" column!
* Initial version of Block.process()
* Block constructor takes transactionsSignature too now
Added BlockChain startup/init/validation method to determine whether to (re)build blockchain.
Rebuilding blockchain involves rebuilding DB schema, processing GenesisBlock and adding QORA asset.
Added some initial GenesisTranaction.process() code: GenesisTransactions are saved but recipient's balance/reference not yet updated.
Fix incorrect placeholder bind value for "creation" timestamp in Transaction.save().
Moved incremental database schema updates out from "updates" unit test into DatabaseUpdates class.
All unit tests work at this point!
Add Transaction.parse() support. Subclasses are called, switched by transaction type,
using ByteBuffer.
Correct RECIPIENT_LENGTH in Transaction.
Common [de]serialization tasks moved to methods in Serialization class.
Too many calls needing Connection object in args when they're only
simple database reads. Even worse, some methods had database-less
counterparts with different outputs, e.g. toJSON().
Now Connections can be requested from the pool for general database
read scenarios. Code paths that might perform a multi-statement
database transaction still require a Connection arg passed around
as the database transaction are local to that Connection.
In light of above, added support for database opening, closing,
setting URL.
Fixed out of bounds array index bug in unknown-length version of DB.getResultSetBytes().
Fixed Block's lazy-instantiation of Transactions.
Implemented Block's isSignatureValid().
Fixed bug in Crypto.isValidAddress() which was using the wrong bytes.
Fix GenesisTransaction generic constructor calling super with PaymentTransaction type!
Fix GenesisTransaction signature constructor using wrong column indexes from ResultSet.
In Transaction, don't expect CREATOR_LENGTH bytes from database in case we're dealing
with a GenesisTransaction where the creator's public key is only 8 bytes long.
Improvements to unit tests, including changing migrate so it can be run repeatedly to do
incremental migrations.
PaymentTransaction now uses Account for recipient internally but maybe should extend that type change to constructor args.
GenesisBlock added also with signature test.
More javadocs.
Added brokenmd160.java as command-line support for producing broken MD160 digests.
Transactions, and sub-classes, now use/store public key instead of Qora address.
(Qora address can be derived from public key and they take up about the same space in DB).
Loads more JavaDoc for lovely mouseover help in Eclipse IDE.
Crypto.verify() and Crypto.sign() moved into PublicKeyAccount and PrivateKeyAccount
as appropriate.
Fleshed out Block, added BlockTransactions support.
Added TODO comments as Eclipse helpfully lists these for later implementation.
Made loading-from-DB-constructors protected/private and also throw NoDataFoundException
if unable to load from DB. Public methods can call respective constructors, catch the above
exception and return null if they like. Load-from-DB-constructors are to allow sub-classes
to load some data from sub-tables and super-class to load from another table.
(See PaymentTransaction/Transaction for example). Using public methods allows similar argument
lists but with different names,
e.g. DBObject.fromSignature(Connection, byte[]) and DBObject.fromReference(Connection, byte[])
Saving into DB maybe still a bit untidy. Looking for a way to close-couple column names with
place-holder bind Objects.
Less of:
connection.prepareStatement("INSERT INTO table (column) VALUES (?)")
DB.bindInsertPlaceholders(PreparedStatement, Object...);
More like:
DB.insertUpdate(String tableName, SomeMagicCloseCoupledPairs...)
called like:
DB.insertUpdate("Cats", {"name", "Tiddles"}, {"age", 3});
Most SQL tables defined but only payment transactions actually implemented.
Maven support added.
Some code imported from 'old' Qora:
RIPEMD160 renamed as BrokenMD160 and deprecated.
whispersystem's Ed25519 implementation (to be replaced with bouncycastle).
Basic Account/PublicKeyAccount/PrivateKeyAccount code.
Some utils like Base58 and Pair.
To use:
Use maven to fetch dependencies.
Build project.
Fire up an old-gen Qora node.
Run src/test/update.java as a JUnit test to build DB structure.
Run src/test/migrate.java as a JUnit test to migrate old Qora blocks to DB.
You should now be able to run src/test/load.java and src/test/save.java
as JUnit tests demonstrating loading/saving Transactions from/to database.
This commit done while halfway through adding Block support!