Commit Graph

1389 Commits

Author SHA1 Message Date
chimp1984
012c54cf02
Fix log at startup 2020-11-12 15:58:56 -05:00
Oscar Guindzberg
c4131c7398
Rename "tx size" to "tx vsize" 2020-11-05 19:28:45 -03:00
Oscar Guindzberg
a3d7c71410
Set TRADE_PROTOCOL_VERSION to 3 2020-11-05 11:47:41 -03:00
Christoph Atteneder
66fcde11bf
Bump version number for v1.5.0 2020-11-05 11:34:40 +01:00
chimp1984
185d812185
Add logs for sig int 2020-11-03 11:46:41 -05:00
sqrrm
f03be6ad3d
Merge pull request #4628 from chimp1984/improve-read-file-handling
Use a thread in PersistenceManager for reading persisted files instead of using threads in client code
2020-11-02 17:36:21 +01:00
chimp1984
1b83083ade
Add nodes from mike
Various improvements...
2020-10-23 01:17:33 -05:00
chimp1984
088f539fec
Add readableFileSize 2020-10-23 01:17:32 -05:00
chimp1984
5943845891
Map shutdown call from sig int handler to userThread 2020-10-23 00:13:52 -05:00
chimp1984
dd7f40d5bf
Map result handler call to user thread 2020-10-21 14:40:33 -05:00
chimp1984
997c3a0932
Fix thread name 2020-10-21 13:56:52 -05:00
chimp1984
3f4d6e6f23
Use a thread in PersistenceManager for reading persisted files instead of using thread in client code
Before we use a thread in readFromResources and readAllPersisted. To avoid that client code need to deal with
threading we moved that to the PersistenceManager and changed the API accordingly so it will not return the persisted object but calls a consumer once it is completed with reading.
2020-10-21 13:41:50 -05:00
Christoph Atteneder
062b58b65d
Bump version number for v1.4.2 2020-10-21 09:23:51 +02:00
chimp1984
108ca75097
Rename HISTORY to HISTORICAL_RESOURCE_FILE_VERSION_TAGS to make its usage more clear 2020-10-21 09:21:53 +02:00
chimp1984
8bb1c61c76
Fix wrong HISTORY version entry.
This fields contains the versions where we have tagged a resource file.
It does not need to be the latest version in case we have not added a new resource file.
2020-10-21 09:21:46 +02:00
chimp1984
927004b4be
Rename HISTORY to HISTORICAL_RESOURCE_FILE_VERSION_TAGS to make its usage more clear 2020-10-20 22:08:18 -05:00
chimp1984
fd00048b47
Fix wrong HISTORY version entry.
This fields contains the versions where we have tagged a resource file.
It does not need to be the latest version in case we have not added a new resource file.
2020-10-20 22:06:30 -05:00
Christoph Atteneder
7ae6e84e02
Bump version number for v1.4.1 2020-10-18 19:22:53 +02:00
chimp1984
0b38fccfd2
Add file name to temp file at write to disk 2020-10-16 13:27:21 -05:00
chimp1984
0d469066ce
Change write json files to disk strategy
We have written all files each time at each new block which accumulated to about
1 GB of data, this led to stability issues and very high disk IO for the explorer nodes.

Now we write only the data of the new block. We also remove the deletion of all
files at startup.
The dao state is still written in a monolithic file so that cannot be optimized
but we added a new directly where we add each block named by block height.
Looking up the latest written file tells us our last persisted block.
So all that data is equivalent to the monolithic daoState data which should
be removed once the webapp devs have implemented the change to use the blocks directory.
2020-10-12 23:51:15 -05:00
chimp1984
39c8ade5ef
Cleanups: Remove outdated TODOs, fix typos 2020-10-08 22:00:57 -05:00
chimp1984
fa374b99fb
Do conversion in a thread to not block UI thread. takes about 4 seconds on my machine.
Add shutdown method to TradeStatisticsConverter and call it via TradeStatisticsManager. Now as we have a reference to TradeStatisticsConverter in we don't need the hack anymore in applyInjector.
Set log level for com.neemre.btcdcli4j.core.client.ClientConfigurator to error as there is an expected warn log because of the outdated version.
2020-10-08 18:49:14 -05:00
chimp1984
00bed02839
Add TradeStatistics3 and related classes
Add TRADE_STATISTICS_3 Capability
Add TradeStatistics3 to proto resolvers
Make message TradeStatistics2 deprecated
2020-10-08 18:48:17 -05:00
chimp1984
6e3fdbc96a
Apply codacy suggestions 2020-10-08 18:23:04 -05:00
chimp1984
4f685f8f4b
When updating the capability from a reported peer we check if the reported one has higher capabilities, otherwise we ignore it. 2020-10-08 18:23:04 -05:00
chimp1984
cf0693098f
Update common/src/main/java/bisq/common/app/Capability.java
Co-authored-by: sqrrm <sqrrm@users.noreply.github.com>
2020-10-08 18:23:02 -05:00
chimp1984
9404e8fa87
Add NO_ADDRESS_PRE_FIX capability.
Add `boolean contains(Capability capability)` method
2020-10-08 18:23:00 -05:00
Christoph Atteneder
5294820eb6
Bump version number for v1.4.0 2020-10-08 09:39:01 +02:00
chimp1984
e179ee4e32
Use Collection for constructor which is called from the fromProto methods.
We do not set the collection as list but we fill the list created via the createList method.
2020-10-04 16:13:45 -05:00
chimp1984
c797317c0d
Fix typo 2020-10-04 16:05:43 -05:00
chimp1984
f9f33aa16d
Add PersistableListAsObservable
Remove ObservableList methods from PersistableList
Let DisputeList and TradableList extend PersistableListAsObservable
Fix param names
2020-10-04 13:18:25 -05:00
chimp1984
0cc0cfc9a5
Use runAfter instead of runPeriodically 2020-10-04 12:54:27 -05:00
chimp1984
3b31dc9ff3
Fix typo 2020-10-04 12:53:20 -05:00
chimp1984
a612405d9d
Update common/src/main/java/bisq/common/persistence/PersistenceManager.java
Co-authored-by: sqrrm <sqrrm@users.noreply.github.com>
2020-10-04 12:49:02 -05:00
chimp1984
c9cd58a378
Fix rename mistakes 2020-10-03 12:48:23 -05:00
chimp1984
e9db7c6808
Rename Priority to Source. This should make it more clear what is the intention of the usage.
Rename:
LOW to NETWORK
MID to PRIVATE_LOW_PRIO
HIGH to PRIVATE

Change delay of MID/PRIVATE_LOW_PRIO from 30 min to 2 hours (we had different datastores before using it, now its only real low prio stores)

Add comment to each enum
2020-10-03 12:48:23 -05:00
chimp1984
137b5e81d1
Enforce that clients set the priority. Remove the initialize methods which did not have priority as a param.
Make initializePersistenceManager in StorageService abstract to enforce in concrete class to define priority.

Change priorities for future renaming to a different meaning. instead of priority we want to describe the category: private data, public data,.... will come in next commit
2020-10-03 12:48:22 -05:00
chimp1984
18f64d53ca
Persist all Priority.HIGH stores at shutdown to be more safe that we did not miss any state update.
Priority.HIGH stores are all those which contain private data. Others can be rebuilt from network data or are not critical like navigationPath.
2020-10-03 12:48:22 -05:00
chimp1984
10e9b054a0
Rename writeCompleted to onWriteCompleted
Add comment
Use decrementAndGet instead of getAndDecrement

Tested cases when there is an exception at write to disk, but as we call the result handler in the finally clause we get always called onWriteCompleted, so it cannot happen that we get stuck.
2020-10-03 12:48:22 -05:00
chimp1984
232fa8ddee
Execute result handler on userThread 2020-10-03 12:48:22 -05:00
chimp1984
c789650d0b
Move methods to base class 2020-10-03 12:48:22 -05:00
chimp1984
ccfda5b043
Cleanups, add generics, add final, remove unused code/comments/todos, 2020-10-03 12:48:21 -05:00
chimp1984
fa0d261397
Fix remaining issues, cleanups, add persit calls, remove unused code,...
Sorry too tired to create another 20 commits...
2020-10-03 12:48:21 -05:00
chimp1984
197e871a7b
Remove FileManager ans Storage. All is replaces not by PersistenceManager 2020-10-03 12:48:20 -05:00
chimp1984
1e91b09f7d
Remove persist method 2020-10-03 12:48:18 -05:00
chimp1984
074ed6753b
Remove lombok Delegate from PersistableList
Add final
Add setAll method
Remove Iterable interface
2020-10-03 12:48:17 -05:00
chimp1984
3a348d5a0f
Remove ThreadedPersistableEnvelope and use PersistableEnvelope instead
We will not need threading support anymore once we use the new persistenceManager as serialisation is done on the userThread.
2020-10-03 12:48:16 -05:00
chimp1984
d3be8dd48b
Remove UserThreadMappedPersistableEnvelope and use PersistableEnvelope instead
We will not need threading support anymore once we use the new persistenceManager as serialisation is done on the userThread.
2020-10-03 12:48:16 -05:00
chimp1984
35d9338615
Remove UserThreadMappedPersistableList and use PersistableList instead
We will not need threading support anymore once we use the new persistenceManager as serialisation is done on the userThread.
2020-10-03 12:48:15 -05:00
chimp1984
937c006d73
Add PersistenceManager class 2020-10-03 12:48:15 -05:00
chimp1984
92c9c3cd7e
Add getDefaultStorageFileName method 2020-10-03 12:48:15 -05:00
chimp1984
85b33bcfce
Remove awaitTermination
Remove UserThread.execute on shutdown
Rename threadname
2020-10-03 12:48:15 -05:00
chimp1984
6f6836f733
Refactor: Add removeAndBackupFile method 2020-10-03 12:48:15 -05:00
chimp1984
d27e4dc249
Refactor: Rename fields and methods, return early 2020-10-03 12:48:14 -05:00
chimp1984
802dcad2fb
Refactor: Rename CorruptedDatabaseFilesHandler 2020-10-03 12:48:14 -05:00
chimp1984
cda9d9eccf
Refactor: Move other 2 classes to file package 2020-10-03 12:48:14 -05:00
chimp1984
23507102dd
Refactor: Move CorruptedDatabaseFilesHandler 2020-10-03 12:48:14 -05:00
chimp1984
8aff1f8665
Refactor: Move FileUtil 2020-10-03 12:48:14 -05:00
chimp1984
25a7979b02
Merge branch 'master_upstream' into reduce-initial-date-request 2020-10-02 13:05:56 -05:00
chimp1984
f5862ec2f6
UserThread must not be used before application is created. 2020-10-01 23:01:49 -05:00
chimp1984
3df2f7e177
Add HISTORY field. Make isNewVersion public 2020-10-01 15:06:34 -05:00
chimp1984
df90b2440a
Add new methods and refactor APIs. Needed later for new classes.... 2020-10-01 15:02:44 -05:00
chimp1984
ff1380481d
Merge branch 'master_upstream' into improve-startup-routines
# Conflicts:
#	core/src/main/java/bisq/core/app/BisqSetup.java
2020-10-01 10:34:43 -05:00
chimp1984
9fce06832d
Rename baseCurrencyNetworkParameters to networkParameters 2020-10-01 09:46:11 -05:00
chimp1984
0af9e133a4
Cleanups 2020-10-01 09:42:33 -05:00
chimp1984
fb41a1984b
Merge branch 'master_upstream' into fix-delayed-payout-tx-issues
# Conflicts:
#	core/src/main/java/bisq/core/trade/TradeManager.java
#	desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java
2020-10-01 09:24:46 -05:00
chimp1984
6e7e975c05
Improve printSystemLoad 2020-09-30 23:03:11 -05:00
chimp1984
346ad517a1
Refactor: Move osUserDataDir method to Utilities, rename to getUserDataDir 2020-09-30 22:43:11 -05:00
chimp1984
a38f59a88a
Refactor: Move common bases setup code to CommonSetup 2020-09-30 22:36:18 -05:00
chimp1984
51ce37ded9
Refactor: Rearrange methods 2020-09-30 22:32:47 -05:00
chimp1984
073f1630b1
Remove Remove LimitedKeyStrengthException as not needed anymore 2020-09-30 22:32:10 -05:00
chimp1984
49866508c1
Remove checkCryptoPolicySetup as not needed anymore 2020-09-30 22:31:37 -05:00
chimp1984
4f9a6ea436
Refactor: Move periodic printSystemLoad to commonSetup 2020-09-30 22:17:36 -05:00
chimp1984
516da22a09
Refactor: Add setup method in DevEnv 2020-09-30 22:12:20 -05:00
chimp1984
b927f9719e
Refactor: Move DevEnv setup to CommonSetup 2020-09-30 22:11:29 -05:00
chimp1984
9d12bf7d52
Refactor: Move sig int handlers to CommonSetup 2020-09-30 22:10:44 -05:00
chimp1984
7ea3676c55
Refactor: Rename setup to setupUncaughtExceptionHandler
rename setupErrorHandler to checkCryptoPolicySetup
move UncaughtExceptionHandler code to setupUncaughtExceptionHandler
2020-09-30 21:55:50 -05:00
chimp1984
b6e97e371e
Refactor: add new setup method to CommonSetup with config (WIP) and call it at doExecute. Move AsciiLogo to CommonSetup 2020-09-30 21:53:29 -05:00
chimp1984
fe7ccbd6f9
Refactor: extract method 2020-09-30 21:51:31 -05:00
chimp1984
b73fff0aad
Refactor: Move AsciiLogo to common 2020-09-30 21:50:47 -05:00
chimp1984
3242d86321
Apply code inspection suggestions 2020-09-29 13:08:55 -05:00
chimp1984
11eb24bb53
Simplify statements 2020-09-29 13:04:12 -05:00
chimp1984
87272ad3a5
Use final 2020-09-29 13:02:44 -05:00
chimp1984
4c7f6147e9
Remove not needed stream() 2020-09-29 13:02:32 -05:00
chimp1984
94bc2359ed
Delete unused class 2020-09-29 13:00:33 -05:00
chimp1984
3926a36c3a
Use params for trace logs. 2020-09-29 12:55:23 -05:00
chimp1984
10bedee803
Merge branch 'dispute-agent-branch' into fix-delayed-payout-tx-issues
# Conflicts:
#	core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerSetupDepositTxListener.java
2020-09-25 15:03:28 -05:00
chimp1984
2b747cc323
Don't return null if name is null by try to use UNDEFINED. Only if that is not present we return null 2020-09-22 18:48:47 -05:00
Christoph Atteneder
69d533d9ea
Merge pull request #4520 from cd2357/show-qubes-info-popup
Show info popup if Bisq started under Qubes OS
2020-09-22 16:21:03 +02:00
Oscar Guindzberg
d4ac45da21
bitcoinj 0.15: bitcoinj moved from spongycastle to bouncycastle. 2020-09-18 18:29:28 -03:00
Christoph Atteneder
81df879881
Merge branch 'master' of github.com:bisq-network/bisq into release/v1.3.9
# Conflicts:
#	build.gradle
#	desktop/package/linux/Dockerfile
#	desktop/package/linux/package.sh
#	desktop/package/linux/release.sh
#	desktop/package/macosx/create_app.sh
#	desktop/package/macosx/finalize.sh
#	desktop/package/macosx/insert_snapshot_version.sh
#	desktop/package/windows/package.bat
#	desktop/package/windows/release.bat
#	relay/src/main/resources/version.txt
2020-09-16 16:52:54 +02:00
Christoph Atteneder
06ac7a7605
Bump version number for v1.3.9 2020-09-16 15:58:58 +02:00
chimp1984
f6cb7c6696
Ensure the division is not by 0 and add try catch to MovingAverage 2020-09-16 15:56:19 +02:00
Christoph Atteneder
8cb4b5016c
Merge pull request #4529 from chimp1984/make-moving-average-code-more-safe
Make moving average code more safe
2020-09-16 15:51:14 +02:00
Christoph Atteneder
98b03937d8
Merge branch 'master' of github.com:bisq-network/bisq into release/v1.3.8
# Conflicts:
#	core/src/main/java/bisq/core/support/dispute/agent/MultipleHolderNameDetection.java
#	core/src/main/java/bisq/core/trade/txproof/xmr/XmrTxProofService.java
2020-09-15 13:24:06 +02:00
chimp1984
70d98d9554
Ensure the division is not by 0 and add try catch to MovingAverage 2020-09-14 16:06:52 -05:00
cd2357
8d793e9a83
Show info popup if Bisq started under Qubes OS
Show popup informing the user about the OS-specific setup guide.
2020-09-13 13:23:12 +02:00
chimp1984
54fdb5267f
Instead of renaming the AddressEntryList to a backup file we keep it
at restore from seed and create a backup copy.
I don't know what was the motivation of removing the original file
(probably the use case that the seeds are different and thus there
is no match of existing entries with the new addresses) as
that breaks the internal association of addresses with trades/offers and
the reserved balances display.

This should be tested well though with the related use cases
(diff. offer and trade states, wallet restore with same seed of with
foreign seed -> in that case we need to recreated the AddressEntryList
but that should be handled in the related domain)

- Add copyFile method
2020-09-08 19:14:38 -05:00
Christoph Atteneder
ca88bc9b4f
Bump version number for v1.3.8 2020-09-03 17:34:34 +02:00
Christoph Atteneder
77c7629478
Merge branch 'master' of github.com:bisq-network/bisq into add-xmr-tx-key-service-3
# Conflicts:
#	desktop/src/main/java/bisq/desktop/main/MainView.java
#	desktop/src/main/java/bisq/desktop/main/MainViewModel.java
2020-09-03 17:10:05 +02:00
chimp1984
ff7e3cb4cc
Add check for major version as well 2020-09-02 16:23:20 -05:00
chimp1984
842eeebe56
Show popup about key-logger warning if OSX version is >= 10.14
Tell user about the issue and instruct him how to change OS settings.
2020-09-02 10:26:33 -05:00
sqrrm
604dabbb46
Merge pull request #4461 from ghubstan/1-singleton-coreapi
Make CoreApi a singleton
2020-09-02 14:44:23 +02:00
Christoph Atteneder
095c8b5bdb
Merge pull request #4415 from sqrrm/dev-css
Add option to use different css for dev mode
2020-09-02 14:20:57 +02:00
chimp1984
039860935d
Merge master
- fix tests
2020-09-01 19:53:23 -05:00
sqrrm
f0acec0cb1
Add option to use different color header in dev mode
This is to help differentiate dev instances and live ones.
This can help devs avoiding silly mistakes.
2020-09-01 23:03:22 +02:00
chimp1984
77841e230f
Change log level
In cased new fields are added to PB this case is expected as well in
development if protbuf definitions have changed over time and persisted
data do not match the new definition. We don't want this log to be
that verbose.
2020-09-01 10:58:00 -05:00
ghubstan
7ed5028b8e
Add @VisibleForTesting annotation
The access modifier on CompositeOptionSet was changed to public
in commit c402386, to make it visible to the apitest config
class.  The annotation added in this change concisely explains
why the class is not package protected.
2020-09-01 10:58:37 -03:00
chimp1984
008ae93b88
Add null check for name 2020-08-30 14:40:21 -05:00
chimp1984
2f291a6acb
Cleanup Filter value object. Remove nullables from old versions. Keep signatureAsBase64 nullable as it is set null at creation time and set later after signing. We use filter protobuf data as input for signature so we have to set signature to null and apply the signature afterwards. To keep object immutable we clone it with static clone method. Similar we handle signature verification. We clone the filter with a null value for the signature and do the validation with that cloned object.
Use now the complete object data for signature creation. We use the protobuf data for creating the signature with DER encoding. We restict ourself more regarding backward compatibility but I think it is not a big problem.
If a new field is added to Filter and deployed the maintainer needs to publishes a new filter object. By using the new version he cannot remove the old filter from the network as the protobuf data is different and sig verification on the P2P datastorage level will fail. This is intended to keep the old filter alive for some time to support not updated users. We do not remove invalid filters anymore from our local storage to enable seed nodes to support also old filter objects.
For not updated users the new filter will fail at sig verification because the protobuf data is different. So they ignore the new filter and still use the old filter. For updated users the old filter will fail and the new filter is accepted. As it has a newer date it would also replace the old filter anyway. If the maintainer wants to delete the old filter from the network he can use the old app version and remove the filter. It is recommended to keep a copy of the data directory before the update so that the removal of the older filter is possible.

Refacorings:
- Rename isPeersPaymentAccountDataAreBanned to arePeersPaymentAccountDataBanned
- Rename isSignerPubKeyBanned to isWitnessSignerPubKeyBanned
2020-08-27 21:23:02 -05:00
ghubstan
c4023869bf
Remove duplicate CompositeOptionSet class
This commit changes the access modifier on
bisq.common.config.CompositeOptionSet to make
it visible to bisq.apitest.config.ApiTestConfig,
and the duplicate bisq.apitest.config.ApiTestConfig
was deleted from 'apitest'.
2020-08-24 15:29:32 -03:00
Christoph Atteneder
7475f17207
Bump version number for v1.3.7 2020-07-30 10:19:34 +02:00
Christoph Atteneder
7613912c75
Bump version number for v1.3.6 2020-07-04 21:02:29 +02:00
Christoph Atteneder
cfc3252f7b
Merge pull request #4347 from sqrrm/deposit-improvements
Deposit improvements
2020-07-03 21:20:27 +02:00
sqrrm
fabd592938
Merge remote-tracking branch 'origin/master' into HEAD 2020-07-03 16:58:13 +02:00
sqrrm
3630abdeb8
Improve MovingAverage
Don't include outliers (20% deviation from moving average) in moving
average calculation. It's quite likely that low liquidity markets or
markets with large spreads can't calculate deposit suggestion and will
then suggest deposit from preferences.

Added test for moving average class
2020-07-02 23:03:26 +02:00
sqrrm
190867e383
Suggest security deposit depending on previous volatility 2020-06-30 14:45:51 +02:00
Christoph Atteneder
92ee247fa7
Bump version number for v1.3.5 release 2020-06-06 08:44:41 +02:00
sqrrm
ca9665fa3c
Sign unsigned keys
Legacy arbitrator can sign unsigned signed witness signer pubkeys
To sign, from legacy arbitrator support, ctrl+O
2020-06-03 15:44:04 +02:00
sqrrm
7bd5969dcf
Refactor accountagewitnessservice log helpers
Better filter for root signedwitnesses

Add debug keyboard shortcuts:
- ctrl+shift+L -> logSignedWitnesses
- ctrl+shift+S -> logSigners
2020-05-31 15:08:41 +02:00
sqrrm
8bf0f3350c
Test dummy account age witness signing
Add orphaned witness log
2020-05-31 15:08:41 +02:00
Christoph Atteneder
23432308a2
Merge branch 'master' of github.com:bisq-network/bisq into release/v1.3.4
# Conflicts:
#	build.gradle
#	desktop/package/linux/Dockerfile
#	desktop/package/linux/package.sh
#	desktop/package/linux/release.sh
#	desktop/package/macosx/create_app.sh
#	desktop/package/macosx/finalize.sh
#	desktop/package/macosx/insert_snapshot_version.sh
#	desktop/package/windows/package.bat
#	desktop/package/windows/release.bat
#	p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java
#	p2p/src/main/resources/AccountAgeWitnessStore_BTC_MAINNET
#	p2p/src/main/resources/DaoStateStore_BTC_MAINNET
#	p2p/src/main/resources/SignedWitnessStore_BTC_MAINNET
#	p2p/src/main/resources/TradeStatistics2Store_BTC_MAINNET
#	relay/src/main/resources/version.txt
2020-04-30 16:36:51 +02:00
Christoph Atteneder
64f55cb777
Bump version number for v1.3.4 2020-04-30 10:19:27 +02:00
Chris Beams
4277e62135
Merge pull request #4199 from cbeams/refactor-rpc-server
Refactor rpc server implementation
2020-04-29 16:23:42 +02:00
Chris Beams
e03c46106b
Merge pull request #4189 from ghubstan/simple-rpc-auth
Implement simple password-based gRPC authentication
2020-04-29 16:17:04 +02:00
Christoph Atteneder
df56aaddab
Bump version number for v1.3.3 2020-04-29 16:08:54 +02:00
sqrrm
96575dcad7
Test permutations level by level 2020-04-29 16:06:39 +02:00
chimp1984
f7dfef253a
Add resync from resources button
We add a second button (displayed as first) to the preferences UI for
resync from latest resources. We add a warning to the resync from
genesis as it takes very long time and causes heavy network load for
seeds.
The resync button at the stateMonitor does now a resync from resources,
not from genesis.
We add handling of the UnconfirmedBsqChangeOutputList file as well.
In Filemanager we add a check if file exists.
2020-04-29 16:06:27 +02:00
chimp1984
bc7f570a18
Remove dev logs 2020-04-29 16:06:19 +02:00
chimp1984
5c5051435c
Add optimized permutation algo
WIP, needs more tests, comments, clean up....
2020-04-29 16:06:08 +02:00
Christoph Atteneder
5fd05cf660
Merge pull request #4206 from sqrrm/permutation-fix
Permutation fix
2020-04-29 15:56:45 +02:00
sqrrm
92cd7ec5a6
Test permutations level by level 2020-04-29 01:00:53 +02:00
chimp1984
77015fea17
Add resync from resources button
We add a second button (displayed as first) to the preferences UI for
resync from latest resources. We add a warning to the resync from
genesis as it takes very long time and causes heavy network load for
seeds.
The resync button at the stateMonitor does now a resync from resources,
not from genesis.
We add handling of the UnconfirmedBsqChangeOutputList file as well.
In Filemanager we add a check if file exists.
2020-04-28 15:18:11 -05:00
chimp1984
77bd421a00
Remove dev logs 2020-04-28 13:25:56 -05:00
Christoph Atteneder
91ce44ad96
Merge pull request #4102 from stejbac/tidy-persistable-envelope-inheritance
Tidy PersistableEnvelope inheritance
2020-04-28 16:22:41 +02:00
chimp1984
54e280c78d
Add optimized permutation algo
WIP, needs more tests, comments, clean up....
2020-04-28 00:40:41 -05:00
Chris Beams
3badf299e3
Add 'apiPort' configuration option 2020-04-27 19:49:10 +02:00
Chris Beams
e84123c20a
Refactor auth infrastructure naming 2020-04-25 09:52:50 +02:00
Chris Beams
1a133f4b67
Use a single auth token vs username:password
There is actually no use case for both username and password forming the
authentication token. This change simplifies the arrangement such that a
single token is passed.

--rpcUser and --rpcPassword are no longer used and are replaced by
--apiToken on both cli and daemon sides.
2020-04-23 11:32:19 +02:00
ghubstan
fe9e57babb
Implement simple cleartext gRPC authentication
* Renamed CliCommand to RpcCommand, differentiating it from cmd
   string token(s)

 * Added new CliConfig, based on :common Config

 * Injected Config into CoreApi to make bisq.properties and cmd line
   args available to server

 * Added cleartext username:password BisqCallCredentials to :cli, and
   an AuthenticationInterceptor to :core (server)

 * Moved :daemon resources folder to expected location under src/main

 * Duplicated CompositeOptionSet, ConfigException and BisqException
   in :cli because they are not visible from :common.  (TODO refactor?)
   CompositeOptionSet will be used to let command line parameters
   override params set in config file.

 * Removed outdated references to :cli in a couple of comments in
   :common Config

 * gRPC parameters & command names are lowercase to mimic bitcoind/rpc

TBD

 * Decide what rpc auth param names to use, to differentiate them from
   bitcoind rpc user/passord param names
2020-04-22 18:16:01 -03:00
sqrrm
1a1f71a0a7
Change command line argument default 2020-04-13 11:38:30 +02:00
sqrrm
6fc087c72c
Add option to allow faulty delay payout tx
Add more logging during unfail process
2020-04-13 11:38:15 +02:00
Christoph Atteneder
782921ec55
Bump version number for v1.3.2 2020-04-10 20:02:39 +02:00
Christoph Atteneder
aeda234ef1
Merge pull request #4154 from freimair/prevent_misuse_of_dev_cmdline_option
Limit abuse of `--useLocalhostForP2P` option
2020-04-10 12:08:32 +02:00
Florian Reimair
609b8b066d
Limit abuse of useLocalhostForP2P option
Until now, the --useLocalhostForP2P option could be used even for
BTC_MAINNET. That is bad and caused mediation cases.
2020-04-09 18:05:51 +02:00
Christoph Atteneder
4b826eb2a9
Merge branch 'master' of github.com:bisq-network/bisq into release/v1.3.1
# Conflicts:
#	build.gradle
#	desktop/package/linux/Dockerfile
#	desktop/package/linux/package.sh
#	desktop/package/linux/release.sh
#	desktop/package/macosx/create_app.sh
#	desktop/package/macosx/finalize.sh
#	desktop/package/macosx/insert_snapshot_version.sh
#	desktop/package/windows/package.bat
#	desktop/package/windows/release.bat
#	relay/src/main/resources/version.txt
2020-04-08 23:03:19 +02:00
chimp1984
b145616038
Allow daoActivated to be set to false for non mainnet networks 2020-04-08 21:52:18 +02:00
chimp1984
86d9e8c89e
Allow daoActivated to be set to false for non mainnet networks 2020-04-08 13:28:44 -05:00
Christoph Atteneder
51ffd9d95c
Bump version number for v1.3.1 2020-04-08 20:04:13 +02:00
Christoph Atteneder
bb75f59b86
Bump version number for v1.3.0 2020-04-07 19:38:16 +02:00
Steven Barclay
594b42a865
Delete PersistableHashMap & simplify PersistableList
Remove unused functionality to pass a custom 'toProto' function via a
constructor or setter, as it was unused and all subclasses override the
toProtoMessage() method anyway. In this way, the method may be removed
and the class (+ UserThreadMappedPersistableList) made abstract.

Also it appears PersistableHashMap was never used, so remove it.
2020-03-28 19:49:53 +08:00
Steven Barclay
9d10a6384f
Tidy payload instances wrongly implementing PersistableEnvelope
Remove an unused PersistableEnvelope interface from the following five
PersistableNetworkPayload implementations:

  AccountAgeWitness, BlindVotePayload, ProposalPayload,
  SignedWitness, TradeStatistics2

These already have corresponding *Store envelope classes which correctly
implement the interface.
2020-03-28 15:22:06 +08:00
ghubstan
aed3453142
Move command & core proto defs to new subproject
Protobuf definition files were moved from common and core to a new
protodefinition subproject.

The two main reasons for doing this are to speed up builds by not
having to regenerate common and core protobuf classes
every time a change is made in those subprojects, and to remove
the grpc cli's direct dependency on core, and the transitive dependency
on common.

In order to accomplish this, cli's BisqCliMain was stripped of
its dependencies on common and core.  Cli can only get the version
and balance now.

gRPC stub boilerplate was moved from BisqCliMain to a CliCommand
class to avoid some of the bloat that is going to happen as the
read-response loop supports more rpc commands.
2020-03-26 10:14:33 -03:00
Christoph Atteneder
557ec7f449
Merge pull request #4025 from stejbac/make-persistence-thread-safe
Make serialisation in FileManager::saveToFile thread-safe
2020-03-23 13:49:27 +01:00
Steven Barclay
9ab649ec05
Restore type hierarchy of MeritList & VoteWithProposalTxIdList
Provide UserThreadMappedPersistableList subclass for persistable lists
which need to implement UserThreadMappedPersistableEnvelope, instead of
putting the interface on the base class.

Make the (non-storage) classes MeritList and VoteWithProposalTxIdList
keep the original PersistableList superclass, deriving the remaining
subclasses of PersistableList from the new class instead. In this way,
further persistence-related changes are less likely to inadvertently
alter the behaviour of those two consensus-critical classes.

Removing the superfluous PersistableEnvelope interface from the two
classes (via the base class) will be done in a separate PR.
2020-03-22 14:12:57 +08:00
Christoph Atteneder
066614f966
Bump version number for v1.2.9 2020-03-13 17:16:09 +01:00
Christoph Atteneder
dfba2103ab
Bump version number to v1.2.8 2020-03-10 09:17:21 +01:00
Steven Barclay
91fa07343c
Add UserThreadMappedPersistableEnvelope for greater explicitness
Make the default toPersistableMessage() method of PersistableEnvelope
simply delegate to Proto.toProtoMessage for speed, so that stores can
explicitly implement (Threaded|UserThreadMapped)PersistableEnvelope if
they actually need concurrency control.

As part of this, make PeerList implement PersistableEnvelope directly
instead of extending PersistableList, as it is non-critical & cloned on
the user thread prior to storage anyway, so doesn't need be thread-safe.
In this way, only PaymentAccountList & small DAO-related stores extend
PersistableList, so they can all be made user-thread-mapped.

After this change, the only concrete store classes not implementing
(Threaded|UserThreadMapped)PersistableEnvelope are:

  AccountAgeWitness, BlindVotePayload, ProposalPayload, SignedWitness,
  TradeStatistics2, NavigationPath & PeerList

The first five appear to erroneously implement PersistableEnvelope and
can be cleaned up in a separate commit. The last two are non-critical.

(Make NavigationPath.path an immutable list, for slightly better thread
safety anyway - that way it will never be observed half-constructed.)
2020-03-10 12:05:33 +08:00
Steven Barclay
9e9fc6ab57
Rename toProtoMessageSynchronized to toPersistableMessage
Make PersistableEnvelope method name less confusing, as it is only
synchronised in ThreadedPersistableEnvelope.
2020-03-10 10:36:52 +08:00
sqrrm
4c3a5628b6
Merge pull request #4018 from freimair/fix_hsdir_getting_deleted
Fix false deletion of hsdir when using --appDataDir
2020-03-07 16:36:44 +01:00
Florian Reimair
0b7788ae53
Fix wrong deletion of hsdir when using --appDataDir
There are circumstances where input via --appDataDir
will lead to the hiddenservice-directory to be deleted.
Successfully reproduced using

  --appDataDir=~/foo

Although the "~" does not get interpreted correctly on
my linux system, it does manage to throw off the
mechanics of sparing the hiddenservice-directory from
being deletd.
2020-03-04 12:25:11 +01:00
Steven Barclay
6487f92d84
Make serialisation in FileManager::saveToFile thread-safe
Add toProtoMessageSynchronized() default method to PersistableEnvelope,
which performs (blocking) protobuf serialisation in the user thread,
regardless of the calling thread. This should prevent data races like
the ConcurrentModificationException observed in #3752, under the
reasonable assumption that shared persistable objects are only mutated
in the user thread.

Also add a ThreadedPersistableEnvelope sub-interface overriding the
default method above, to let objects which are expensive to serialise
(like DaoStateStore) be selectively serialised in the 'save-file-task-X'
thread as before, but directly synchronised with each mutating op. As
most objects are cheap to serialise, this avoids a noticeable perf drop
without having to track down every mutating method for each store.

In all cases but one, classes implementing ThreadedPersistableEnvelope
are stores like TradeStatistic2Store, with a single ConcurrentHashMap
field. These require no further serialisation, since the map entries are
immutable, so the only mutating operations are map.put(..) calls which
are already synchronised with map reads. (Even if map.values().stream()
sees updates @ different keys happen out-of-order, it should be benign.)

The remaining case is DaoStateStore, which is only ever reset or
modified via a single persist(..) call with a cloned DaoState instance
and hash chain from DaoStateSnapshotService, so there is no aliasing
risk from the various DAO state mutations done in DaoStateService and
elsewhere.

This should fix #3752.
2020-03-04 15:10:20 +08:00
Steven Barclay
18f75869a2
Make 'fromProto' static methods return most specific type
Minor change for consistency: narrow the signature of some remaining
such methods, which have return type 'PersistableEnvelope'.

(This excludes some other cases with return type 'NetworkEnvelope'.)
2020-03-04 00:54:48 +08:00
Florian Reimair
379259a2ec
Apply suggestions from code review
Co-Authored-By: Chris Beams <chris@beams.io>
2020-02-27 17:34:00 +01:00
Florian Reimair
464388df32
Make price providers cmdline param more readable 2020-02-27 11:34:29 +01:00
Chris Beams
cbe6f192e0
Do not attempt to create already existing appDataDir
This change fixes #3998 by avoiding the attempt to create a user's
appDataDir if it already exists. Normally this attempt is not a problem,
as Files#createDirectories does nothing if the target is a directory
that already exists, but in the case that the target is a symbolic link,
Files#createDirectories throws a FileAlreadyExistsException. This change
prevents the call to Files#createDirectories if the target already
exists, and if in fact the target is a symbolic link pointing to an
existing directory, this is not a problem and everything proceeds as per
usual. This mimics the behavior in Bisq v1.2.5 and prior, where
File#mkdirs was used instead of Files#createDirectories. File#mkdirs
does not throw an exception when the target directory is a symlink, it
just returns false.
2020-02-25 11:47:40 +01:00
Chris Beams
303eadec39
Refactor Config#mkdir and #mkAppDataDir
This is a pure refactoring that renames and inlines variables to tighten
up and make more consistent the implementation of these two methods. It
is done in preparation for a subsequent substantive change that fixes a
bug.
2020-02-25 11:22:11 +01:00
Chris Beams
de537f0b14
Throw UncheckedIOException on directory creation errors
Previously, Config#mkdir and #mkAppDir threw ConfigException if any
underlying IOException was thrown from Files#createDirectory or
Files#createDirectories respectively. This resulted in only a simple
error message being reported at the command line and the details of the
underlying exception's stack trace were lost. This change wraps and
rethrows the underlying IOException as an UncheckedIOException such that
it gets caught by the catch(Throwable) clause in BisqExecutable, which
does print a stacktrace to stderr. This is the way it always should have
worked; throwing ConfigException in these cases was an oversight in the
original implementation. This change also removes the ConfigException
constructor that allows for passing a nested exception to be wrapped as
there is actually no use case for this now that these two anomalies have
been corrected.

This change was made in the process of attempting to reproduce #3998.
2020-02-24 13:17:06 +01:00
sqrrm
c411f48d43
Merge pull request #3978 from ripcurlx/accept-empty-option-values
Accept empty config values
2020-02-17 19:22:08 +01:00
sqrrm
665fed3b40
Merge pull request #3971 from bisq-network/release/v1.2.7
Release/v1.2.7
2020-02-17 13:05:03 +01:00
sqrrm
23c2052fe6
Merge pull request #3970 from bisq-network/release/v1.2.6
Release/v1.2.6
2020-02-17 13:04:32 +01:00
Christoph Atteneder
3899f693da
Accept empty config values
Fixes #3977.
2020-02-17 12:27:32 +01:00
Christoph Atteneder
1cb7b0521d
Bump version number 2020-02-13 20:19:52 +01:00
Chris Beams
7f9c935a8b
Allow unrecognized options in config file
Prior to this commit, Bisq's new `Config` infrastructure would throw an
exception on encountering an unrecognized option in the
`bisq.properties` config file and the Bisq application would handle this
by reporting an error at the command line indicating that the given
option was not recognized.

For example, given a bisq.properties file that reads as follows:

    $ cat $APP_DATA_DIR/bisq.properties
    bogus=42

running Bisq would exit with the following error message:

    $ java -jar bisq.jar
    error: problem parsing option 'bogus': bogus is not a recognized option.

This was reasonable enough behavior, but it had two problems. The first
is that the error message did not indicate to the user that the
unrecognized option was found in the config file as opposed to the
command line. Users unfamiliar with the config file might not know to
look there to eliminate or fix the offending option. The second problem
surfaced when testing the Windows executable build for the v1.2.6
release. When such an error was encountered, the executable would just
fail silently, reporting nothing to the user.

Both of these problems should be addressed on their own, i.e. option
parsing errors should report to the user whether the offending option
was at the command line or in the config file, and our packaged
executables should never just fail silently if we can avoid it.

However, this change does not address either of these problems directly.
It rather avoids the problems completely by relaxing config file
parsing to silently allow unrecognized options. This behavior mimics
prior (pre-`Config`) Bisq versions, and it also follows suit with
Bitcoin Core's own config file processing.

This fixes #3966, which surfaced this problem. In that particular issue,
an option line had somehow been added to the user's bisq.properties
config file that consisted of an option key containing 452 octal null
characters (\u0000) followed by an equals sign and an empty option
value. It is unknown how this bogus option was ever added to the user's
config file in the first place, but on the chance that previous Bisq
versions somehow added this, the changes in this commit ensure that such
entries will not cause affected users' Bisq applications to silently
fail in versions 1.2.6 and beyond.
2020-02-12 18:30:23 +01:00
Chris Beams
651515d6a0
Allow unrecognized options in config file
Prior to this commit, Bisq's new `Config` infrastructure would throw an
exception on encountering an unrecognized option in the
`bisq.properties` config file and the Bisq application would handle this
by reporting an error at the command line indicating that the given
option was not recognized.

For example, given a bisq.properties file that reads as follows:

    $ cat $APP_DATA_DIR/bisq.properties
    bogus=42

running Bisq would exit with the following error message:

    $ java -jar bisq.jar
    error: problem parsing option 'bogus': bogus is not a recognized option.

This was reasonable enough behavior, but it had two problems. The first
is that the error message did not indicate to the user that the
unrecognized option was found in the config file as opposed to the
command line. Users unfamiliar with the config file might not know to
look there to eliminate or fix the offending option. The second problem
surfaced when testing the Windows executable build for the v1.2.6
release. When such an error was encountered, the executable would just
fail silently, reporting nothing to the user.

Both of these problems should be addressed on their own, i.e. option
parsing errors should report to the user whether the offending option
was at the command line or in the config file, and our packaged
executables should never just fail silently if we can avoid it.

However, this change does not address either of these problems directly.
It rather avoids the problems completely by relaxing config file
parsing to silently allow unrecognized options. This behavior mimics
prior (pre-`Config`) Bisq versions, and it also follows suit with
Bitcoin Core's own config file processing.

This fixes #3966, which surfaced this problem. In that particular issue,
an option line had somehow been added to the user's bisq.properties
config file that consisted of an option key containing 452 octal null
characters (\u0000) followed by an equals sign and an empty option
value. It is unknown how this bogus option was ever added to the user's
config file in the first place, but on the chance that previous Bisq
versions somehow added this, the changes in this commit ensure that such
entries will not cause affected users' Bisq applications to silently
fail in versions 1.2.6 and beyond.
2020-02-12 18:22:26 +01:00
Devin Bileck
d166e08d43
Resolve test failures on windows (#3960)
* Close stream writer prior to deleting temp file

On Windows, instantiating the stream writer appears to lock the file,
preventing the file from being deleted. This was causing the assertion
that the file is deleted to fail.

* Use proper file path on Windows

On Windows, the exception message contained backwards slashes causing
the test to fail.

* Resolve codacy issues
2020-02-11 10:35:22 +01:00
Christoph Atteneder
5f51af4866
Bump version number for v1.2.6 2020-02-06 11:55:08 +01:00
sqrrm
6a9f340c20
Trade process refresh (#3922)
* Add keyboard shortcut for trade process refresh, fix #3905

Trades have been getting stuck in the `Wait for payment` state, perhaps
due to lost mailbox messages, but it's hard to know for sure. There is
currently no way to get out of this state except going to mediation.

With ctrl+R the seller can ask the buyer to refresh the current trade
state and the buyer will resend the
`CounterCurrencyTransferStartedMessage` if they are in the phase
FIAT_SENT.

* Disallow more than one trade refresh per day

* Add refresh button for seller step 2, fix #3905

A seller can ask to refresh the trade process once every 24 hours. This
step has been a problem causing a lot of mediation lately so this is a
way to ask the buyer to resend the CounterCurrencyTransferStartedMessage

This fixes the problem when a mailbox message was lost. To test the
seller need to not get the first CounterCurrencyTransferStartedMessage
sent by the buyer, for example by letting the seednode drop it instead
of sending to the seller. When button is pressed
- a RefreshTradeStateRequest is sent from seller to buyer
- the buyer receives the RefreshTradeStateRequest and
 - ignores it if it's not in FIAT_SENT phase
 - responds with a CounterCurrencyTransferStartedMessage if in FIAT_SENT
   phase and has already sent a CounterCurrencyTransferStartedMessage

* Fix codacy remarks

Move incoming message handling method to the right section

* Add refresh button info text

Hide refresh section when not available rather than graying out

Added info text:
Sometimes P2P network messages acknowledging payment are not delivered,
causing trades to get stuck. Hit the button below to make your peer
resend the last message.

* Fix codacy issues
2020-02-04 15:54:47 +01:00
sqrrm
afac8e5a30
Add dumpDelayedPayoutTxs config option 2020-01-30 15:40:23 +01:00
Christoph Atteneder
4243236107
Merge pull request #3909 from stejbac/fix-silent-sound-player-resource-leak
Fix potential resource leak in AvoidStandbyModeService
2020-01-27 15:51:11 +01:00
Christoph Atteneder
a29d4903a6
Merge pull request #3890 from dmos62/dao-facts-and-figures-outlier-resistance
Improve readability of the daily burnt BSQ chart
2020-01-23 15:18:46 +01:00
Christoph Atteneder
c403ee7723
Minor code cleanups 2020-01-22 11:34:15 +01:00
Steven Barclay
a073dbf13b
Fix potential resource leak in AvoidStandbyModeService
Replace tail recursion of the play() method with an ordinary loop, to
prevent a new open JAR resource InputStream + sound file OutputStream
(which were created every 4 minute playback) from accumulating on the
stack, closing them inside the loop instead. (This also prevents
eventual stack overflow.)

Also tidy up FileUtil.resourceToFile and put the JAR URL InputStream in
a try-with-resources block, to ensure that it doesn't leak either.
2020-01-22 10:01:34 +00:00
Chris Beams
dd5690fe2a
Fix code quality issues
Per Codacy report at
https://app.codacy.com/gh/bisq-network/bisq/pullRequest?prid=4835062

Note that the items claiming that bisq.common.config.Config.* is an
unused import are false positives. These imports are in fact used in
every case.
2020-01-20 16:47:54 +01:00
Chris Beams
37b669c710
Make Config option fields public and inline accessors
See updated Config Javadoc for rationale.
2020-01-20 16:47:54 +01:00
Chris Beams
4ac46e4717
Reorder a few of the most important options
There is currently no explicit rule for how option-related elements are
ordered in the code, but it is important to understand that the order in
which options are registered via parser.accept() calls is the order in
which they appear in --help output.

It would be nice to group options together into sections and separate
them in the --help output with section headers similar to the way that
Bitcoin Core's help output does it, but this is not a built-in option
with the JOpt Simple library, and not worth trying to hack into place at
the moment.
2020-01-20 16:47:53 +01:00
Chris Beams
d5abc97b04
Document Config and related types 2020-01-20 16:47:53 +01:00
Chris Beams
fe506098af
Introduce Config testing facilities
Previously ConfigTests constructed Config instances with string-based
options, e.g.:

    Config config = new Config("--appName=My-Bisq");

The advantage here is clarity, but the downside is repetition of the
option names without any reference to their corresponding Config.*
constants.

One solution to the problem would be to format the option strings using
constants declared in the Config class, e.g.:

    Config config = new Config(format("--%s=My-Bisq", APP_NAME));

but this is verbose, cumbersome to read and write and requires repeating
he '--' and '=' option syntax.

This commit introduces the Opt class and the opt() and configWithOpts()
methods to ConfigTests to make testing easier while using constant
references and preserving readability. e.g.:

    Config config = configWithOpts(opt(APP_NAME, "My-Bisq"));

In the process of making these changes a bug was discovered in the
monitor submodule's P2PNetworkLoad class and that has been fixed here as
well.

This change also required introducing several option name constants that
had not previously been extracted in order to be referenced within
ConfigTests. For consistency and completeness, all additional option
names that did not previously have a contstant now have one.
2020-01-20 16:47:53 +01:00
Chris Beams
63489c13f2
Throw if --configFile value does not exist
Previously (as of the prior commit), a warning was issued if a
non-default config file path was specified at the command line, and then
the default config file path was used as a fallback. On review, however,
it would be better to halt execution immediately if the config file does
not exist. There is no risk of breaking backward compatibility by doing
this as Bisq never had a --configFile option before the recent commits
that introduce it. Furthermore, there is no clear benefit to the
fallback approach. If the user specifies a given config file and it does
not exist, they may not see the warning message in the log, and they may
be left with the impression that they are running against their custom
config file when in fact they are running against the default (which may
be empty or non-existent itself). Thus throwing an exception as is now
done in this commit should make everything more explicit and clear.
2020-01-20 16:47:53 +01:00
Chris Beams
3d991e009a
Qualify relative --configFile value with appDataDir
This behavior had already been implemented prior to this commit, but has
now been tested and improved with refactoring and logging messages.

Note that this approach emulates Bitcoin Core's own behavior. When
running, for example, `bitcoind -conf=rel/path/to/bitcoin.conf`, the
relative path is prefixed / fully qualified by the value of the
`datadir` option. So if `datadir` equals `~/Library/Application
Support/Bitcoin`, then the `conf` option value above would be fully
qualified as

    ~/Library/Application Support/Bitcoin/rel/path/to/bitcoin.conf

If the argument to `-conf` is an absolute path, e.g.
`/tmp/bitcoin.conf`, then that absolute path is used without further
modification or qualification. It is assumed that the rationale for this
behavior is to avoid accidentally running against the wrong conf file
because `bitcoind` was invoked in a different directory than usual or
because a malicious actor replaced the relative conf file with their own
version.

Bisq's new `--configFile` option works (and is now tested to work) in
the same way: relative paths get prefixed by the value of
Config.getAppDataDir(), and absolute paths are processed unmodified.
2020-01-20 16:47:52 +01:00
Chris Beams
e1f54e95b1
Rename and reorder test for nonexistent --configFile
This test is now named consintently and sorted next to other config file
tests.
2020-01-20 16:47:52 +01:00
Chris Beams
94603768cb
Move Config.getOsUserDataDir to BisqExecutable.osUserDataDir
This method is used only by BisqExecutable and so has been moved there,
made private and documented accordingly.
2020-01-20 16:47:52 +01:00
Chris Beams
876b91e1be
Introduce LocalBitcoinNode and tests
This new class encapsulates all functionality related to detecting a
local Bitcoin node and reporting whether or not it was detected.
Previously this functionality was spread across the Config class
(formerly BisqEnvironment) with its mutable static
isLocalBitcoinNodeRunning property and the BisqSetup class with its
checkIfLocalHostNodeIsRunning method. All of this functionality now
lives within the LocalBitcoinNode class, an instance of which is wired
up via Guice and injected wherever necessary.

Note that the code for detecting whether the node is running has been
simplified, in that it is no longer wrapped in its own dedicated Thread.
There appears to be no performance benefit from doing so, and leaving it
in place would have made testing more difficult than necessary.

Several methods in BisqSetup have also been refactored to accept
callbacks indicating which step should be run next. This has the effect
of clarifying when the step2()-step5() methods will be called.
2020-01-20 16:47:52 +01:00
Chris Beams
4ea3290608
Introduce and document static Config.appDataDir()
See Javadoc added in this change and the previous commit message for
further detail and context.
2020-01-20 16:46:58 +01:00
Chris Beams
42a037e19f
Introduce and document static Config.baseCurrencyNetwork()
Previously this static property had been managed within
BaseCurrencyNetwork itself and was accessed directly by callers. Now it
is managed within Config, made private and accessed only via the
new and well-documented baseCurrencyNetwork() method. The same goes for
baseCurrencyNetworkParameters().

It is unfortunate that we must retain these mutable static fields and
accessors, but after trying to eliminate them entirely, this approach is
the lesser of two evils; attempting to use a Config instance and
instance methods only ends up being quite cumbersome to implement,
requiring Config to be injected into many more classes than it currently
is. Getting access to the BaseCurrencyNetwork is basically a special
case, and treating it specially as a static field is in the end the most
pragmatic approach.
2020-01-20 16:46:58 +01:00
Chris Beams
3a6b0ce9d8
Normalize creation of appDataDir and subdirs
Prior to this commit, the way that the appDataDir and its subdirectories
were created was a haphazard process that worked but in a fragile and
non-obvious way. When Config was instantiated, an attempt to call
btcNetworkDir.mkdir() was made, but if appDataDir did not already exist,
this call would always fail because mkdir() does not create parent
directories. This problem was never detected, though, because the
KeyStorage class happened to call mkdirs() on its 'keys' subdirectory,
which, because of the plural mkdirs() call ended up creating the whole
${appDataDir}/${btcNetworkDir}/keys hierarchy. Other btcNetworkDir
subdirectories such as tor/ and db/ then benefited from the hierarchy
already existing when they attempted to call mkdir() for their own dirs.
So the whole arrangement worked only because KeyStorage happened to make
a mkdirs() call and because that code in KeyStorage happened to get
invoked before the code that managed the other subdirectories.

This change ensures that appDataDir and all its subdirectories are
created up front, such that they are guaranteed to exist by the time
they are injected into Storage, KeyStorage, WalletsSetup and TorSetup.
The hierarchy is unchanged, structured as it always has been:

    ${appDataDir}
    └── btc_mainnet
        ├── db
        ├── keys
        ├── wallet
        └── tor

Note that the tor/ subdirectory actually gets deleted and re-created
within the TorSetup infrastructure regardless of whether the directory
exists beforehand.
2020-01-20 16:46:57 +01:00
Chris Beams
174d2a98e6
Add comments to Config and reorder a few things
This adds a few basic comments to help understand the structure of the
Config class and also reorders several assignments and statements for
clarity.
2020-01-20 16:46:57 +01:00
Chris Beams
a02eea9410
Extract Config.APP_DATA_DIR constant 2020-01-20 16:46:57 +01:00
Chris Beams
e67746b0a4
Remove TestConfig in favor of reworked Config ctors 2020-01-20 16:46:57 +01:00
Chris Beams
47794174a1
Remove ConnectionConfig console output 2020-01-20 16:46:57 +01:00
Chris Beams
b5503a5aa4
Replace HelpRequested exception with Config.isHelpRequested() 2020-01-20 16:46:57 +01:00
Chris Beams
3f605f873f
Remove now unused BisqExecutable option handling
Option handling is now the responsibility of the Config class. JOpt's
OptionParser is no longer passed down to BisqExecutable subclasses'
doExecute method, as they can now rely on the Config abstraction.
2020-01-20 16:46:56 +01:00
Chris Beams
7382344618
Catch ConfigException as contingency, Throwble as fault
Previously the code under bisq.common.config threw a mix of
ConfigException and IllegalArgumentException. It now throws
ConfigException consistently such that it may be caught and dealt with
as an anticipated contingency, and such that any other Throwable may be
caught and dealt with as a fault, i.e. an unexpected error that probably
represents a bug in the code.

The https://bisq.network/issues link presented to the user when a fault
occurs is a redirect added to the website by PR
https://github.com/bisq-network/bisq-website/pull/316.

For background on contingency vs. fault nomenclature, see:
https://www.oracle.com/technical-resources/articles/enterprise-architecture/effective-exceptions-part3.html
2020-01-20 16:46:56 +01:00
Chris Beams
022b5f1908
Make ConfigException extend BisqException
To avoid the need to manually use String.format during construction.
2020-01-20 16:46:56 +01:00
Chris Beams
75ab51de1a
Replace use of Spring's StringUtils 2020-01-20 16:41:20 +01:00
Chris Beams
2c7829948b
Replace uses of Spring CollectionUtils
See Javadoc in new bisq.common.util.CollectionUtils class.
2020-01-20 16:41:19 +01:00
Chris Beams
f5a1854762
Remove now unused BisqEnvironment class
In previous commits, BisqEnvironment functionality has been fully ported
to the new, simpler and more type-safe Config class. This change removes
BisqEnvironment and all dependencies on the Spring Framework Environment
interface that it implements.

The one exception is the pricenode module, which is separate and apart
from the rest of the codebase in that it is a standalone, Spring-based
HTTP service.
2020-01-20 16:41:19 +01:00
Chris Beams
15c492b5b4
Finish moving 'daoActivated' option handling to Config 2020-01-20 16:40:31 +01:00
Chris Beams
aadf7c76aa
Move 'genesisTotalSupply' option handling to Config 2020-01-20 16:40:31 +01:00
Chris Beams
ca5b260806
Move 'genesisBlockHeight' option handling to Config 2020-01-20 16:40:31 +01:00
Chris Beams
6ea146444f
Move 'genesisTxId' option handling to Config 2020-01-20 16:40:31 +01:00
Chris Beams
519259b752
Move 'fullDaoNode' option handling to Config 2020-01-20 16:40:31 +01:00
Chris Beams
2995bc27bd
Move 'dumpBlockchainData' option handling to Config 2020-01-20 16:40:31 +01:00
Chris Beams
9a7eedb250
Move 'rpcBlockNotificationHost' option handling to Config 2020-01-20 16:40:30 +01:00
Chris Beams
3841e6b1dd
Move 'rpcBlockNotificationPort' option handling to Config 2020-01-20 16:40:30 +01:00
Chris Beams
86e1ae1008
Move 'rpcPort' option handling to Config 2020-01-20 16:40:30 +01:00
Chris Beams
182f472394
Move 'rpcHost' option handling to Config 2020-01-20 16:40:30 +01:00
Chris Beams
b4d4ca4fbe
Move 'rpcPassword' option handling to Config 2020-01-20 16:40:30 +01:00
Chris Beams
80754ed3d5
Move 'rpcUser' option handling to Config 2020-01-20 16:40:30 +01:00
Chris Beams
99cf8c9596
Move 'numConnectionsForBtc' option handling to Config
Note that this change makes the user-facing change of renaming
the 'numConnectionForBtc' (singular 'Connection') to
'numConnectionsForBtc' (plural 'Connections'). It is presumed that not
many users are relying on this option for day-to-day operations, and the
singular version was pretty clearly a typo / oversight.
2020-01-20 16:40:29 +01:00
Chris Beams
c8d739ded5
Move 'userAgent' option handling to Config 2020-01-20 16:39:36 +01:00
Chris Beams
97cafaf61e
Move 'useAllProvidedNodes' option handling to Config 2020-01-20 16:39:35 +01:00
Chris Beams
b7889dd994
Move 'socks5DiscoverMode' option handling to Config 2020-01-20 16:39:35 +01:00
Chris Beams
90031543b9
Move 'useTorForBtc' option handling to Config 2020-01-20 16:39:35 +01:00
Chris Beams
5271d4d574
Move 'btcNodes' option handling to Config 2020-01-20 16:39:35 +01:00
Chris Beams
4fb60a33ac
Finish moving 'ignoreLocalBtcNode' option handling to Config 2020-01-20 16:39:35 +01:00
Chris Beams
85285890d1
Move Config.log declaration 2020-01-20 16:39:35 +01:00
Chris Beams
769c62b7b3
Finish moving 'bitcoinRegtestHost' option handling to Config 2020-01-20 16:39:34 +01:00
Chris Beams
be97190415
Rename Config.{NULL_INT=>DEFAULT_INT} for clarity 2020-01-20 16:39:34 +01:00
Chris Beams
3002b16776
Make defaultUserDataDir field a local variable 2020-01-20 16:39:34 +01:00
Chris Beams
2dbd72b358
Move message throttle option handling to Config 2020-01-20 16:39:34 +01:00
Chris Beams
ca3719a139
Move 'torStreamIsolation' option handling to Config 2020-01-20 16:39:33 +01:00
Chris Beams
25604c1b29
Move 'torControlUseSafeCookieAuth' option handling to Config 2020-01-20 16:39:33 +01:00
Chris Beams
e90b2566a9
Move 'torControlCookieFile' option handling to Config 2020-01-20 16:39:33 +01:00
Chris Beams
5966d0ddcb
Move 'torControlPassword' option handling to Config 2020-01-20 16:39:33 +01:00
Chris Beams
d25ad0d266
Move 'torControlPort' option handling to Config
Note the introduction of Config.NULL_INT to avoid needing to inject
nullable boxed Integers in cases like this.
2020-01-20 16:39:33 +01:00
Chris Beams
923ec69966
Move 'torrcOptions' option handling to Config 2020-01-20 16:39:33 +01:00
Chris Beams
fea3a641c0
Move 'torrcFile' option handling to Config 2020-01-20 16:39:33 +01:00
Chris Beams
5a0683e984
Move 'socks5ProxyHttpAddress' option handling to Config 2020-01-20 16:39:32 +01:00
Chris Beams
5c02b12043
Move 'socks5ProxyBtcAddress' option handling to Config 2020-01-20 16:39:32 +01:00
Chris Beams
8d6dbad484
Move 'maxConnections' option handling to Config 2020-01-20 16:39:32 +01:00
Chris Beams
0e48a3ef2c
Move 'useLocalhostForP2P' option handling to Config 2020-01-20 16:39:32 +01:00
Chris Beams
ef7196ef8a
Finish moving 'nodePort' option handling to Config 2020-01-20 16:39:32 +01:00
Chris Beams
c56c06d939
Move 'banList' option handling to Config 2020-01-20 16:39:32 +01:00
Chris Beams
e118165e9a
Move 'seedNode' option handling to Config
And eliminate @Named injection in favor of calling config.getSeedNodes()
2020-01-20 16:39:31 +01:00
Chris Beams
7be2ff19f8
Remove now unused CommonOptionKeys class 2020-01-20 16:39:31 +01:00
Chris Beams
f6319fe66f
Finish moving 'logLevel' option handling to Config 2020-01-20 16:39:31 +01:00
Chris Beams
a720475871
Move 'providers' option handling to Config
This option should be renamed to 'priceNodes' or similar, but is out of
scope here.
2020-01-20 16:39:31 +01:00
Chris Beams
051c53278e
Move 'ignoreDevMsg' option handling to Config 2020-01-20 16:39:31 +01:00
Chris Beams
849bd7c286
Move 'maxMemory' option handling to Config
Note that the default value of 600 advertised in BisqExecutable's option
handling was incorrect. The actual value had since become 1200 MB. This
correct default is now reflected in Config's option handling.
2020-01-20 16:39:30 +01:00