Commit Graph

2062 Commits

Author SHA1 Message Date
CalDescent
a4e82c79cc Completed implementation of relay mode
The procedure outlined in commit f4b06fb is now incorrect. Updated procedure:

- A node can opt into relay mode via the "relayModeEnabled":true setting.
- From this time onwards, they will ask their peers if they ever receive a file list request that they cannot serve by themselves.
- Whenever a peer responds with a file list, it is forwarded on to the originally requesting peer, complete with the peer address of the node that responded. Currently, only the first response is forwarded, but we may later decide to forward all responses.
- As well as forwarding, the relay peer keeps track of the peers that report to be holding hashes (these mappings are held for 30 seconds).
- The originally requesting peer can then make a request to the relay peer for the data file(s).
- The relay peer uses the mapping to forward the request on to another peer, and then forwards the response (i.e. the data file) back to the peer that originally requested the file.
2021-12-15 12:15:31 +00:00
CalDescent
bcc89adb5f Removed "peerAddress" from ArbitraryDataFileListMessage (introduced in recent commit)
It's best that the source peer's address isn't exposed to the requesting peer. The relay peer can keep track of this mapping itself.

The only real issue with this approach is that we can't use data from ArbitraryDataFileListMessage to update our ArbitraryPeers data, because we can't distinguish between relay peers and hosting peers. But this isn't something we currently do anyway, as we have the ARBITRARY_SIGNATURES message type to take care of updating ArbitraryPeers mappings.
2021-12-15 11:40:54 +00:00
CalDescent
a41c9e339a Fixed occasional NPE 2021-12-15 11:31:12 +00:00
CalDescent
feeca77436 Added directDataRetrievalEnabled setting (default true)
Setting this to false prevents new connections being made to peers that report to have the data that is needed. This is likely only useful for testing, as disabling it in production would reduce the success rate of data retrieval.
2021-12-15 11:29:49 +00:00
CalDescent
fcce12ba40 Added missing code from last commit. 2021-12-15 11:28:34 +00:00
CalDescent
f4b06fb834 Added relay mode for file list requests
This reuses most of the code already in place in the core related to forwarding.

- A node can opt into relay mode via the "relayModeEnabled": true setting
- From this time onwards, they will ask their peers if they ever receive a file list request that they cannot serve by themselves
- Whenever a peer responds with a file list, it is forwarded on to the originally requesting peer, complete with the peer address of the node that responded
- The original peer can then make a request for the data file(s) themselves using a similar approach, specifying the IP address of the ultimate peer so that the relay node knows who to ask. This part is not implemented yet.
2021-12-12 10:51:24 +00:00
CalDescent
e7fd803d19 Updated AdvancedInstaller project for v2.1.2 2021-12-11 22:16:43 +00:00
CalDescent
3b96747871 Bump version to 2.1.2 2021-12-11 21:50:54 +00:00
CalDescent
33088df07d Revert "Bump log4j-api version to 2.15.0"
This reverts commit 6a9904fd43.
2021-12-11 19:40:44 +00:00
CalDescent
a215714b6b Set log4j2.formatMsgNoLookups to true 2021-12-11 19:09:25 +00:00
CalDescent
6a9904fd43 Bump log4j-api version to 2.15.0
The main log4j version cannot be increased yet due to some incompatibilities with the Qortal code.
2021-12-10 17:54:11 +00:00
CalDescent
cc297ccfcd Removed the word "service" from all settings, to avoid confusion with arbitrary data services.
Updated setting names:

domainMapServiceEnabled -> domainMapEnabled
domainMapServicePort -> domainMapPort
gatewayServiceEnabled -> gatewayEnabled
gatewayServicePort -> gatewayPort
2021-12-10 12:29:33 +00:00
CalDescent
c7c88dec04 Attempt to differentiate between resources that are downloading, and ones where downloading hasn't been attempted yet. 2021-12-10 12:22:26 +00:00
CalDescent
e481a5926a Use "blocked" instead of "blacklisted", for consistency with the buttons and terminology in the UI 2021-12-10 11:34:10 +00:00
CalDescent
0464245218 Simplified lists feature to be referenced by a single name, instead of the confusing "category" and "resourceName" properties.
This makes them extremely generic, improves filenames, and makes it easier to create custom lists. It doesn't have backwards support, but the lists feature isn't working properly in core 2.1+ anyway.
2021-12-10 11:33:26 +00:00
CalDescent
0001f31c06 Merge remote-tracking branch 'qortal/master' 2021-12-10 09:35:44 +00:00
CalDescent
391d31759a Fixed small issue in GET /crosschain/trades and GET /crosschain/tradeoffers APIs where 0 was being treated as zero instead of unlimited.
In 2.1.1, unlimited results can be requested by removing the `limit` query string parameter completely, e.g:

http://127.0.0.1:12391/crosschain/trades?foreignBlockchain=LITECOIN&minimumTimestamp=1638835200000&reverse=false
2021-12-08 20:22:02 +00:00
CalDescent
ed2f2435d2 Updated AdvancedInstaller project for v2.1.1 2021-12-08 19:32:36 +00:00
CalDescent
6e6b2ccfa0 Bump version to 2.1.1 2021-12-08 18:39:30 +00:00
CalDescent
be9a73560d Added one more node 2021-12-08 17:23:42 +00:00
CalDescent
e82b5a4ecf Added 7 qortalnodes.live nodes to the default list. 2021-12-08 16:10:50 +00:00
CalDescent
a27d8ac828 Connect ACCTv3 trade bots to the ACCTv3 smart contracts 2021-12-08 12:52:22 +00:00
CalDescent
6267258189 Switch over to ACCTv3 for new listings 2021-12-08 12:22:26 +00:00
CalDescent
e7527f532e Added LitecoinACCTv3 and DogecoinACCTv3 to SupportedBlockchain 2021-12-08 12:21:52 +00:00
CalDescent
8b6e74d505 Added ACCTv3 trade bots. Identical to v1 and v2. 2021-12-08 12:18:22 +00:00
CalDescent
e6106c0c4e Added ACCTv3 tests, based on the same criteria as ACCTv1. Refunds are working as intended. 2021-12-08 12:10:36 +00:00
CalDescent
f52bafc014 Removed second "SLEEP_UNTIL_MESSAGE" function code call in LitecoinACCTv3 and DogecoinACCTv3.
It turns out that when you call SLEEP_UNTIL_MESSAGE, the AT resumes from that very same line on the next execution. The original code incorrectly assumed that it would execute from the restart position (SET_PCS).

So sleeping can be thought of as pausing one execution half way through, rather than ending it.

This caused a bug, because once the AT receives a transaction it wakes up and resumes from the SLEEP_UNTIL_MESSAGE line, which is after the refund check. Even when it loops back around again it lands on labelRedeemTxnLoop = codeByteBuffer.position(); which is again after the refund check.

For now, the simplest fix is to only sleep when listed. We could have alternatively moved the SLEEP_UNTIL_MESSAGE above GET_BLOCK_TIMESTAMP, but this would still require users to send a random transaction to the AT to trigger the refund. Given that the ATs are only "alive" for 30 minutes once the trade begins, it's simpler to just execute every block and therefore allow the refunds to happen automatically.
2021-12-08 12:08:06 +00:00
CalDescent
9e0630ea79 Added LitecoinACCTv3 and DogecoinACCTv3 - at the moment identical to ACCTv2 2021-12-08 11:55:25 +00:00
CalDescent
968bfb92d0 Fixed bugs in the GET /crosschain/tradeoffers API endpoint caused by the introduction of ACCTv2 2021-12-07 22:32:46 +00:00
CalDescent
284c9fcee2 Fixed bugs in the GET /crosschain/price API endpoint caused by the introduction of ACCTv2 2021-12-07 21:20:08 +00:00
CalDescent
5b0b939531 Fixed bugs in the GET /crosschain/trades API endpoint caused by the introduction of ACCTv2 2021-12-06 20:14:08 +00:00
CalDescent
2efac0c96b Modified zip implementation to preserve filenames of single file resources.
Also modified the directory structure of single file resources to make them consistent with multi file resources.

For multi file resources, the original folder is renamed to "data", resulting in a layout such as:
data/file1.txt
data/file2.txt
data/dir1/file3.txt

For single file resources, the file is now moved into a "data" folder, like so:
data/file.txt

This is slightly unconventional, but is appropriate within the context of QDN to keep everything consistent.
2021-12-06 19:53:20 +00:00
CalDescent
dc52fd1dcf Only return OFFERING trades in GET /crosschain/tradeoffers 2021-12-06 19:37:30 +00:00
CalDescent
19240a9caf Removed duplicated strings in zip tests 2021-12-05 18:13:02 +00:00
CalDescent
4eef28f93d Added unit tests for zipping / unzipping 2021-12-05 17:38:53 +00:00
CalDescent
c6e5c4e3b5 Tidy up of storage thresholds and comments. Also reduced deletion threshold from 100% to 98% to reduce the chances of filling up the disk and corrupting the db. 2021-12-05 16:36:54 +00:00
CalDescent
007f567c7a Improved directory cleanup process to avoid leaving empty parent directories lying around. 2021-12-05 16:24:47 +00:00
CalDescent
ffe178c64c Delete directories in the data folder that have no associated transaction.
This adds support for "unconfirmable" data uploads, which will be useful for Q-Chat. It also handles cases where a transaction is orphaned and then subsequently becomes invalid.
2021-12-05 16:24:21 +00:00
CalDescent
c3835cefb1 Fixed bug relating to storage manager instances. 2021-12-05 14:42:12 +00:00
CalDescent
2c382f3d3f Fixed logging error. 2021-12-05 13:30:22 +00:00
CalDescent
b592aa6a02 Added custom validation for websites.
A website must contain one of the following files in its root directory to be considered valid:

index.html
index.htm
default.html
default.htm
home.html
home.htm

This is the first page that is loaded when loading a Qortal-hosted website.
2021-12-05 13:30:10 +00:00
CalDescent
57e82b62a1 Increased the capabilities of the service validation functions. 2021-12-05 13:03:22 +00:00
CalDescent
13f3aca838 Added GET /addresses/online/levels API endpoint to return the number of minters at each level 2021-12-04 19:28:28 +00:00
CalDescent
94b17eaff3 Added unit test for random file deletion, and fixed some issues found via the test. 2021-12-04 16:36:20 +00:00
CalDescent
a3038da3d7 Moved some shared arbitrary test methods to a new ArbitraryUtils class. 2021-12-04 14:26:10 +00:00
CalDescent
6026b7800a Fixed some warnings. 2021-12-04 14:23:21 +00:00
CalDescent
36c5b71656 Delete data associated with a name at random, if a name is using more than its allocated limit.
This would happen if a name fills their limit, and then additional names are followed. Alternatively it could happen if the total storage capacity reduces due to disk space being used by other apps. Chunks are deleted at random to reduce the chance of the same chunk being deleted everywhere. Data loss is possible here for transactions that don't have many peers. We'll have to see in practice how much of a problem this is, but it's better than the scenario where one content creator consumes all space on their followers' nodes, leaving no space for other names that are subsequently followed.
2021-12-04 14:23:09 +00:00
CalDescent
a320bea68a Limit the amount of data that can be stored per name.
This is calculated by the total capacity divided by the number of names the node follows. The idea here is that a single content creator can't upload terabytes of data and consume all the space on their followers' nodes. They can only use a proportion, with equal space given to each followed name. And since the limit is dynamic, following more names reduces the allocation to existing names.
2021-12-04 13:33:45 +00:00
CalDescent
a87fe8b44d Combined path filtering into a single filter to avoid iterating through the list multiple times. 2021-12-04 12:06:15 +00:00
CalDescent
0a2b4dedc7 Don't sort the transactions in listAllHostedTransactions() as this is a waste of CPU. 2021-12-04 12:03:52 +00:00