Commit Graph

507 Commits

Author SHA1 Message Date
catbref
f7e2ee383e More complete testing of block reward distribution to founders 2020-03-18 18:03:56 +00:00
catbref
544fdbfbe9 Add database-level CHECK constraint on account balances 2020-03-18 18:03:13 +00:00
catbref
c3d1ecb7e1 Reduce maximum allowed distance back to common block 2020-03-18 18:02:00 +00:00
catbref
873a9d0cee Add support for testing with multiple online accounts 2020-03-18 18:00:46 +00:00
catbref
95cb5f607b Use HSQLDB v2.5.0 but with fix for INSERT...ON DUPLICATE KEY UPDATE bug 2020-03-18 17:58:16 +00:00
catbref
54d0b721c4 Dynamically allocate/deallocate Peer byteBuffer to reduce memory load at the expense of extra GC 2020-03-16 17:50:49 +00:00
catbref
4a4678b331 Immediately close socketChannels after accepting peers we won't use 2020-03-16 16:07:17 +00:00
catbref
12f9ecaaca Faster Synchronizer shutdown by checking Controller.isStopping() 2020-03-16 16:05:27 +00:00
catbref
1d3ee77fb8 Increase default number of peers required before a node can mint/sync, and other settings 2020-03-15 14:14:58 +00:00
catbref
64055e280d Shutdown controller, and hence entire node, if networking or API fail to start. 2020-03-11 15:46:59 +00:00
catbref
90e0f9dddc Fix system-dependent path separator usage.
Although HSQLDB is happy being given unix-style path separator '/'
and converting as necessary on other platforms (e.g. Windows),
manipulation of repository pathnames in Java, outside of HSQLDB,
needs to use platform-specific path separators.

Thus, changes made to replace '/' with File.separator where
necessary.

This should fix repository rebuild errors, which then lead to odd
start-up errors like:

2020-03-11 13:55:19 INFO  Controller:270 - Starting repository
2020-03-11 13:55:20 INFO  Controller:287 - Validating blockchain
2020-03-11 13:55:20 INFO  HSQLDBRepository:227 - Rebuilding repository from scratch
2020-03-11 13:55:20 INFO  GenesisBlock:296 - Using genesis block timestamp of 1583870000000
2020-03-11 13:55:21 WARN  HSQLDBRepository:720 - Uncommitted changes (882) after connection close, session [3]
java.lang.NullPointerException
    at org.qortal.transform.block.BlockTransformer.decodeOnlineAccounts(BlockTransformer.java:422)
    at org.qortal.block.Block.getExpandedAccounts(Block.java:546)
    at org.qortal.block.Block.increaseAccountLevels(Block.java:1245)
    at org.qortal.block.Block.increaseAccountLevels(Block.java:1239)
    at org.qortal.block.Block.process(Block.java:1206)
    at org.qortal.block.GenesisBlock.process(GenesisBlock.java:345)
    at org.qortal.block.BlockChain.rebuildBlockchain(BlockChain.java:526)
    at org.qortal.block.BlockChain.validate(BlockChain.java:481)
    at org.qortal.controller.Controller.main(Controller.java:289)

The above happens because the old blockchain still exists when trying to process
the genesis block.
2020-03-11 15:25:04 +00:00
catbref
b0b0e2ac18 Strip JNI options before calling ApplyUpdate
AdvancedInstaller's Java launcher EXE seems to use JNI to launch
the JAR, instead of using the command-line 'java' binary directly.

When AI's launcher does this, it adds options like "abort" and "exit",
along with corresponding hook addresses.

These options are returned by the call to
ManagementFactory.getRuntimeMXBean().getInputArguments() which is
done in AutoUpdate while building the command line for launching
ApplyUpdate.

Because command-line 'java' binary doesn't support these options,
they are now stripped out.
2020-03-11 10:41:39 +00:00
catbref
9db606af5a Latest genesis block 2020-03-10 18:12:11 +00:00
catbref
5bfc17bd64 Remove node UI and have tray icon open local/remove UI server
No more "node UI". UI provided by 3rd party.

"Open UI" tray icon menu item now attempts to open UI at various
local servers (see Settings.uilocalServers) or some random
remote server (Settings.uiRemoteServers).

Default UI port now 12388 (Settings.uiPort).
2020-03-10 13:32:10 +00:00
catbref
a3c44428d3 Restrict TRANSFER_PRIVS recipients to new (non-existent) accounts. 2020-03-04 15:41:47 +00:00
catbref
450ff7318f Slightly more restrictive API access 2020-03-04 15:41:19 +00:00
catbref
2dffd382ae Pre-launch blockchain config / genesis block
Also included: auto-update approval script for use by dev-group admins
(won't work for anyone else)
2020-03-03 15:58:08 +00:00
catbref
e425fe5d5a Translation fixes
Translator class no longer logs warnings for every failed translation.

Commented out unused ApiError enum entries.
Renamed some ApiError names like "_NO_EXISTS" to "_UNKNOWN".
Removed old src/main/resources/globalization/* files.

Added CheckTranslations test app.

Fixed some extraneous/missing ApiError aspects in some API-related classes.
e.g. added NAME_UNKNOWN to GET /names/{name}
2020-03-02 12:49:15 +00:00
catbref
a68caa2de1 Fix serialization of negative BigDecimal values!
We've never needed this before but now it's fixed.
Added corresponding +ve & -ve tests just to make sure.

Only actual use-case that comes to mind is cancelling reward-share.
2020-02-24 13:51:01 +00:00
catbref
3470b8bf57 Added API call GET /transactions/reference/{reference} for looking up a transaction by its reference 2020-02-24 13:50:34 +00:00
catbref
99e11d1f52 Actually respect 'autoUpdateEnabled' setting 2020-02-24 13:49:21 +00:00
catbref
743db9190e Reworked/improved auto-update build/publish tools.
Instead of working on a single 'auto-update' branch,
that needed to be rebased from master branch's HEAD,
we create an orphan branch named after master:HEAD
containing on the update file.

This allows us to keep/delete updates on a per-commit
basis and shows which commit each update is based upon.

Added loads more checking.
2020-02-24 11:22:13 +00:00
catbref
53b3d09288 Fix rebase-and-rebuild.sh to use org.qortal.XorUpdate instead of old org.qora.XorUpdate 2020-02-20 08:30:47 +00:00
catbref
4565d0ddcb Check auto-update can be fetched before broadcasting auto-update TX 2020-02-20 08:28:28 +00:00
catbref
de51de1819 Tools for building, and broadcasting, auto-update 2020-02-20 08:28:28 +00:00
catbref
282f6e6e2a Changed error response from RewardShareTransaction.isValid() for existing self-shares.
Before:
0-fee self-share REWARD_SHARE when there is an existing self-share would result in
INSUFFICIENT_FEE from isFeeValid()

After:
isFeeValid() returns OK for above, but isValid() returns SELF_SHARE_EXISTS.

In addition, a transaction that tries to modify existing self-share, even with fee,
also returns SELF_SHARE_EXISTS.

Improved tests to double check.
2020-02-18 13:23:42 +00:00
catbref
a4e127c84a Added INDEX to speed up block orphaning.
NOTE: first startup after this commit can take a while due to building index!

SQL statement "DELETE FROM HistoricAccountBalances WHERE height >= ?" required
a full table scan and so was very slow on VMs/routers. This statement used by
HSQLDBAccountRepository.deleteBalancesFromHeight(), itself called during
Block.orphan().

Symptoms particularly evident during shutdown where above statement could take
upwards of 15 minutes on single-CPU, small-memory VMs!

Statement wasn't noticed before as slow-query checking wasn't involved.
Slow-query checking now applies to HSQLDBRepository.delete() and
HSQLDBRepository.exists() calls.

Added test for correct HSQLDB interrupt handling.

Fixed some typos.
2020-02-14 12:09:49 +00:00
catbref
0e9bbfe6fa Hide transaction approvalStatus field from sample POST data in API documentation 2020-02-10 14:18:56 +00:00
catbref
211116160c Added AutoUpdates.md notes about the auto-update feature 2020-02-10 13:39:23 +00:00
catbref
a6c1f1086f Disable Java JVM memory flags by default in run.sh script 2020-02-10 13:39:00 +00:00
catbref
774a8f20ee Fixed API call GET /blocks/minter/{address}. Now returns block summaries instead of full block data. 2020-02-06 14:28:02 +00:00
catbref
1cb2935cad Improved run.sh, additional stop.sh and bumped genesis block timestamp in blockchain.json 2020-02-04 12:56:07 +00:00
catbref
07d4d6f11d Fix genesis block change detection 2020-02-04 12:55:35 +00:00
catbref
e55e811fcc Added example shell script to run Qortal and updated README.md 2020-02-04 12:27:08 +00:00
catbref
3ef4711c27 Log noise: don't log zero NTP offsets or unimplemented transaction types 2020-02-04 12:16:34 +00:00
catbref
e0e9673837 Massive refactor to change 'qora' references to 'qortal'.
Blockchain configs will need "v2Timestamp" feature trigger renaming to "qortalTimestamp"!

Due to Controller.VERSION_PREFIX changing, peer-to-peer protocol version detection has
been changed. Was previous a substring match, now we test peers's buildTimestamp is at
least Peer.V2_PROTOCOL_TIMESTAMP_THRESHOLD. Changes in Peer.java.

Also added comment and throw() to QortalATAPI.getNextTransactionTimestamp()
as this needs given the change to Qortal's block timestamps from legacy Qora.

Changes to HSQLDB data types, e.g. QoraAddress to QortalAddress, means existing
database will need to be thrown away after this commit!
2020-02-04 12:11:37 +00:00
catbref
87dffb183e Changes needed to build Windows installer 2020-02-03 10:19:41 +00:00
catbref
dce919f58c Updated pre-launch blockchain config + fixes
Fixed build timestamp parsing in Controller post reproducible build.
Fixed REGISTER_NAME support in genesis block.
2020-01-24 11:35:30 +00:00
catbref
996e1c3a20 Fix node-management-ui placeholder wrt. reproducible builds 2020-01-23 12:40:20 +00:00
catbref
2af370d55d pom.xml modifications for reproducible builds
Seems to produce fat JARs with the same MD5 after repeated runs of:
mvn clean package

Needs testing on other platforms, hence this commit.

Also trimmed some unneeded included JAR libraries from pom.xml,
e.g. netty, async-http-client,
and the *.js.map files from Swagger-UI, which seems to reduce
output JAR size from about 51MB to about 44MB.
2020-01-23 11:59:34 +00:00
catbref
d2d2956c8a Updated build instructions in README.md and moved database info to DATABASE.md 2020-01-22 10:54:21 +00:00
catbref
5dec4fd8a1 Improve TRANSFER_PRIVS tests to cover more aspects 2020-01-21 13:37:22 +00:00
catbref
1f7827b51f Interim work on TRANSFER_PRIVS transaction
Converted AccountData's initialLevel to blocksMintedAdjustment.

Corresponding changes to AccountLevelTransaction so that level
set in genesis block is converted to blocksMintedAdjustment,
via cumulativeBlocksByLevel.

Ditto changes to HSQLDBAccountRepository, HSQLDBDatabaseUpdates,
[HSQLDB]TransactionRepository, etc.

Changes to API call POST /admin/mintingaccounts to check passed
reward-share private key maps to a reward-share with minting
account that still has privilege to mint. It's possible for
a TRANSFER_PRIVS transaction to transfer away minting privileges
from a minting account referenced by in a reward-share.

Change to RewardShareTransaction to allow users to cancel a
reward-share even if minting-account component no longer has
minting privs. This should allow users to clean up more after
a privs transfer.

Re-order processing/orphaning in Block.process()/Block.orphan()
to be more consistent and also to take in account changes that
might have been caused by TRANSFER_PRIVS transactions which affect
who might actually receive block rewards/tx fees.

Founders now gain blocksMinted & levels as part of minting blocks.
(Needed to make TRANSFER_PRIVS from a founder account to work).

BlockMinter now has added checks to make sure that the reward-shares
it might use to mint blocks still have valid minting-accounts.
i.e. that the minting-account component of reward-share hasn't had
minting privs transferred away by TRANSFER_PRIVS tx.

Controller now rejects online-accounts from peers that no longer
have minting privs (e.g. transferred away by TRANSFER_PRIVS)
Corresponding, Controller no longer SENDS online-accounts that no
longer have minting privs to other peers.

Added some tests - more tests needed, e.g. for multiple transfers
into the same account, or a test for minting post transfer for both
sender & recipient.
2020-01-21 13:37:22 +00:00
catbref
5cd35e07d0 Fix off-by-one error when reducing account level during block orphaning.
Added test to cover above.

Modified test-chain-v2.json so Dilbert starts with level 5, not 8,
to reduce number of blocks minted during tests.
2020-01-21 13:34:46 +00:00
catbref
c3a6e0d9fd Some transaction "layout" documentation only changes, including missing entry for "recipient" in TRANSFER_ASSET transactions 2020-01-13 15:47:11 +00:00
catbref
3e3c0affb0 Change auto-update to required approved tx created by non-admin.
Previously it was possible broadcast an auto-update tx that was
created by a 'dev' group admin.

Now the auto-update tx must be created by a 'dev' group non-admin/owner
and hence require group approval before it takes effect.

To this end, a new TransactionRepository.getLatestAutoUpdateTransaction()
method has been added to simplify finding the latest matching, approved
auto-update transaction.

Corresponding changes also made to AutoUpdate.run()
2020-01-07 14:26:54 +00:00
catbref
a5c889c312 Alter repository so GroupInvites.expiry can be NULL 2020-01-07 14:23:45 +00:00
catbref
7a7ca4b684 Fix rounding issue when checking whether tx meets approval threshold 2020-01-07 14:23:09 +00:00
catbref
8ba11efbd4 Fix GenesisBlock.isGenesisBlock() to prevent chain rebuild on restart 2020-01-07 14:22:07 +00:00
catbref
6c7318678c Bumped pre-launch genesis timestamp 2019-12-23 15:48:32 +00:00