Commit Graph

283 Commits

Author SHA1 Message Date
chimp1984
3cf6c60354
Add NetworkFilter, remove BanList 2021-01-01 16:51:05 -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
44a9756f80
Apply code inspection suggestions
Add checks if optional is present
2020-10-24 13:20:29 -05:00
chimp1984
37952c8dd0
Use networkPostfix for file name 2020-10-24 13:03:52 -05:00
chimp1984
832bc83e93
Add ifPresent check at optional 2020-10-24 13:03:03 -05:00
chimp1984
9a018ccd47
Adopt to new PersistenceManager 2020-10-22 14:49:16 -05:00
chimp1984
f3e0696078
Reorg imports, reformat code according to your style guide 2020-10-22 11:38:34 -05:00
Florian Reimair
6c1d7509a1
Cleanup and refactoring 2020-10-22 11:36:26 -05:00
Florian Reimair
292f057f22
Added volume-per-trader metric 2020-10-22 11:36:26 -05:00
Florian Reimair
1f1b7390f0
Added offers-per-trader metric 2020-10-22 11:36:26 -05:00
Florian Reimair
3674d36a91
Added offer-volume-distribution 2020-10-22 11:36:26 -05:00
Florian Reimair
ac27ea69ec
Added offer volume feed metric 2020-10-22 11:36:26 -05:00
Florian Reimair
7c5043063a
Code cleanup 2020-10-22 11:36:25 -05:00
chimp1984
8baf34a643
Fix missing params 2020-10-21 13:41:50 -05:00
chimp1984
39c8ade5ef
Cleanups: Remove outdated TODOs, fix typos 2020-10-08 22:00:57 -05:00
chimp1984
197d8c1e0d
Remove copy&past mistake 2020-10-08 18:49:15 -05:00
chimp1984
58d2f1bda9
Apply codacy suggestions
@ripcurl: The complaint about private constructors (using guice this is legit) should be removed IMO.
2020-10-08 18:49:15 -05:00
chimp1984
52be126667
Apply TradeStatistics3 to client classes 2020-10-08 18:49:13 -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
cfda0aff68
Fix tests 2020-10-08 18:23:03 -05:00
chimp1984
270e89a25a
Fix wrong params 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
fe4c21b35c
Use PersistenceManager 2020-10-03 12:48:20 -05:00
chimp1984
27c2cb894c
Use PersistenceManager 2020-10-03 12:48:20 -05:00
chimp1984
802dcad2fb
Refactor: Rename CorruptedDatabaseFilesHandler 2020-10-03 12:48:14 -05:00
chimp1984
23507102dd
Refactor: Move CorruptedDatabaseFilesHandler 2020-10-03 12:48:14 -05:00
Oscar Guindzberg
f1738f0b19
Code polishing to make Codacy happier 2020-09-18 18:29:38 -03:00
Oscar Guindzberg
423ffa84e1
bitcoinj 0.15: Futures.addCallback() in guava 28 requires an executor. 2020-09-18 18:29:27 -03:00
Florian Reimair
a7f72cf6bd
Set expiry date to +years 2020-03-31 17:10:26 +02:00
wiz
623a7bb11b
Fix nginx.conf for collectd so it only listens on 127.0.0.1 2020-02-28 12:44:52 +09:00
wiz
21101f460c
Add pricenode one-command installer script, systemd service, README (#3997)
* Add pricenode one-command installer script, systemd service, README

* Update pricenode/bisq-pricenode.service

Co-Authored-By: Florian Reimair <office@florianreimair.at>

* Update pricenode/install_pricenode_debian.sh

Co-Authored-By: Florian Reimair <office@florianreimair.at>

Co-authored-by: Florian Reimair <office@florianreimair.at>
2020-02-26 12:16:26 +01:00
Florian Reimair
794302678d
Monitoring install scripts (#3985)
* Install script for collectd

* Install script for network size metric

* Apply suggestions from code review

Co-Authored-By: wiz <j@wiz.biz>

* Update monitor/install_collectd_debian.sh

Co-Authored-By: wiz <j@wiz.biz>

* Apply suggestions from code review

Co-Authored-By: wiz <j@wiz.biz>

Co-authored-by: wiz <j@wiz.biz>
2020-02-20 16:48:56 +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
919c58eefe
Remove now unused BtcOptionKeys class
Includes cleaning up a couple unrelated unused imports in
P2PNetworkLoad.
2020-01-20 16:40:29 +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
ceac8bb9e2
Finish moving baseCurrencyNetwork option handling to Config 2020-01-20 16:39:29 +01:00
Chris Beams
b34d59c0a9
Introduce Config as replacement for BisqEnvironment
Prior to this commit, BisqExecutable has been responsible for parsing
command line and config file options and BisqEnvironment has been
responsible for assigning default values to those options and providing
access to option values to callers throughout the codebase.

This approach has worked, but at considerable costs in complexity,
verbosity, and lack of any type-safety in option values. BisqEnvironment
is based on the Spring Framework's Environment abstraction, which
provides a great deal of flexibility in handling command line options,
environment variables, and more, but also operates on the assumption
that such inputs have String-based values.

After having this infrastructure in place for years now, it has become
evident that using Spring's Environment abstraction was both overkill
for what we needed and limited us from getting the kind of concision and
type saftey that we want. The Environment abstraction is by default
actually too flexible. For example, Bisq does not want or need to have
environment variables potentially overriding configuration file values,
as this increases our attack surface and makes our threat model more
complex. This is why we explicitly removed support for handling
environment variables quite some time ago.

The BisqEnvironment class has also organically evolved toward becoming a
kind of "God object", responsible for more than just option handling. It
is also, for example, responsible for tracking the status of the user's
local Bitcoin node, if any. It is also responsible for writing values to
the bisq.properties config file when certain ban filters arrive via the
p2p network. In the commits that follow, these unrelated functions will
be factored out appropriately in order to separate concerns.

As a solution to these problems, this commit begins the process of
eliminating BisqEnvironment in favor of a new, bespoke Config class
custom-tailored to Bisq's needs. Config removes the responsibility for
option parsing from BisqExecutable, and in the end provides "one-stop
shopping" for all option parsing and access needs.

The changes included in this commit represent a proof of concept for the
Config class, where handling of a number of options has been moved from
BisqEnvironment and BisqExecutable over to Config. Because the migration
is only partial, both Config and BisqEnvironment are injected
side-by-side into calling code that needs access to options. As the
migration is completed, BisqEnvironment will be removed entirely, and
only the Config object will remain.

An additional benefit of the elimination of BisqEnvironment is that it
will allow us to remove our dependency on the Spring Framework (with the
exception of the standalone pricenode application, which is Spring-based
by design).

Note that while this change and those that follow it are principally a
refactoring effort, certain functional changes have been introduced. For
example, Bisq now supports a `--configFile` argument at the command line
that functions very similarly to Bitcoin Core's `-conf` option.
2020-01-20 16:37:54 +01:00
Julian Knutsen
a0fae12068
Remove @Nullable around persistableNetworkPayloadSet
Checking for null creates hard-to-read code and it is simpler to just
create an empty set if we receive a pre-v0.6 GetDataResponse protobuf
message that does not have the field set.
2019-12-03 12:20:41 -08:00
Christoph Atteneder
42dfc6a158
Get monitor up to speed again (#3633)
* Updated price node list for monitor

* Price monitor is more resilient against timeouts

Recenty, a price node got removed. Unfortunately, this node
has been the first in the list of configured price nodes in
the monitor configuration.

A misplaced catch block caused the loop to stop instead of
trying the next configured price node in the list.

* Monitor selects a price node randomly

Up until now, the monitor always chose the price nodes
in their configured order. This resulted in querying
always the same node and thus, create a bigger system
load for this very node. Only in case of a failure,
the monitor moved on to another node.

Shuffling the list of nodes prior to querying provides
at least some load balancing for the price nodes.

* Fixed monitor market API query

The format of the market API response changed. Formerly,
there has been one line, now it is pretty print json.

* Add RefundAgent messages to monitor

Add the relatively new RefundAgent message to the monitor.

* Adjust monitor timeout

Observed, that a timeout of one minute works better than
the original 90 seconds.
2019-11-21 09:42:40 +01:00
Dimitris Apostolou
ce8804b418
Fix typos and cleanup 2019-11-20 01:24:48 +02:00
Florian Reimair
b0c68e0b5a
Adjust monitor timeout
Observed, that a timeout of one minute works better than
the original 90 seconds.
2019-11-19 12:12:09 +01:00
Florian Reimair
debb94f0a6
Add RefundAgent messages to monitor
Add the relatively new RefundAgent message to the monitor.
2019-11-19 12:10:55 +01:00
Florian Reimair
97586ff8dd
Fixed monitor market API query
The format of the market API response changed. Formerly,
there has been one line, now it is pretty print json.
2019-11-19 12:01:09 +01:00
Florian Reimair
edefcdb368
Monitor selects a price node randomly
Up until now, the monitor always chose the price nodes
in their configured order. This resulted in querying
always the same node and thus, create a bigger system
load for this very node. Only in case of a failure,
the monitor moved on to another node.

Shuffling the list of nodes prior to querying provides
at least some load balancing for the price nodes.
2019-11-19 11:48:58 +01:00
Florian Reimair
74b84159ca
Price monitor is more resilient against timeouts
Recenty, a price node got removed. Unfortunately, this node
has been the first in the list of configured price nodes in
the monitor configuration.

A misplaced catch block caused the loop to stop instead of
trying the next configured price node in the list.
2019-11-19 11:45:01 +01:00
Florian Reimair
cf575966dc
Updated price node list for monitor 2019-11-19 11:44:21 +01:00
Christoph Atteneder
ec5e2b76d4
Avoid unchecked casts/assignments/calls (#3626)
* Don't extend ActivatableViewAndModel when the model is empty

Remove the no-arg constructor from ActivatableViewAndModel, which sets
a dummy Activatable singleton as the model. (Since the model type param
can't be checked at runtime, improper use of the constructor could cause
heap pollution.)

Instead, extend 'ActivatableView<R, Void>' consistently, as other views
without a model currently do.

* Improve type safety of the fluent interface of Overlay<T>

Refactor all the unchecked casts from Overlay<T> to T into a single
private cast() method. Also add a runtime type check to the constructor
to prevent creation of window objects of the form "A extends Overlay<B>"
for unrelated A & B, as such casts would then subvert the type system.

* Improve type safety of ProtoUtil.collectionToProto(Collection)

Add a Class<T> parameter to the method, in order to avoid an unchecked
cast to the Message type T. The cast was wrapped in a try-catch block,
which is useless due to erasure, so use Class.cast(..) instead.

* Avoid raw types to prevent unchecked casts in Log.java

Add missing ILoggingEvent type arg to local variable declarations.

* Avoid unchecked casts when deserializing JSON using Gson

* Fix unchecked casts in views due to raw chart point types

Add missing 'Number' coord type args to some XYChart.(Data|Series) &
AreaChart declarations, and avoid passing them as generic varargs, in
order to eliminate some more unchecked cast warnings.

Also simplify OfferBookChartView.updateChartData() by unboxing the x-
coordinate of each (buy & sell) datapoint.

* Avoid raw type bounds in class declarations to fix unchecked warnings

Make sure the generic classes MutableOfferView & AgentRegistrationView
don't use raw bounds for their associated view models, as that leads to
unchecked assignments from the model fields further down.

* Fix some remaining suppressed unchecked casts in the UI logic

(This still leaves a few more which are hard to avoid.)

* Fix a few remaining unsuppressed unchecked warnings
2019-11-18 15:41:23 +01:00
Steven Barclay
5e69073280
Fix a few remaining unsuppressed unchecked warnings 2019-11-17 22:00:40 +00:00
Julian Knutsen
10eb9c0d01
Use Clock in ProtectedStorageEntry
Switch from System.currentTimeMills() to
Clock.millis() so dependency injection can
be used for tests that need finer control of time.

This involves attaching a Clock to the resolver
so all fromProto methods have one available when they
reconstruct a message. This uses the Injector for the APP
and a default Clock.systemDefaultZone is used in the manual
instantiations.

Work was already done in #3037 to make this possible.

All tests still use the default system clock for now.
2019-11-12 15:58:01 -08:00
Christoph Atteneder
95304ff98c
Merge pull request #3302 from freimair/monitor
Monitor fixes
2019-09-26 13:41:25 +02:00