Commit Graph

460 Commits

Author SHA1 Message Date
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
catbref
8aa084a0d8 Updated pre-launch blockchain config. Smaller splash graphic. 2019-12-23 15:09:45 +00:00
catbref
09ffd6fe6b Blockchain replacement for launch.
These changes are for allowing devices to be shipped with an interim blockchain config & genesis block, running with "main-net" settings, prior to launch.
At launch, an "auto-update" will be broadcast to replace blockchain config & genesis block with the final, launch version.
When updated nodes restart (immediately after auto-update) they should notice their existing genesis blocks are invalid and hence wipe their blockchains,
effectively starting the final, launch blockchain.

To this end, genesis block signatures have been changed to better incorporate values that are likely to change at launch, e.g. block timestamp and transaction data.

Added Crypto.dupDigest(), which is effectively Bytes.concat(digest(msg), digest(msg)).

No need for HSQLDB repository to backup, or wipe, non-existent files for "in-memory" databases!

New interim blockchain config/genesis block.

**NOTE** These changes are being committed but require testing. However the auto-update suite requires a pushed commit in order to build an update file!
2019-12-17 16:19:35 +00:00
catbref
42bd68230b Cancel reward-shares with NEGATIVE share instead of ZERO. Also: bug-fixes!
Now reward-shares with zero percent are valid, to allow the 'recipient' party to gain
"number of minted blocks" but no actual block reward.

Correspondly, the special zero share used to cancel reward-shares has been changed to
be any negative value.

Block rewards, founder 'leftovers': if founder is minter account in any online
reward shares, then the per-founder-share is spread across their online reward-shares,
otherwise it's simply/wholy given to that founder.

Created a new DB table to hold "next block height", updated via triggers on Blocks.
This is so various sub-queries can simply read the next-block-height value instead
of complex IFNULL(MAX(height),0)+1 or SELECT height FROM Blocks ORDER BY height DESC.
Prior code was also broken in edge cases, e.g. no genesis block, or ran slow.

Added tests to cover above.

Deleted BTC tests as they're obsolete.

Added/improved other tests.
2019-12-11 13:40:42 +00:00
catbref
d01504a541 More reliable start-up by removing some race conditions in Controller and Network 2019-11-28 15:28:32 +00:00
catbref
e9c94eb83b Fix args not being propagated by AutoUpdate to ApplyUpdate. Also propagate ALL command-line args, not just args[0] 2019-11-28 14:30:42 +00:00
catbref
62ed4e322b Propagate JVM arguments through auto-update. Improve start-up error messages shown by GUI 2019-11-28 11:57:26 +00:00
catbref
339e757d34 Add callstack when logging slow repository queries. Blockchain.validate() improvement 2019-11-26 11:31:44 +00:00
catbref
939ce0d652 Correct auto-update URLs to use "qortal.update" not "qortal.jar" 2019-11-26 10:26:16 +00:00
catbref
20813863bc Updated .gitignore 2019-11-26 10:20:06 +00:00
catbref
04839d1fba Move XorUpdate back to org.qora package for mainstream use 2019-11-26 09:02:35 +00:00
catbref
d9bafaa42c Improve speed of HistoricAccountBalances triggers 2019-11-26 08:58:52 +00:00
catbref
9b894616ee Try for blockchain lock before tying up repository in BlockChain.trimOldOnlineAccountsSignatures 2019-11-26 08:58:19 +00:00
catbref
790f569dbd Fix case-typo in log4j2.properties 2019-11-26 08:57:04 +00:00
catbref
3990ded802 Add blockchain lock around trimming old online account signatures to prevent deadlocks. 2019-11-25 10:06:21 +00:00
catbref
69bb152163 Suppress Jersey EOF exception errors - actually remote peers disconnecting early 2019-11-25 09:58:55 +00:00
catbref
2e47019021 Rename some "qora" references to "qortal"
Examples:
qora.org to qortal.org
qora-core.jar to qortal.jar
qora-core.exe to qortal.exe
etc.
2019-11-21 09:38:41 +00:00
catbref
238487ea98 Add settings toggle "apiDocumentationEnabled" which is false by default.
API documentation support seems to take a lot of extra memory,
so this is disabled by default for router-based nodes.
2019-11-14 11:33:08 +00:00
catbref
06794ab36c Relax minimum peer conditions for synchronization 2019-11-12 16:25:55 +00:00
catbref
cb7df0c5c1 Fix noisy Block logging entry 2019-11-12 16:04:40 +00:00
catbref
e1fbd3178a Add JAXB annotation to PeerAddress so API GET /peers/self works 2019-11-12 15:26:12 +00:00
catbref
7b24ac6e00 Bump version to 1.0. Bump BC to 1.64, Jetty to 9.4.22 2019-11-12 15:05:39 +00:00
catbref
ab8e05cb0f Update blockchain.json to nearer launch version 2019-11-12 15:04:41 +00:00
catbref
47d0274a5e Move non-production apps from main to test
+ Move test apps from org.qora.test to org.qora.test.apps

("app" being a class with a main() method)
2019-11-12 15:03:20 +00:00
catbref
47dcff0beb Include error message if Network can't create listen socket 2019-11-12 14:58:09 +00:00
catbref
8906ce9b26 Change BlockMinter to pick BEST block if minting with several accounts
+ Removed obsolete BlockMinter.deleteInvalidTransactions()
2019-11-12 14:56:45 +00:00
catbref
482947dbf4 Share leftover block reward to founders, regardless whether online
Added support in AccountRepository to fetch account using flags.

+ renamed some local variables in some Block methods to avoid clashes
2019-11-12 14:55:46 +00:00
catbref
49ac7921a1 Fix new account level not taking effect in block rewards
Added encoded online accounts list decoder.
2019-11-11 17:55:58 +00:00
catbref
30df320e7f Redoing account balances with block height.
*** WARNING ***
Possible block reward bug in this commit. Further investigation needed.

Reverted AccountBalances back to height-less form.
Added HistoricAccountBalances table that is populated via trigger on AccountBalances.
This saves work when performing common requests for latest/confirmed balances,
shunting the extra work to when requesting height-related account balances.

Unified API call GET /addresses/balance/{address} by having address/assetId/height as
query params.

Simpler call for fetching legacy QORA holders during block rewarding.

Improved SQL for fetching asset balances, in all conditions,
e.g. with/without filtering addresses, with/without filtering assetIds,
etc.

Unit test for above to make sure query execution is fast enough.
(At one point, some SQL query was taking 6 seconds!)

Added optional 'height' Integer to AccountBalanceData, but this
is not populated/used very often.

HSQLDBAccountRepository.save(AccountBalanceData) now checks zero balance saves
to see if the row can be deleted instead. This fixes a lot of unhappy tests
that complain that there are residual account balance rows left after
post-test orphaning back to genesis block.

Yet more tests.
Removed very old 'TransactionTests' which are mostly covered in more specific tests elsewhere.
Added cancel-sell-name test from above.

Fixed AssetsApiTests to check for QORT not QORA!

Changed hard-coded assetIDs in test.common.AssetUtils in light of new LEGACY_QORA & QORT_FROM_QORA genesis assets.

Some test blockchain config changes.
2019-11-08 17:30:09 +00:00
catbref
31cbc1f15b Account assets balances now height-dependant. QORT-from-QORA block reward fixes. 2019-11-07 15:53:37 +00:00
catbref
f5918bd9bf Added range-check on online account timestamps 2019-11-06 10:11:10 +00:00
catbref
00aee1458e Higher account levels more likely to win blocks
Also:

RewardShareKeys app now supports only one arg (minter private key)
in self-reward-share mode, where recipient public key is derived
from minter private key.

Added methods to Account for returning 'effective' minting level
where minting level for founders is read from blockchain config.
(Or returns zero if unable to mint).

Changed two Block constructors into static methods that return
a new Block as there was way too much work being done to really
be called a constructor, especially with all the opportunities
to throw an exception too.

Main blockchain config updated to reflect near-launch version.

Added/changed blockchain weight tests to check block winning
based on higher account levels.
2019-11-06 09:47:10 +00:00
catbref
ebc2ee6ea9 Rework distributing block reward to legacy qora holders
Fix related unit tests.

Fix assetID support in GENESIS transactions.
2019-11-01 10:01:31 +00:00
catbref
62e2fd759c Fixing unit tests 2019-10-30 13:19:56 +00:00
catbref
fef16e7620 Self-reward-share tests and fixes.
Added Transaction.isFeeValid() to allow transaction subclasses to override and allow zero fees, etc.

Added tests to cover self-reward-shares, including zero fee scenario.

Set 'dilbert' test account to level 8 in test genesis block.

Removed leftover mention of "previous_level" from HSQLDBAccountLevelTransactions,
and AccountLevelTransactionData. (Previous level makes no sense as ACCOUNT_LEVEL
transactions are genesis-block only).

Fixed some incorrect uses of PrivateKeyAccount.getSharedSecret() to
PrivateKeyAccount.getRewardSharePrivateKey() in tests.
2019-10-30 10:23:59 +00:00
catbref
491e79b8e6 ProxyForging->RewardShare massive refactor & more...
Unified terminology from block "generator", "forger", etc. to "minter"

Unified terminology "proxy forger" to "reward share" as it was
incorrect, or at least highly ambiguous, which account had which role.

AccountRepository.findRewardShares() has different arg order!

Account.canMint() now returns true if account has 'founder' flag set.
Added Account.canRewardShare() which returns whether acocunt can create
a reward-share (e.g. level 5+ or founder).

Fixed HSQLDBAssetRepository.getAllAssets() which had incorrect
resultSet column indexes.

Removed old traces of EnableForging transaction.

ACCOUNT_LEVEL and ACCOUNT_FLAGS (genesis-block-only transaction types)
now set target account's last-reference. This is allow later REWARD_SHARE
transactions in genesis block and post-genesis transactions by that account.

REWARD_SHARE transactions are now FREE, but only if minter is also recipient.
If a self-reward-share already exists, then unless share-percent is zero (to
terminate reward-share), any subsequent self-reward-share is invalid.

Updated SysTray i18n properties file.

BlockChain config file requires 'minAccountLevelToRewardShare' and optional
'minAccountLevelToMint'.

Added potential, but currently unused, memory-hard PoW algorithm.

Fixed/removed/disabled some unit tests.
BlockMinter.generateTestingBlock asks Controller to pretend mintingAccount is 'online'.
More testing needed!
2019-10-29 17:46:55 +00:00
catbref
843aad4930 Update BouncyCastle Ed25519 to X25519 key conversion shim 2019-10-25 13:22:08 +01:00
catbref
5798c69449 Code clean-up thanks to SonarLint & bugfix for ByteArray::compareTo! 2019-10-15 17:10:13 +01:00
catbref
a3751823eb Improve code dealing with increase account level due to generated blocks & add orphan equivalent. 2019-10-14 16:37:48 +01:00
catbref
6ba24e1820 Minor code tidying 2019-10-14 11:05:07 +01:00
catbref
319bfc8d75 Add account level change due to blocks generated.
Removed ENABLE_FORGING and related.

Still to do: 'orphan' version of Block.increaseAccountLevels
2019-10-10 13:52:00 +01:00
catbref
54d49e0f1d More work on block rewards in relation to account level/legacy qora held.
Rename Asset.QORA to Asset.QORT so we can also have Asset.LEGACY_QORA
as another hard-coded asset.

Add "is unspendable" aspect to assets where only the asset owner can
transfer/pay asset to other people. Asset trading is barred regardless,
as is use of asset for ATs.

Added "initial level" to account data in preparation for accounts levelling
up from generating blocks.

Added distribution/removal of block reward based on legacy-QORA held.

Removed "previous level" from ACCOUNT_LEVEL transactions as they're
only ever valid in genesis block and so previous level is never needed.
2019-10-08 14:58:00 +01:00
catbref
a1e83109a8 Qortal-style block rewards 2019-10-03 14:20:46 +01:00
catbref
a0be1273c7 Remove max coin supply aspects
Maximum amount/price for selling a name limited to 10 billion,
with 8 decimal prices, so encoding fits within 8 bytes.
2019-10-02 13:24:17 +01:00
catbref
4062bdb7bb Workaround for Handshaking sometimes not correctly dealing with connect-to-self. 2019-10-01 13:15:21 +01:00
catbref
1016d0ca16 Fix Synchronizer bugs
Synchronizer incorrectly tried to compare chain weights in the case
where we had no extra blocks after common block, and thus no blocks
to actually compare.

During chain compare, when more block summaries are needed from peer,
the block signature sent to peer wasn't updated from the last batch
and so the same common block signature was sent. This caused the
code to incorrectly bail out with
"Peer respond with invalid block summary" error as the block heights
didn't match.

Post chain-compare/orphan (if any), and when fetching block signatures,
the code referenced peerBlockSummaries where it should have been
referencing peerBlockSignatures instead. This caused to code to incorrectly
bail out with the "Peer failed to respond with more block signatures..."
error.
2019-10-01 13:02:23 +01:00
catbref
381c032cec Fixed Network's broken choice of next connectable peer.
Slight improvement to comment in Peer.
2019-10-01 12:59:54 +01:00
catbref
568a1f8a30 Migration to Java 11
Updated pom.xml.
Updated dependencies, including various minor code mods, esp. bitcoin-related.

Starts up and talks to Java 8 nodes!

Dev environment should be at least Eclipse 4.11 with m2e 1.9.1+
2019-09-30 18:06:00 +01:00