Qortal Core - Main Code Repository Decentralized Data Network - Blockchain - TRUE Cross-Chain Trading - Application and Website Hosting - Much More - Qortal is the future internet infrastructure for the global digital world.
Go to file
catbref 63b262a76e NTP and performance changes + fixes.
New NTP class now runs as a simplistic NTP client, repeatedly polling
several NTP servers and maintaining a more accurate time independent
of operating system.

Several occurrences of System.currentTimeMillis() replaced with NTP.getTime()
particularly where block/transaction/networking is involved.

GET /admin/info now includes "currentTimestamp" as reported from NTP.

Added support for block timestamps determined by generator, instead of
supplied by clock. (BlockChain.newBlockTimestampHeight - not yet activated).
Incorrect timestamps will produce a TIMESTAMP_INCORRECT Block.ValidationResult.

Block.calcMinimumTimestamp repurposed as Block.calcTimestamp for above.

Block timestamps are now allowed to be max 2000ms in the future,
was previously max 500ms.

Block generation prohibited until initial NTP sync.

Instead of deleting INVALID unconfirmed transactions in BlockGenerator,
Controller now deletes EXPIRED unconfirmed transactions every so often.
This also fixes persistent expired unconfirmed transactions on nodes
that do not generate blocks, as BlockGenerator.deleteInvalidTransactions()
was never reached.

Abbreviated block sigs added to log entries declaring a new block is generated
in BlockGenerator.

Controller checks for NTP sync much faster during start-up and SysTray's
tooltip text starts as "Synchronizing clock" until NTP sync occurs.
After NTP sync, Controller logs NTP offset every so often (currently every 5 mins).

When considering synchronizing, Controller skips peers that have the same block sig
as last time when synchronization resulted in no action, e.g. INFERIOR_CHAIN,
NOTHING_TO_DO and also OK. OK is included as another sync attempt would result in
NOTHING_TO_DO.
Previously this skipping check only happened after prior INFERIOR_CHAIN.

During inbound peer handshaking, if we receive a peer ID that matches an existing inbound
peer then send peer ID of all zeros, then close connection.
Remote end should detect this and cleanly close connection instead of waiting for handshake timeout.
Randomly generated peer IDs have lowest bit set to avoid all zeros.
Might need further work.

Networking doesn't connect, or accept, until NTP has synced.

Transaction validation can fail with CLOCK_NOT_SYNCED if NTP not synced.
2019-08-13 09:47:44 +01:00
lib/org/ciyam/at Bump HSQLDB from svn r5970 to release v2.5.0 2019-08-02 13:05:18 +01:00
src NTP and performance changes + fixes. 2019-08-13 09:47:44 +01:00
.gitignore Added settings.json to gitignore 2019-08-02 14:07:12 +01:00
log4j2.properties new log4j2.properties 2019-07-18 18:31:58 +01:00
pom.xml Improved detection of inaccurate system clock & nagging. 2019-08-13 09:14:07 +01:00
README.md Unit test fixes + initial CIYAM AT integration 2018-10-04 14:38:59 +01:00

Qora2

To use:

  • Use maven to fetch dependencies.
  • Build project.
  • Build v1feeder.jar as a fatjar using src/v1feeder.java as the main class
  • Fire up an old-gen Qora node.
  • Use v1feeder.jar to migrate old Qora blocks to DB:

java -jar v1feeder.jar qora-v1-node-ip

You should now be able to run all the JUnit tests.

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 where Maven downloaded hsqldb, typically ${HOME}/.m2/repository/org/hsqldb/hsqldb/2.4.0/hsqldb-2.4.0.jar, but for now lib/org/hsqldb/hsqldb/r5836/hsqldb-r5836.jar

${SQLTOOL_JAR} contains pathname to where Maven downloaded sqltool, typically ${HOME}/.m2/repository/org/hsqldb/sqltool/2.4.1/sqltool-2.4.1.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/qora
username SA
password

urlid qora-test
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:

export HSQLDB_JAR=${HOME}/.m2/repository/org/hsqldb/hsqldb/2.4.0/hsqldb-2.4.0.jar
export SQLTOOL_JAR=${HOME}/.m2/repository/org/hsqldb/sqltool/2.4.1/sqltool-2.4.1.jar
alias sqltool='rlwrap java -cp ${HSQLDB_JAR}:${SQLTOOL_JAR} org.hsqldb.cmdline.SqlTool --rcFile=${SQLTOOL_RC}'

So you can simply type: sqltool qora-test

Don't forget to use SHUTDOWN; before exiting sqltool so that database files are closed cleanly.