Commit Graph

796 Commits

Author SHA1 Message Date
catbref
ec1954bae1 Notify Chat websocket listeners if group membership changes
Also unified newTransactionExecutor and newBlockExecutor into
callbackExecutor.
2020-06-24 11:22:26 +01:00
catbref
66276a6f65 Merge branch 'ssl' into launch 2020-06-23 14:29:45 +01:00
catbref
c00ab2f87c Add support for HTTPS for API
Requires entries 'sslKeystorePathname' and 'sslKeystorePassword'
in settings.json.

With SSL enabled, API will auto-detect HTTP or HTTPs on the same port.

Included tools/build-keystore.sh to help build keystore from
Let's Encrypt certificates.
2020-06-23 14:27:40 +01:00
catbref
99f3ab9921 /chat/active/{address} now produces entries for groups where {address} is a member, even if there are no messages 2020-06-22 14:16:57 +01:00
catbref
75b15c6639 Improve /chat/active/{address} output to include latest message's sender address, and registered name if applicable 2020-06-19 13:38:38 +01:00
catbref
e5e60a5032 Fix badly named API calls refering to block signers as block minters!
Renamed GET /blocks/minters to /blocks/signers
Renamed GET /blocks/minter/{address} to /blocks/signer/{address}

Changed corresponding repository methods and data classes.
2020-06-16 16:58:34 +01:00
catbref
b9d2bbb78b New /websockets/blocks & some controller/block tidying
Controller.onBlockMinted() now .onNewBlock(BlockData)
which saves having to fetch from repository.
Controller.onNewBlock also takes care of updating Controller's
cached chain tip, requesting SysTray refresh, broadcasting
new tip info to peers and notifying websockets.

BlockMinter and Controller.actuallySynchronize updated
to use unified .onNewBlock.

BlocksWebsocket also returns blocks on demand, given either
integer block height or base58 block signature.

Added support to return ApiError via websockets.
2020-06-15 14:07:09 +01:00
catbref
3d79408574 API GET /blocks/signature/{signature} now returns BLOCK_UNKNOWN instead of null
Also removed unnecessary catch-and-throw of ApiExceptions
2020-06-15 13:18:33 +01:00
catbref
67b184acc9 Chat websockets!
ws://hostname:port/websockets/chat/active/{address}
ws://hostname:port/websockets/chat/messages?txGroupId=XXX
ws://hostname:port/websockets/chat/messages?involving=AAA&involving=BBB
2020-06-12 15:10:55 +01:00
catbref
11040ae60a Added ws://hostname:apiport/websockets/chat/active/{address}
Unified Transaction.importAsUnconfirmed() and Controller.onNetworkTransactionMessage()
to both call Controller.onNewTransaction().

Modified Controller.onNewTransaction() to only send transaction signature to
other peers, instead of full transaction. Peers can request full transaction if they
don't have it.

Controller.onNewTransaction() also calls ChatNotifier, which in turn
notifies websocket handlers about new CHAT transactions.

Added jetty websocket dependency to pom.xml
2020-06-12 10:24:22 +01:00
catbref
a338202ded Fix incorrect PoW buffer usage length in verify & adjust difficulties
CHAT: 8 or 14
MESSAGE: 14
PUBLICIZE: 15
Handshake: 8

Added test to cover verify bug
2020-06-10 10:09:06 +01:00
catbref
e0398490ae Override reference checking for PUBLICIZE transaction type 2020-06-08 09:16:10 +01:00
catbref
847093edac Fix incorrect PoW buffer length usage 2020-06-08 09:01:55 +01:00
catbref
758a42db36 Fix incorrect txType in PUBLICIZE layout 2020-06-05 12:04:59 +01:00
catbref
c2b253df55 Remove extraneous import to cure warning 2020-06-04 18:10:49 +01:00
catbref
cc3adc6720 Correct API models from using "Bitcoin refund/redeem address" to pubkeyhash 2020-06-04 15:51:44 +01:00
catbref
d77acd9eb9 Delete "old" peer from in-memory known peer cache too 2020-06-04 10:57:49 +01:00
catbref
5ad2bc1940 Merge branch 'MESSAGE-PoW' into launch 2020-06-04 10:22:20 +01:00
catbref
d0b4a1f12f Added PoW to MESSAGE (for zero fee). DB and tx layout changes. 2020-06-04 10:20:02 +01:00
catbref
5ffddd0169 Changes to block reward distribution
Any reward leftover from ditributing to legacy QORA holders is reallocated to either:
founders if any online
or
account-level-based reward candidates, if no founders online

We should get pretty close to 100% block reward distribution, barring rounding artifacts.

More documentation and tests.

Removed BlockChain's founderShare as it is calculated in Block on a per-block basis instead.
2020-06-02 10:42:45 +01:00
catbref
b5512dfa91 Rework block rewards to be faster and only reward *online* founders.
Now we sum generic block reward + transaction fees before performing
distribution only once.

Added Map to collate account-balance changes during block reward
distribution so the final changes can be applied in one batch,
reducing DB load.

Some other optimizations like a faster ExpandedAccount.getShareBin().

Passes test EXCEPT RewardTests.testLegacyQoraReward(), pending decision
on how to reallocate 'unspent' block reward.
2020-06-01 16:50:28 +01:00
catbref
2493d5f7a8 Fix wrong test blockchain config being used for legacy qora holder testing 2020-06-01 16:44:56 +01:00
catbref
bef1828404 Add support for multiple P2SH funding transactions rather than requiring only one 2020-05-29 19:10:20 +01:00
catbref
0ae232b8ba Fix return result from ElectrumX.broadcastTransaction 2020-05-29 19:09:45 +01:00
catbref
cdf0795881 Add extra test case to MemoryPoW 2020-05-28 14:15:42 +01:00
catbref
31e85226f4 WASM version of MemoryPoW! 2020-05-28 14:09:53 +01:00
catbref
6eea7c2aa1 Disallow registering/updating to a name that looks like an address 2020-05-27 10:56:03 +01:00
catbref
9aabf93523 Merge branch 'PUBLICIZE-txn' into launch 2020-05-27 10:46:27 +01:00
catbref
322e2cdc41 API call /crosschain/p2sh/redeem returns BTC_BALANCE_ISSUE in preference to INVALID_ADDRESS when P2SH balance is too low/zero 2020-05-27 10:44:37 +01:00
catbref
df395c77db Fix up BTCACCT.findP2shSecret given reduced data available since switch to ElectrumX 2020-05-27 10:43:14 +01:00
catbref
274002c473 Fix BTC.getMedianBlockTime() and update tests 2020-05-27 09:29:11 +01:00
catbref
3d4fc38fcb Replaced bitcoinj networking with ElectrumX.
No more bitcoinj peer-group stalls, or slow startups,
or downloading tons of block headers, or checkpoint files.

Now we use ElectrumX protocol to query info from random servers.

Also:
BTC.hash160 callers now use Crypto.hash160 instead.
Added BitTwiddling.fromLEBytes() returns int.

Unit tests seem OK, but needs complete testnet ACCT walkthrough.
2020-05-26 17:47:37 +01:00
catbref
d50f16b8a9 PUBLICIZE transaction for on-chain record of public key 2020-05-25 15:20:21 +01:00
catbref
59de22883b Use CHAT, not MESSAGE, MAX_DATA_SIZE in ChatTransactionTransformer 2020-05-25 08:30:06 +01:00
catbref
db73afaf88 Remove Block.orphan() forced repository debugging 2020-05-25 07:27:42 +01:00
catbref
3afbd7aa51 Recheck for duplicate connection after handshaking to cover race condition with simultaneous bi-directional connections 2020-05-25 07:24:19 +01:00
catbref
0c32afa07f New network handshaking. NOT backwards compatible!
Old Qora v1 message types removed.
Message type values changed.

Network handshaking reworked to fix multiple-connections issue.
Instead of using some random peerID, we now use proper keypairs and a challenge-response handshake to prevent doppelgangers/ID-theft.
This results in simpler handshaking code as we don't have to perform some arcane doppelganger resolution.

Handshaking still uses proof-of-work for challenge-response, but switched to newer MemoryPoW.

API call GET /peers no longer has 'buildTimestamp' field, but does now have 'nodeId' field.

Network no longer has a whole raft of getXXXpeers() due to simplified handshaking.
Quite a few method calls changed to simply Network.getHandshakedPeers(), which is also faster.
2020-05-22 17:16:45 +01:00
catbref
bd543a526b Update uses of old Public/PrivateKeyAccount static methods to Crypto 2020-05-22 17:13:55 +01:00
catbref
b262044a52 Move some crypto methods from Public/PrivateKeyAccount to Crypto for reuse by new network handshaking 2020-05-22 17:06:48 +01:00
catbref
200a97184c Include transaction reference in chat messages returned by API call GET /chat/messages 2020-05-22 08:00:43 +01:00
catbref
5f4b66e5b0 Save public keys from CHAT transactions so they can be fetched via API. 2020-05-20 15:53:43 +01:00
catbref
9c48343581 Potential fix for rare HSQLDB "serialization failure" in Transaction.importAsUnconfirmed() 2020-05-20 07:33:21 +01:00
catbref
219f82f562 Modify API call GET /chats/active/{address} to return info on all joined groups.
Previously GET /chats/active/{address} would only return an active group chat
entry where 'address' was a member AND there was an existing CHAT
transaction with the same tx_group_id (and no recipient).

Now the response contains entries for ALL groups where 'address' is a member,
regardless of an existing CHAT transactions, omitting the 'timestamp' entry
if there are none.
2020-05-19 17:12:41 +01:00
catbref
51bfd49e25 Re-add missing senderName & recipientName to output of API call GET /chat/messages 2020-05-19 15:29:12 +01:00
catbref
7102f4a727 Fix for incorrect amounts reported by API 2020-05-19 15:20:20 +01:00
catbref
28991a926f Fix incorrect getDataLength() in RegisterNameTransactionTransformer 2020-05-19 14:55:26 +01:00
catbref
74f89af841 Enforce version 2+ for DEPLOY_AT 2020-05-19 08:35:25 +01:00
catbref
b4284515e7 Unify transaction NAME_NOT_LOWER_CASE checks to Unicode NAME_NOT_NORMALIZED version 2020-05-19 08:31:36 +01:00
catbref
032c5d0d07 Add missing fee check to TRANSFER_PRIVS 2020-05-19 08:25:53 +01:00
catbref
72100fe1d8 Refactor Unicode 'reduced' name code from side-effects into 'data' objects.
CREATE_GROUP, ISSUE_ASSET, REGISTER_NAME and UPDATE_NAME transactions affected.

The code to actually generate 'reduced' name was called inside isValid() and
relied on setting the corresponding transaction data object field so that it would
be saved by isValid()'s caller. Although this worked, it wasn't a very clean
solution.

Now the 'reduced' name is generated by transaction data object's constructors so
it is always present.

Also removed name/group/asset reduceName(String) methods as they were all the
same single-line call to Unicode.sanitize().
2020-05-19 08:08:21 +01:00
catbref
ed178e744d Merge branch 'asset-unicode' into launch 2020-05-19 07:57:06 +01:00
catbref
94f7079c2e Unicode homoglyph support to Assets 2020-05-19 07:56:17 +01:00
catbref
f1638aa9d9 Removed "owner" from CREATE_GROUP and added Unicode homoglyph support.
Group owner now derived from CREATE_GROUP transaction creator's public key.

Added 'reduced' group name to GroupData, with corresponding change to DB.
Renamed GroupData.getIsOpen() to simply isOpen().

Tidied up CreateGroupTransactionData, adding 'reduced' group name.
Renamed getIsOpen() to simply isOpen().
Added code to generated reduced group name when building genesis block.

Added Group.MIN_NAME_SIZE of 3.

DB tables changed to add reduced_group_name where appropriate,
removing owner where necessary.

Added GroupRepository.reducedGroupNameExists(String).

Fixed up test blockchain configs in src/test/resources/test-chain-v2*.json.
2020-05-18 17:27:32 +01:00
catbref
a7b9215ace Merge branch 'message-wo-recipient' into launch 2020-05-18 10:12:54 +01:00
catbref
956ad7bfa8 Merge branch 'asset-fixes' into launch 2020-05-18 10:12:42 +01:00
catbref
4baf442cb8 Merge branch 'name-fixes' into launch 2020-05-18 10:12:31 +01:00
catbref
24eb7c6933 Allow MESSAGE transactions to have no recipient.
This allows on-chain messages to a group, including NO_GROUP / groupID zero.

No-recipient messages cannot have an amount - where would it go?

Changed MESSAGE serialization layout to add boolean indicating
whether recipient is present.

Changed MESSAGE serialization layout so assetID is after amount,
and only present if amount is non-zero.

Changed DB table structures to cover above.

Added unit tests to cover above.
2020-05-18 09:09:35 +01:00
catbref
38a2af8cd5 Tidy up Assets by removing 'owner' from ISSUE_ASSET.
Owner now derived from issuer's public key.
Maximum asset name length reduced to 40 characters.

Repository table changes.

"owner" removed from test blockchain configs and "issuerPublicKey" used instead
where applicable.

Some getters in the form of "getIs___()" renamed to simply "is____()".
2020-05-15 16:22:13 +01:00
catbref
7447ab20a9 Add index for finding Registered Names using 'reduced' form 2020-05-15 14:18:51 +01:00
catbref
197c742ce7 Major work on Registered Names
Changes include:

* Allowing renaming
* Tracking last-updated timestamps
* More stringent Unicode processing
* Way more unit tests
* Max name length reduction to 40 chars

Note: HSQLDB repository table changes
2020-05-15 14:08:46 +01:00
catbref
f6ed3388a4 BTC tidy-up 2020-05-15 07:45:24 +01:00
catbref
c61690f3e6 BTC class does not need to extend Thread! 2020-05-14 13:18:44 +01:00
catbref
9a94873d0e Fix broken Long vs Long comparison in Block.areAtsValid() 2020-05-14 13:18:17 +01:00
catbref
5c8bda37d1 Rework BTC class for better startup & shutdown.
Controller no longer starts up BTC support during main startup.
This does mean that BTC startup is deferred until first BTC-related
action, and that the first BTC-related action will take much longer
to complete.

Added tests to cover startup/shutdown.

This also fixes splash logo stuck on-screen and broken Controller
shutdown when using REGTEST bitcoin network AND there is no
local regtest bitcoin server running.
2020-05-14 12:52:26 +01:00
catbref
fa08041696 BlockTransformer should skip AT transactions when calculating block length 2020-05-14 12:51:44 +01:00
catbref
f01a34a461 Throw an API error for inappropriate calls on OFFER-state cross-chain ATs.
P2SH-related API calls under /crosschain/ aren't applicable for
cross-chain ATs that are still in OFFER state, only TRADE state.
2020-05-14 12:48:41 +01:00
catbref
ef790a8cb1 Fix missing groupId 0 entry in output from API call GET /chat/active/{address} 2020-05-13 16:30:28 +01:00
catbref
cea0cee9a8 Names: fixes to allow name change and tests to cover 2020-05-13 15:07:36 +01:00
catbref
d9f784ed2b Registered names: changing 'owner' and allowing renaming.
REGISTER_NAME has an "owner" field which can be different from the actual
registrant (transaction creator's public key, used for signing transaction).

This allowed people to register names to be owned by someone else, thus breaking
the whole "one name per account" aspect.

So now "owner" is removed from REGISTER_NAME, and the actual owner address is
derived from transaction creator's public key, as you would expect.

Similarly, UPDATE_NAME has a corresponding "newOwner" field which has been removed.

In addition, UPDATE_NAME now allows users to change their registered name using a new
"newName" field.

Various changes made to DB, Name class, etc. to accomodate above, along with some minor
bug-fixes and comment improvements/corrections.

Needs new unit tests to cover both new functionality and old!
2020-05-13 10:19:56 +01:00
catbref
f29ae656b9 More work on CHAT
Always add group 0 info to output of API call GET /chats/active/{address}.
No groupName entry as it's "no group" or "group-less" or "not group related".
Timestamp also might be omitted if no message found.

Fix output of POST /chats/compute so it doesn't include zeroed 64-byte signature.
2020-05-12 20:27:09 +01:00
catbref
a9852e5305 More work on CHAT API / support.
Renamed GET /chats/search to /chats/messages.

Added GET /chats/active/{address} to return lists of group chats
and direct chats involving {address}, where a chat message exists.
2020-05-12 14:28:41 +01:00
catbref
32470fa641 Improve CHAT API and repository support.
Change CHAT API call GET /chat/search to better support the two
main scenarios of:

group-based chatting: supply txGroupId only
private chatting: supply 2 'involving' addresses only

Added some DB indexes to cater for above.

GET /chat/search now returns specialized ChatMessage objects
instead of ChatTransactions. This is to reduce unnecessary fetching
of data from repository, and onward sending to API client.
2020-05-12 10:02:41 +01:00
catbref
0d1c08bf96 Add index on DB Names.owner to help find names by owner 2020-05-12 10:02:26 +01:00
catbref
026c904ce4 Change processing of network TRANSACTION_SIGNATURES message.
Previously Controller would loop through the transaction signatures,
discard those already known, and then requesting the full transaction
via peer.getResponse(). This would tie up a networking thread for some
time and also potentially cause repository deadlocks, although the latter
could have been fixed another way.

However, the code after peer.getResponse() was identical to the code
processing an incoming TRANSACTION message. Now instead of requesting
and waiting for then processing each transaction, Controller simply
sends the peer a GET_TRANSACTION for each unknown transaction signature.

As the peer responds with corresponding TRANSACTION messages, these can
be processed individually with shorter period of locking.
2020-05-12 08:03:11 +01:00
catbref
59ae070c83 Fix API call POST /peers so it returns "false" for existing peer, instead of throwing / Internal Server Error 2020-05-11 12:59:56 +01:00
catbref
2ab695f308 NTP: don't call shutdownNow() on null instanceExecutor
When using fixed NTP offset, e.g. via "testNtpoffset" in settings.json,
Controller calls NTP.shutdownNow() which throws a NPE because
NTP.instanceExecutor is null.
2020-05-11 12:59:45 +01:00
catbref
f0ff77cd31 Fix ChatTransaction w.r.t. txGroupId meaning. Relax no-QORT PoW difficulty. 2020-05-11 12:58:46 +01:00
catbref
e241d9fa67 Split CHAT compute into separate API call to help UI 2020-05-11 12:58:05 +01:00
catbref
5e9b0cd03c Fix GroupInvites.expires_when in DB to re-allow NULL 2020-05-11 12:55:58 +01:00
catbref
a5c437913f Transaction.isValidTxGroupId() changed from private to protected - needed so ChatTransaction can override 2020-05-11 12:55:22 +01:00
catbref
3fa7da5115 Fix for incorrect blocksMinted count. Added test to cover 2020-05-08 08:51:56 +01:00
catbref
6d8f41ab05 Fix long overflow in Block.distributeBlockRewardToQoraHolders()
Sadly no native 128bit integer support in Java 11 so resorting to using
BigInteger.

Added/improved unit tests to cover.
2020-05-07 16:37:40 +01:00
catbref
3094ec3c26 Massive clean-up of DB & conversion to long for timestamps
Collated all development changes to DB so now we build
initial DB structure directly with final layout.
i.e. no ALTER TABLE, etc.

Reordered HSQLDB 'CREATE TYPE' statements into alphabetical order
for easier maintainability.

Replaced TIMESTAMP WITH TIME ZONE with simple BIGINT ("EpochMillis").
Timezone conversion is now a presentation task, rather than having
pretty values in database.

Removed associated conversion methods, like toOffsetDateTime(),
fromOffsetDateTime() and getZonedTimestampMilli().

Renamed some DB columns to make them more obviously timestamps, like:
Names.registered is now Names.registered_when.

Removed IFNULL(balance, 0) from HSQLDBAccountRepository as balances
are never null, or actually never 0 either.

Added more tests to increase API call, and hence repository, coverage.

Removed unused "milestone block" from Transactions.
2020-05-07 12:16:22 +01:00
catbref
359a35931e Fix broken Transaction.getUnconfirmedTransactions() and getInvalidTransactions() 2020-05-07 12:15:09 +01:00
catbref
9e0001c4f6 Improved comments, variable names, etc. for some repository interfaces 2020-05-07 10:22:44 +01:00
catbref
53112709fe Improve comment & tidy annotation in GroupData 2020-05-07 10:11:35 +01:00
catbref
d1bc500ab9 Correct two unit tests from BigDecimal to long/int. 2020-05-06 15:03:41 +01:00
catbref
74b5401e84 Merge chain-stall, blocksMinted and other fixes 2020-05-06 08:01:51 +01:00
catbref
d2559f36ce Fix for Block not correctly adjusting accounts' blocksMinted values.
Added BlocksMintedCountTests to cover above.
2020-05-05 16:10:54 +01:00
catbref
0cc9cd728e Fix for chain-stall relating to freshly cancelled reward-shares.
In some cases, a freshly cancelled reward-share could still have
an associated signed timestamp. Block.mint() failed to spot this
and used an incorrect "online account" index when building the
to-be-minted block.

Block.mint() now checks that AccountRepository.getRewardShareIndex()
doesn't return null, i.e. indicating that the associated reward-share
for that "online account" no longer exists.

In turn, AccountRepository.getRewardShareIndex() didn't fulfill its
contract of returning null when the passed public key wasn't present
in the repository. So this method has been corrected also.

AccountRepository.rewardShareExists(byte[] publicKey) : boolean added.

BlockMinter had another bug where it didn't check the return from
Block.remint() for null properly. This has been fixed.

BlockMinter now has additional logging, with cool-off to prevent log
spam, for situations where minting could not happen.

Unit test (DisagreementTests) added to cover cancelled reward-share
case above. BlockMinter testing support slightly modified to help.
2020-05-05 11:09:46 +01:00
catbref
e5cf76f3e0 Replace throwing IllegalStateException with more defensive log & null in Block/BlockMinter 2020-05-04 15:50:10 +01:00
catbref
44e8b3e6e7 Log when BlockMinter fails to acquire blockchain lock after waiting 2020-05-04 14:33:10 +01:00
catbref
1bca152d9c Reduce minBlockchainPeers for now 2020-05-04 14:32:42 +01:00
catbref
4edc3ee121 Fix AT transaction reference lookup/generation in light of new last-ref scheme 2020-05-04 09:32:18 +01:00
catbref
e9f29767c8 Change Transaction.countUnconfirmedByCreator() to disregard CHAT transactions.
This is because CHAT transactions have intrinsic anti-spam/DoS prevention
by requiring proof of work.
2020-05-04 09:29:07 +01:00
catbref
e2916b130b No need to store repository handle in Block$ExpandedAccount 2020-05-04 09:19:17 +01:00
catbref
538e117abd Clean up Transaction.isStillValidUnconfirmed()
Brought more into line with isValidUnconfirmed().
No need to update creator's lastReference under new last-ref scheme.

Correspondingly, no need to acquire blockchain lock or repository
shenanigans in getUnconfirmedTransactions() and getInvalidTransactions()
for the same reason.

getInvalidTransactions() seems to be unused and may well be cleaned up
in a future commit.
2020-05-04 09:14:52 +01:00
catbref
71e80bd02f Convert to Account.modifyAssetBalance()
Change code of the form (assetId aspect not shown):

account.setConfirmedBalance( account.getConfirmedBalance(), amount )

to:

account.modifyAssetBalance( amount )

Also tidied "0 - value" to use unary negate: "- value"
2020-05-04 08:45:31 +01:00
catbref
800103225b Remove pointless "return" in DeployAtTransaction 2020-05-04 08:18:59 +01:00
catbref
cfb7a3cc4c Minor terminology correction in GenesisBlock 2020-05-04 08:18:33 +01:00
catbref
3185cf23df Replace throwing IllegalStateException with more defensive log & null in Block/BlockMinter 2020-05-04 08:18:15 +01:00
catbref
3ac1b36549 Restrict API call POST /chat to prevent CPU abuse 2020-05-04 08:17:05 +01:00
catbref
55e99062ca CHAT PoW difficulty now much greater if sender has no QORT balance 2020-05-01 11:01:52 +01:00
catbref
edb56b74da Merge branch 'chat' into launch 2020-05-01 10:51:38 +01:00
catbref
233ace23de AT transactions now either have null message or null amount&assetId.
AT transaction transformer changed to refuse to deserialize AT transactions,
as they should never appear on the wire.

Ditto for GENESIS transactions.
2020-05-01 10:42:32 +01:00
catbref
e1f3b9a7a3 Update QortalATAPI.putTransactionAfterTimestampIntoA() to use Transaction.getRecipientAddresses 2020-05-01 10:20:25 +01:00
catbref
6be88ac86e In BTCACCT, use Account to fetch balance instead of direct from DB 2020-05-01 10:19:28 +01:00
catbref
d03cca2e76 Merge branch 'BTC-ACCT' into launch 2020-05-01 10:09:54 +01:00
catbref
e86143426b Fix potentially overflowing multiply in Block reward processing.
Change BlockChain config to use AmountTypeAdapter instead of
creating duplicated long versions of BigDecimal values.

Some tidying to Amounts class.
2020-05-01 08:57:15 +01:00
catbref
a309f8de9e Fix dead code warning in Account 2020-05-01 08:56:49 +01:00
catbref
df15f81b9f Fix whitespace 2020-05-01 08:56:27 +01:00
catbref
6ab50e4dff Fix some SonarLint complaints 2020-05-01 08:56:03 +01:00
catbref
476d9e4c95 Converted tests from BigDecimal to long
Moved Asset.MULTIPLIER, etc. to Amounts class.

Had to reintroduce BigInteger for asset trading code.
Various helper methods added to Amounts class.

Payment.process/orphan no longer needs unused transaction
signature or reference.

Added post block process/orphan tidying, which currently deletes zero account balances to satisfy post-orphan checks in unit tests.

Fix for possible bug when orphaning TRANSFER_PRIVS.

Added RewardSharePercentTypeAdapter like AmountTypeAdapter.

Replaced a whole load of JAXB-special getters with type-adapters.

Tests looking good!
2020-05-01 08:41:35 +01:00
catbref
9eaf31707a Massive conversion from BigDecimal to long.
Now possible thanks to removing Qora v1 support.

Maximum asset quantities now unified to 10_000_000_000,
to 8 decimal places, removing prior 10 billion billion
indivisible maximum.

All values can now fit into a 64bit long.
(Except maybe when processing asset trades).

Added a general-use JAXB AmountTypeAdapter for converting
amounts to/from String/long.

Asset trading engine split into more methods for easier
readability.

Switched to using FIXED founder block reward distribution code,
ready for launch.

In HSQLDBDatabaseUpdates,
QortalAmount changed from DECIMAL(27, 0) to BIGINT
RewardSharePercent added to replace DECIMAL(5,2) with INT

Ripped out unused Transaction.isInvolved and Transaction.getAmount
in all subclasses.

Changed
  Transaction.getRecipientAccounts() : List<Account>
to
  Transaction.getRecipientAddresses() : List<String>
as only addresses are ever used.

Corrected returned values for above getRecipientAddresses() for
some transaction subclasses.

Added some account caching to some transactions to reduce repeated
loads during validation and then processing.

Transaction transformers:

Changed serialization of asset amounts from using 12 bytes to
now standard 8 byte long.

Updated transaction 'layouts' to reflect new sizes.

RewardShareTransactionTransformer still uses 8byte long to represent
reward share percent.

Updated some unit tests - more work needed!
2020-05-01 08:40:32 +01:00
catbref
e0007269b9 Initial attempt at transient CHAT transaction type.
CHAT transactions don't ever get included into a block.
They use a memory-intensive proof-of-work instead of a fee.
Reference field isn't checked but must be present.
Recipient is optional.
isText/isEncrypted as per MESSAGE, basically indicative flags only.

Some API support.

Memory PoW takes roughly 800ms on Ryzen 3600, maybe 2400ms on QORTector?
2020-04-28 16:45:09 +01:00
catbref
0006911e0a Account lastReference cache, now with Block support.
As this changes how lastReferences are checked and updated,
this is not suitable for rolling into current chain without a
"feature trigger", or chain restart!

Added unit tests.
2020-04-27 16:07:00 +01:00
catbref
e141e98ecc Interim commit with new AccountRefCache, but no tests and no Block support 2020-04-27 16:07:00 +01:00
catbref
40531284dd Convert old "genesis account" addresses in blockchain configs to new "null account" address 2020-04-27 16:06:47 +01:00
catbref
9e2663b11b Fixed old Qora v1 "GenesisAccount" by replacing with NullAccount
NullAccount has 'empty' public key (32 bytes of zeros) compared
with GenesisAccount's vague sometimes 8 bytes, sometimes 32 bytes
public key.

NullAccount has static public key and address, plus overridden
methods to speed up pointless calls like verify().

Genesis Block also tidied up, dropping old Qora v1 compatibility
and using proper block signature and public key to generate
minter's block signature.

Genesis Block transaction processing also simplified, with no need
to access repository to handle fake references, due to new
last-reference code (which will need to be merged).

Dropped support for old, broken RMD160 code.
2020-04-27 16:06:47 +01:00
catbref
2602bb01e1 Limit both divisible & indivisible asset quantites to 1e10 (with 8dp) to fit into 8byte long 2020-04-27 16:04:19 +01:00
catbref
ac15dfe789 Removed broken MD160 support in Crypto 2020-04-27 15:33:23 +01:00
catbref
cd066cf357 Remove more old Qora v1 compatibility code 2020-04-27 15:33:23 +01:00
catbref
bd521baade Removed code for providing compatibility with Qora v1
Qortal is never going to continue off the old Qora blockchain,
so removed all code regarding compatibility.

Removals include:
* various blockchain "feature triggers"
* special Qora-only broken code for various transaction signatures
* "old" asset pricing / trading
* pre-group txGroupId field in transactions
* compatibility unit tests

Possibly safe for roll-out on pre-genesis blockchain?
2020-04-27 15:33:23 +01:00
catbref
136188339d Combined account balance fixes needed for unit tests 2020-04-27 15:33:09 +01:00
catbref
48de33fe24 More informative error messages when parsing blockchain config 2020-04-27 15:26:55 +01:00
catbref
df4798e2a1 Networking improvements: cached known peers, fewer DB accesses, EPC spawn-failure hook 2020-04-24 16:57:20 +01:00
catbref
edb842f0d1 Correct field ordering in layout docs for TRANSFER_ASSET 2020-04-24 15:31:41 +01:00
catbref
b563fe567d Add missing field (poll owner's address) to layout docs for CREATE_POLL 2020-04-24 15:31:02 +01:00
catbref
b3dd0d89df Add missing field (group owner's address) to layout docs for CREATE_GROUP 2020-04-24 15:07:19 +01:00
catbref
f1e4528581 Fix Transaction.calcRecommendedFee() 2020-04-24 09:40:43 +01:00
catbref
1375372380 Added tests to cover validity checks on group min/max block delay values 2020-04-23 17:06:23 +01:00
catbref
a7d0ad27b1 Legacy QORA block reward fix
If there's no more unrewarded legacy QORA held,
then quickly return from Block.distributeBlockRewardToQoraHolders()
instead of causing divide-by-zero.
2020-04-23 17:00:08 +01:00
catbref
833a785996 More work on Bitcoin-side of cross-chain trading.
Tidied up duplicated cross-chain API code that
fetched Qortal AT info.

Added Bitcoin-related cross-chain API calls
for building, checking, refunding and redeeming
P2SH.

Added new Bitcoin-related API error codes.

Controller now starts up, and shuts down, bitcoinj.

Speed-up in BTC class so bitcoinj doesn't have
to throw away all peers and rediscover & reconnect
to them with every chain-related call.
2020-04-23 09:13:32 +01:00
catbref
94d18538d8 More work on cross-chain trading, including API calls.
Added API calls to aid Qortal-side of cross-chain trading.
POST /crosschain/build - for building Qortal AT
POST /crosschain/tradeoffer/recipient - for sending trade partner/recipient to AT
POST /crosschain/tradeoffer/secret - for sending secret to AT
DELETE /crosschain/tradeoffer - for cancelling AT

More fixes regarding Blocks processing/orphaning ATs.
More fixes regarding sending/receiving blocks containing AT data.
AT-related fix to genesis block.

Improved cross-chain trading AT code, removing offer-mode timeout
and replacing that with allowing AT creator to cancel offer/end AT
by sending AT the creator's own address as trade partner/recipient.
After all, they're not going to trade with themselves.

Added assertion to check BTCACCT.CODE_BYTES_HASH matches compiled code hash.

Added cross-chain AT's 'mode' for easier diagnosis, either OFFER or TRADE.

We can't use AT's signature to generate AT address because address is needed
before DEPLOY_AT transaction is signed. So we use a hash of signature-less
transaction bytes.

Corresponding changes to tests.
2020-04-23 09:13:32 +01:00
catbref
8baf42765e Improved cross-chain AT and more API support for same.
Reworked the cross-chain trading AT so it is now 2-stage:
stage 1: 'offer' mode
waiting for message from creator containing trade partner's address
stage 2: 'trade' mode
waiting for message from trade partner containing secret

Adjusted unit tests to cover above.

Changed QortalATAPI.putCreatorAddressIntoB from storing
creator's public key to actually storing creator's address.

Refactored BTCACCT.AtConstants to CrossChainTradeData.

Now we also store hash of AT's code bytes in DB so we can look up
ATs by what they do. Affects ATData class, ATRepository, etc.

Added "Automated Transactions" and "Cross-Chain" API sections.

New API call GET /at/byfunction/{codehash} for looking up ATs
by what they do, based on hash of their code bytes.

New API call GET /at/{ataddress} for fetching info for specific AT.

New API call GET /at/{ataddress}/data for fetch an AT's data segment.
Mostly for diagnosis of AT's current state.

New API call POST /at for building a raw, unsigned DEPLOY_AT transaction.

New API call GET /crosschain/tradeoffers for finding open BTC-QORT trading ATs.
2020-04-23 09:13:32 +01:00
catbref
98506a038b Loads of work on CIYAM AT support, including BTC-QORT cross-chain trading.
We require AT v1.3.4 now!

Updated AT-related logging.

Added "isInitial" flag to AT state data so that state data created at
deployment is not added to serialized block data.

Updated BTC-QORT AT code and tests to cover various scenarios.

Added missing 'testNtpOffset' to various test versions of 'settings.json'.
Added missing 'ciyamAtSettings' to various test blockchain configs.

Loads of AT-related additions/fixes/etc. to core code, e.g Block
2020-04-23 09:13:32 +01:00
catbref
3eaeb927ec More work on QORT-BTC ACCT
Requires fix in CIYAM AT v1.3.2

New version of Qortal cross-trade AT code.

Change how Qortal addresses are managed in QortalATAPI from using
base58 strings (that are too long) to using hex form (25 bytes)
as they need to fix into 32 byte A/B register.

Generate AT addresses using DeployAtTransaction's signature instead
of convoluted hash of AT data like name, description, etc.

Add startTime as arg to GetTransaction test app.

Add missing fields (name, description, ATType, tags) to DeployAT test app.
2020-04-23 09:13:32 +01:00
catbref
7ded8954c6 Fix Transaction.calcRecommendedFee() 2020-04-23 09:13:32 +01:00
catbref
d2eb8b0c2b Legacy QORA block reward fix
If there's no more unrewarded legacy QORA held,
then quickly return from Block.distributeBlockRewardToQoraHolders()
instead of causing divide-by-zero.
2020-04-23 09:13:32 +01:00
catbref
2ed2cc0fab Correct package names and minor clean 2020-04-23 09:13:32 +01:00
catbref
87bb9090f5 CIYAM AT & cross-chain trading.
Bump CIYAM AT requirement to v1.3

Remove multi-blockchain AT aspect for now (BlockchainAPI).

For PUT_PREVIOUS_BLOCK_HASH_INTO_A we no longer use SHA256 to condense 64-byte block signature into 32 bytes.
Now we put block height into A1 and SHA192 of signature into A2 through A4.
This allows possible future lookup of block data using "block hash", with verification that it is the same block.

Some AT functions use "address in B" but sometimes we populate B with account's public key instead.
So the method "getAccountFromB" is smart and checks for an actual, textual address in B starting with 'Q', otherwise assumes B contains public key.

The Settings field "useBitcoinTestNet" (boolean) now replaced with "bitcoinNet" (String) with possible values MAIN (default), TEST3, REGTEST.
This allows for more varied development/testing scenarios.

Use correct Bitcoin nSequence value 0xFFFFFFFE for P2SH, i.e. enable locktime, disable RBF.

Roll REGTEST checkpoints file generator into main BTC class.

Yet another rewrite of Bitcoin P2SH scripts for BTC-QORT cross-chain trading.
Added associated test classes BuildP2SH, CheckP2SH, DeployAT (unfinished).
2020-04-23 09:13:32 +01:00
catbref
8844cc0076 GetTransaction test app to demo fetching any bitcoin transaction using bitcoinj. Plus some AT-API work 2020-04-23 09:13:32 +01:00
catbref
2c4bad6455 Interim commit of BTC-QORT cross-chain trade, with partial conversion from secret+hash to using "trade key" 2020-04-23 09:13:32 +01:00
catbref
5c0134c16a work in progress: btc-qort cross-chain trades
Streamlined BTC class and switched to memory block store.

Split BTCACCTTests into BTCACCT utility class and (so far)
three stand-alone apps: Initiate1, Refund2 and Respond2

Moved some Qortal-specific CIYAM AT constants into blockchain config.

Removed redundant BTCTests
2020-04-23 09:13:32 +01:00
catbref
369a45f5c0 BTC-ACCT progress
Bump bitcoinj to 0.15.5 for fixes.

lockTime is int (seconds since epoch), not long (ms since epoch).

Improve output of Initiate1.

Added (most of) Respond2.
2020-04-23 09:13:31 +01:00
catbref
d58b7c1f53 Work on BTC-ACCT
Bump CIYAM AT dependency to v1.2 for MachineState.toCreationBytes()
2020-04-23 09:13:31 +01:00
catbref
5011a2be22 Added isAdmin field to output of API call GET /groups/member/{address} 2020-04-22 16:32:55 +01:00
catbref
33010f82d8 No need to check AT transactions in Block.areTransactionsValid() 2020-04-16 13:16:30 +01:00
catbref
8dbd8c4e65 Performance improvement when checking block's online accounts signatures.
If the timestamp-pubkey-sig is still 'current' then it'll be in
Controller's list of current online accounts, so we can quickly scan
that list before falling back to the more expensive Ed25519 verify.

Added equals() and hashCode() to OnlineAccountData to support above.
2020-04-16 12:25:01 +01:00
catbref
c2a3c1271c Remove missed, extraneous last-reference check from CreateAssetOrderTransaction.isValid() 2020-04-16 09:24:04 +01:00
catbref
1e9a7ac87d Update SysTray for all synchronizing scenarios.
When synchronizing is forced via API call, the SysTray doesn't update
to reflect this.

We fix this by moving the SysTray updating code from
Controller.potentiallySynchronize() to the inner method
Controller.actuallySynchronize(), which is also the method called
directly by the API.
2020-04-15 17:36:12 +01:00
catbref
e25d24964c Make BlockMinter more aggressive about obtaining blockchain lock.
Previously BlockMinter & Synchronizer would both try opportunistic
locking, with no wait/timeout or fairness.

This could lead to a situation where a majority of nodes are
synchronizing, albeit only the top 1 or 2 blocks, but no node
manages to mint within the 'recent' period, so the chain stalls.

However, if a node is at/near the top of the chain then synchronization
shouldn't take very long so we let BlockMinter wait until to 30s
(approx. half typical block time) to obtain lock.

This makes minting blocks more likely in a BlockMinter/Sync fight
which helps keep the chain going.

Detecting chain stalls, and allowing minting if we have plenty of peers,
also produces blockchain 'islands' so isn't a simple fix at this point.
2020-04-15 17:30:49 +01:00
catbref
d90d84ab06 More descriptive tray mouseover, showing sync percent or connecting status
Added sync percent to API call GET /admin/status

Added SysTray i18n "CONNECTING" key to CheckTranslations test app.
2020-04-03 08:31:41 +01:00
catbref
fa1aa1c8b2 Show informative page instead of "Forbidden" when user tries to access API documentation when disabled. 2020-03-30 17:39:36 +01:00
catbref
9156325ffc Reduce minimum networking requires to relax CPU usage somewhat 2020-03-30 17:39:36 +01:00
catbref
70131914b2 Auto-updates: increase checking interval & TCP timeouts
Bumped TCP timeouts for fetching auto-update from 5s (connect) and
3s (read) to 30s (connect) and 10s (read) to allow for nodes with
slower internet connections.

Increased interval between checking for auto-updates from 5 minutes
to 20 minutes to reduce load on update sources and also to reduce
the number of nodes that restart at any one time.

Obviously this new checking interval will only apply after the NEXT
auto-update...
2020-03-30 17:39:36 +01:00
catbref
bd87e6cc1a Increase retry interval and count in ApplyUpdate.
Used when checking that node has shutdown and when replacing old JAR with new update.

ApplyUpdate previously waited 5 seconds between checks/retries, for up to 5 times: 25 seconds.
Now waits 10 seconds, for up to 12 times: 120 seconds.
Hopefully this will give slower nodes enough time to shut down and prevent errors like these on Windows installs:

2020-03-24 12:05:50 INFO  ApplyUpdate:114 - Unable to replace JAR: qortal.jar: The process cannot access the file because it is being used by another process.
2020-03-30 17:39:36 +01:00
catbref
6c8e96daae Turn off repository backups by default.
They can be re-enabled by setting "repositoryBackupInterval" to a
non-zero value in settings.json. Note the value is in milliseconds!
2020-03-30 17:39:36 +01:00
catbref
cfb8f53849 Reduce DB space taken up by Blocks 2020-03-30 17:39:36 +01:00
catbref
7bb2f841ad Rip out historic account balances as they take up too much DB space. 2020-03-30 17:39:36 +01:00
catbref
edee08a7b5
Merge pull request #1 from nitrokrypt/master
Fixed Images
2020-03-30 11:25:34 +01:00
catbref
72c299a331 Add SysTray notification for DB backup. More translations.
Added a setting "showBackupNotification", which is false by default,
that shows a tray notification when a repository backup occurs.

Above notification, and the auto-update notification, now refer to
the SysTray i18n translation lookup resources.
2020-03-24 09:26:40 +00:00
catbref
0b42a7ad63 Modify minOutboundPeers, maxPeers and maxNetworkThreadPoolSize default settings
Typical users don't need quite so many connections, so minOutboundPeers and
maxPeers reduced accordingly.

maxNetworkThreadPoolSize increased from 10 to 20.
2020-03-24 09:24:22 +00:00
catbref
51e59f6ab7 Change HSQLDB repository log fsync() interval from 500ms to 5s 2020-03-24 09:23:17 +00:00
catbref
38394de661 Reduce peer response timeout from 5s to 2s
5s is way too long, and even 2s might still be considered excessive.
However, reducing the timeout might also reduce the number of
network engine "spawn failures" due to too many threads tied up
waiting for ping responses from overloaded peers.

Does not affect peer handshaking: that has a separate timeout.
2020-03-24 09:20:50 +00:00
catbref
22f9755f4f Performance optimizations. Accounts/NTP/System.currentTimeMillis, etc.
Added Ed25519 private key to public key function accessible from SQL.
Added Ed25519 public key to Qortal address function accessible from SQL.

Used above functions to store minting account public key in SQL to
reduce the number of unnecessarily repeated Ed25519 conversions.

Used above functions to store reward-share minting's accounts address
to reduce the number of unneccessarily repeated PK-to-address conversions.

Reduced the usage of PublicKeyAccount to simply Account where possible,
to reduce the number of Ed25519 conversions.

Account.canMint(), Account.canRewardShare() and Account.getEffectiveMintingLevel()
now only perform 1 repository fetch instead of potentially 2 or more.

Cleaned up NTP main thread to reduce CPU load.
A fixed offset can be applied to NTP.getTime() responses, for both
scenarios when NTP is running or not. Useful for testing or simulating
distant remote peers.

Controller.onNetworkMessage() and Network.onMessage() have both had their
complexity simplified by extracting per-case code to separate methods.

Network's EPC engine's thread pool size no longer hard-coded, but comes
from Settings.maxNetworkThreadPoolSize, which is still 10 by default,
but can be increased for high-availability nodes.

Network's EPC task-producing code streamlined to reduce CPU load.

Generally reduced calls to System.currentTimeMillis(), especially
where the value would only be used in verbose logging situations,
and especially in high-call-volume methods, like within repository.
2020-03-23 11:14:05 +00:00
catbref
4cb2e113cb Log (and discard) duplicate outbound connections to the same peer 2020-03-23 11:07:08 +00:00
catbref
e0f024ef5c Performance improvements in networking ExecuteProduceConsume engine
Keep track of when EPC engine can't spawn a new thread as this
might indicate thread-pool exhaustion and cause some network
messages to be lost.

If logging level is NOT 'trace' (or 'all') then don't call
System.currentTimeMillis() as we'll never use the value.

Similarly, don't set thread names if not logging at 'trace' either.

Update EPC tests, particularly unified per-second/end-of-test stats
reporting.
2020-03-23 11:00:19 +00:00
catbref
f95cb99cdc Add support for logging PROOF network message calculation time 2020-03-23 10:57:23 +00:00
catbref
1f0170bb4b Increase timeout for transaction submission via API POST /transactions/process from 500ms to 30s 2020-03-23 10:54:35 +00:00
catbref
d7c26c27e1 Add debugging message to Peer regarding lost PING replies 2020-03-19 14:29:47 +00:00
catbref
2d18dd62eb Translation / API response improvements 2020-03-19 14:21:48 +00:00
catbref
51fd177d79 Add access to network engine stats
Added API call GET /peers/enginestats to allow external monitoring.

Extract all engine stats in one synchronized block, instead of
separate calls, for better consistency.
2020-03-19 11:19:49 +00:00
catbref
c4643538f1 Improve Synchronizer to reduce network load
Synchronizer now bails out early when trying to find common block with
a peer. There's no need to keep searching if common block is too far
behind that a TOO_DIVERGENT result would be returned.

fetchSummariesFromCommonBlock() reworked to return a useful
SynchronizationResult directly instead of caller trying to infer
what happened based on null/empty returned list!
2020-03-19 11:11:35 +00:00
catbref
0edadaf901 Remove warning 2020-03-19 11:11:05 +00:00
catbref
c05533fb71 Fix comment 2020-03-19 11:10:40 +00:00
catbref
db270f559f Improve minting/syncing status reporting
Added API call GET /admin/status which reports whether minting
is possible (have minting keys & up-to-date) and whether node is
currently attempting to sync.

Corresponding change to system tray mouseover text.

Corresponding text added to SysTray transaction resources.
2020-03-19 11:07:56 +00:00
catbref
79f7f68b0c Change when BlockMinter decides it's ok to mint a block
Previously BlockMinter would attempt to mint if there were at least
'minBlockchainPeers' connected peers and none of them had an
up-to-date block and we did. This was maybe useful for minting block 2
but possibly causes minting chain islands where a badly connected
node mints by itself, even though connected to not up-to-date peers.

Now BlockMinter requires 'minBlockchainPeers' up-to-date peers, not
simply just connected. This should let synchronization bring the
node up-to-date but does require the node to have better peers.

Currently, the default for minBlockchainPeers is 10. So a node
requires 10 up-to-date peers before it will consider minting. It
might be possible to reduce this in the future to lessen network load.
2020-03-19 10:58:53 +00:00
catbref
d30d61edab Reworking/speed-ups for block rewards & general account DB manipulation
**NOTE** currently under wider test - maybe not be final version!
2020-03-18 18:04:45 +00:00
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
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
nitrokrypt
bf288dbfc2 Fixed Images
Previous images had a small hole in the icon (probably a result of a background removal), I just filled it back in with white like it's supposed to be. Also, the previous square icons were streched into a square aspect ratio, these are unstreched.
2020-03-12 12:01:24 -05: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