Some payments don't always initialize the recipient's last reference, depending on whether the asset is QORA or not and what type of transaction is being processed. Calls to Payment.process/orphan now take boolean to indicate whether recipient's last reference should always be initialized regardless of asset. ("initialized" here means setting an initial last reference for an account if the current value is null/empty/missing) When matching orders to produce trades, it isn't enough to only sort orders with best price first. Orders with the same price also need to be further sorted by earliest order first. (This was implicitly done in Qora v1). Added additional ORDER BY sub-clause to achieve this and improved the corresponding table index too. Converted a lot of logging from simplistic System.out/err.println to Apache log4j2. Added several "trace"-level logging statements to aid debugging which can be activated given appropriate configuration in log4j2.properties. With voting, detection of previous votes was broken during orphan as previousOptionIndex was set to 0 instead of null when fetching a VoteOnPollTransaction from the HSQLDB repository. This was due to lack of null-checking - now fixed. Corresponding changes made in IssueAsset and Message transaction HSQLDB repository classes. v1feeder now syncs up to block 99055. Block 99056 contains DeployAT. Orphaning back to block 1 and then resync works without issue too.
Qora2
To use:
- Use maven to fetch dependencies.
- Build project.
- Fire up an old-gen Qora node.
- Run
src/migrate.java
as a Java application 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.
You can also examine the migrated database using HSQLDB's "sqltool".
It's a good idea to install "rlwrap" (ReadLine wrapper) too as sqltool doesn't support command history/editing!
Typical command line for sqltool would be:
rlwrap java -cp ${HSQLDB_JAR}:${SQLTOOL_JAR} org.hsqldb.cmdline.SqlTool --rcFile=${SQLTOOL_RC} qora
${HSQLDB_JAR}
contains pathname to hsqldb-2.4.0.jar
,
typically ${HOME}/.m2/repository/org/hsqldb/hsqldb/2.4.0/hsqldb-2.4.0.jar
${SQLTOOL_JAR}
contains pathname to where you
downloaded sqltool-2.2.6.jar
${SQLTOOL_RC}
contains pathname to a text file describing Qora2 database,
e.g. ${HOME}/.sqltool.rc
, with contents like:
urlid qora
url jdbc:hsqldb:file:db/test
username SA
password
You could change the line url jdbc:hsqldb:file:db/test
to use a full pathname for easier use.
Another idea is to assign a shell alias in your .bashrc
like:
alias sqltool='rlwrap java -cp ${HSQLDB_JAR}:${SQLTOOL_JAR} org.hsqldb.cmdline.SqlTool --rcFile=${SQLTOOL_RC}'
So you can simply type: sqltool qora
Don't forget to use SHUTDOWN;
before exiting sqltool so that database files are closed cleanly.