Commit Graph

370 Commits

Author SHA1 Message Date
catbref
d1d45b12f7 Added unit test to check initial proxy reward share of 0% is invalid 2019-08-02 13:06:16 +01:00
catbref
9af18aad34 Setting proxy forging reward share to 0% removes proxy forging relationship.
Included unit test to cover change.
Modified test blockchain config "test-chain-v2.json" to add maxProxyRelationships.

Added comments to some proxy-related methods in AccountRepository class.
2019-08-02 13:05:56 +01:00
catbref
46dc91e5a0 Bump HSQLDB from svn r5970 to release v2.5.0 2019-08-02 13:05:18 +01:00
catbref
ae6cf9fc32 Fix ordering when requesting summary of block forgers 2019-08-02 13:04:48 +01:00
catbref
4f25fffbe9 Change API transaction subsmission from single-shot to 500ms timeout for obtaining blockchain lock 2019-08-02 13:04:21 +01:00
catbref
03f60ef898 Fix incorrect declared transaction length for SET_GROUP and VOTE_ON_POLL transactions.
Added transaction [de]serialization test, along with corresponding random transaction generators.

Minor typo fix in Transaction.

Minor clarification in MessageTransactionTransformer.

Added debugging to Account.
2019-08-02 13:03:54 +01:00
catbref
02e8bdb034 Add support for fetching updates using a combination of hostname and IP address.
IP address used to create socket, hostname used for SNI, HTTPS, etc.

Added hostname+IP auto-update locations to Settings.
2019-08-02 12:53:49 +01:00
catbref
8dd4745c5c Work on auto-update
Arbitrary transactions now [de]serialize data-type (raw/hash) for v4+ transactions.
Data type also stored in repository. Very small (<=255 byte) data payloads are also stored directly in HSQLDB.

Added ArbitraryDataManager which looks for hash-only data payloads and possibly requests raw data over network
depending on 'policy' (which currently is "fetch everything").

Added networking support for finding, and transferring, arbitrary data payloads.

Minor optimization to message ID generation in Peer.

Minor optimization in Serialization.serializeSizedString()
2019-08-02 12:48:48 +01:00
catbref
4ced9cc3e2 More flexible auto-update locations 2019-08-02 12:44:52 +01:00
catbref
1d7bda5d46 Don't propagate new transactions back to sending peer. Added small inter-peer delay when doing network broadcast. 2019-08-02 12:42:30 +01:00
catbref
c2e8392f05 Synchronization improvements (again!)
Bumped version

Controller no longer uses block height to determine whether to sync
but now uses peer's latest block's timestamp and signature.

Also BlockGenerator checks whether it's generating in isolation using
the same peer info (latest block timestamp and signature).

Added API call POST /admin/forcesync peer-address to help get wayward
nodes back on track.

Unified code around, and calling, Transaction.importAsUnconfirmed().

Tidied code around somelock.tryLock() to be more readable.

Controller (post-sync) now broadcasts new chaintip info if
our latest block's signature has changed, not simply the height.

Network.broadcast() only sends out via outbound peer if node has
more than one connection from the same peer. So Controller would
only update one of the peer records with chaintip info.
Controller now updates all connected peers with the ID when it
receives a HEIGHT or HEIGHT_V2 message.

Added node1 thru node7.mcfamily.io to default peers in Network.

Network ignores first "listen port" entry when receiving peers
list from an outbound-connection peer as it already knows
by virtue of having connected to it!

More network message debug logging (hopefully never to be seen).

[some old code left in, but commented out, for a while]
2019-07-23 17:50:07 +01:00
catbref
d910cce807 Improve API peer info output 2019-07-23 17:38:56 +01:00
catbref
20200b844e Networking and synchronization improvements
Controller now sets (volatile) requestSync flag when a peer sends new height info.
This allows much quicker response to new blocks which might hopefully improve synchronization
compared with the old periodic sync method.

"Unsolicited" network messages are now added to a BlockingQueue,
and a separate unsolicited message processing thread (one per peer)
deals with this messages in turn.
This allows "reply" network messages to propagate up to the
threads that are waiting for them, preventing deadlocks and
peer disconnections due to lost pings.

Controller tries to do as much new transaction processing
outside of the blockchain lock as possible, and only
broadcasts new transaction's signature if we successfully
import transaction to our unconfirmed pile.

Synchronizer.findSignaturesFromCommonBlock now returns null
to indicate some sort of connection issue (no cool-off)
and an empty list to indicate NO COMMON BLOCK.
That method also tries to work back to genesis block
instead of giving up too early if test block height
becomes negative.

Network.createConnection additionally filters out
candidates if their addresses resolve to the same
IP+port as an existing connection. So now it won't
connect to localhost:1234 if it has an existing
connection with 127.0.0.1:1234.

Network.broadcast only considers unique peers,
i.e. prefers outbound connection if a peer has
corresponding inbound connection.

Added Thread.currentThread().setName() where possible.
2019-07-23 17:32:21 +01:00
catbref
ffffb50884 Networking/Controller changes to aid broadcast of unconfirmed transactions.
Notably: network messages passed up to Controller are now processed in their
own thread, as opposed to peer's thread.
So each message processor in Controller needs to thread-safe.

V2 network protocol asks for unconfirmed transactions, can send round lists
of transaction signatures and ask for individual transactions, to save
bandwidth/processing.
2019-07-23 17:28:20 +01:00
catbref
680361daa6 Temporary fix to Controller to only try to acquire blockchain for incoming new unconfirmed transactions 2019-07-23 16:19:01 +01:00
catbref
c03a5c3d0e Fix incorrect count of forged blocks 2019-07-23 16:18:24 +01:00
catbref
b7f53afe68 Improve API output for GET /peers 2019-07-23 16:18:01 +01:00
catbref
3a3cc5a81b Improve API output of GET /blocks/forgers 2019-07-23 16:17:42 +01:00
catbref
97a5b3ef9b Increase max proxy relationships in blockchain config 2019-07-23 16:17:19 +01:00
catbref
5429cb12dd Possible fix for single instance check by AI Windows launcher 2019-07-23 16:13:51 +01:00
catbref
2f3123a315 Add lock around some Peer.peerData actions to help sync 2019-07-23 16:06:04 +01:00
catbref
6a969f9473 Add limit to number of proxy forging relationships per generator account.
For testing, current limit is 4 as set in blockchain.json
2019-07-23 16:05:21 +01:00
catbref
de96e8347d Move handling of GET_PEERS from Controller to Network. On sync fail, only update outbound peer info in repository to help prevent useless 'known peer' entries. 2019-07-23 16:02:32 +01:00
catbref
dcb8d67236 Don't allow new transactions to be submitted if not up to date 2019-07-23 15:59:01 +01:00
catbref
491a6ecd67 Fix incorrect declared transaction length for create-group transactions 2019-07-23 15:46:42 +01:00
catbref
9ac52f6a86 Fix missing network-related repository.saveChanges() 2019-07-23 15:45:04 +01:00
catbref
7993c3e594 Change node UI start URL to index.html 2019-07-23 15:43:08 +01:00
catbref
921953d304 Clean up inbound peer entries from repository & fix sending peer lists 2019-07-23 15:36:14 +01:00
catbref
912ec22417 Minor warning fix 2019-07-23 15:26:52 +01:00
catbref
a2cc4983a0 Add "involved" optional query param to API call GET /address/proxying, for convenience 2019-07-23 15:26:26 +01:00
catbref
e42c3e60bc Added mock-up of node management UI 2019-07-23 15:24:36 +01:00
catbref
ab9fd681f3 Fix synchronizer so incoming block's transactions have approval status set 2019-07-23 15:13:59 +01:00
catbref
4667b768df Added tests for each group-approval outcome + fixes 2019-07-23 15:13:28 +01:00
catbref
c9f226cf88 group approval tests and fixes 2019-07-23 15:12:35 +01:00
catbref
8af761c1c3 Updated orphaning code of Block and Transaction subclasses 2019-07-23 15:10:43 +01:00
catbref
4b3f877dc0 Interim commit - refactored transaction transformers and fixed unit test compiler errors 2019-07-23 15:06:28 +01:00
catbref
06ba004238 Interim commit - refactored HSQLDBTransactionRepository, and subclasses. Also added approval_height to transactions, renaming height to block_height. 2019-07-23 14:50:56 +01:00
catbref
431e15c7ae interim commit after refactoring TransactionData, and subclasses 2019-07-23 14:49:41 +01:00
catbref
da1bd82c19 Minor integration progress
Remove fetching unconfirmed from Synchronizer

Add extra validity/reference/processable checks to
Transaction.isValidUnconfirmed

Update TransactionUtils to use Transaction.importAsUnconfirmed
for unit tests.
2019-07-23 14:48:49 +01:00
catbref
9bb673ba82 Interim commit of *Transaction refactoring
Transaction subclass isValid methods have last reference checks removed.
(Now handled by Transaction.hasValidReference)

Some checks in subclass' isValid moved to isProcessable, typically
for transaction types that require group-approval.

Removed fee extraction and last-reference update code from
subclass' process() method to Transaction.processReferencesAndFees.

Other changes to transaction/block processing.
2019-07-23 14:46:44 +01:00
catbref
c9968b3dd2 Interim commit of *TransactionData classes for safety 2019-07-23 14:42:02 +01:00
catbref
041773cf41 Synchronizer asks for approval-pending transaction from peer if needed 2019-07-23 12:49:38 +01:00
catbref
c83d888a7d Demo HTML/JS page to show encrypted local storage of private key 2019-07-23 12:48:47 +01:00
catbref
3f2453e404 ApiError zh locale (but untranslated) 2019-07-23 12:47:52 +01:00
catbref
414f9679c8 Synchronizer logging improvements 2019-07-23 12:47:20 +01:00
catbref
cd5f9a1e6c Convert ClassLoader.getSystemResource* calls to class.getResource* variant for OSGi, etc. safety 2019-07-23 12:46:27 +01:00
catbref
94fceeb34a Move default blockchain.json into resources 2019-07-23 12:46:05 +01:00
catbref
a4f2cf50b0 Updated node management UI (was previously "bundled ui")
Fix root path redirects for node management UI and API documentation servlets.
2019-07-23 12:44:10 +01:00
catbref
f4022dd243 initial work on adding bundled node-management UI 2019-07-23 12:37:42 +01:00
catbref
99024ee2ef Synchronization improvements
Don't attempt to sync, or generate blocks, if we think we're not up to date.

Notify Controller of newly generated block AFTER releasing blockchain lock.

Loads of changes to synchronizer.

Added missing GET_PEERS handling to Controller.onNetworkMessage.

More detailed peer information (last block sig, last generator sig, last block timestamp, ...)
New HEIGHT_V2 network message to help support above.

More, and improved, logging.

Fix for HSQLDB serialization failure caused by trying to save the same new transaction
received by more than one peer/thread simultaneously.
2019-07-23 12:22:17 +01:00