Commit Graph

3978 Commits

Author SHA1 Message Date
sqrrm
809e1c83d1
Dump delayed payout tx hashes to file
Use a separate file, delayed_payout_txs, to write all txs and their
delayed payout tx hashes as json. This will enable users to publish
locked txs when their data dir has been corrupted, as long as the trade
data is there.
2020-01-30 16:16:57 +01:00
sqrrm
afac8e5a30
Add dumpDelayedPayoutTxs config option 2020-01-30 15:40:23 +01:00
Christoph Atteneder
1d9fda74b9
Not expose offer fee tx id in UI or JSON export 2020-01-29 14:50:09 +01:00
Christoph Atteneder
2887ab0bc5
Not add the deposit transaction id to the trade statistics object 2020-01-29 14:46:35 +01:00
Christoph Atteneder
3374f1b65c
Remove deprecated code parts
As we don't have any arbitrators connected to the network anymore it shouldn't possible to use arbitration anymore
2020-01-29 13:44:25 +01:00
beingindot
e890c4138d
Refactoring of and function in ValidationResult class (#3838)
* Refactoring of and function in ValidationResult

This function didnt have terminating short circuit which is important
for and operator functions. Also this function gets called multiple
times since it's validation function. hence improving needed here.

After verifying usages, left out following two classes
1. PercentageNumberValidator - since it's using only two validation
2. PhoneNumberValidator - have variable inputs and this is only place.

* Fix code format issue

Co-authored-by: Christoph Atteneder <christoph.atteneder@gmail.com>
2020-01-29 11:27:01 +01:00
Christoph Atteneder
b0f3a5036b
Merge pull request #3907 from wiz/liquid
List Liquid Bitcoin (L-BTC)
2020-01-29 10:53:06 +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
525fbe2bf2
Merge pull request #3904 from wiz/remove-third-party-btcnodes
Remove btcnodes not operated by Bisq btcnode team members
2020-01-27 15:47: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
wiz
6fa31b34d7
Add L-BTC popup requiring users to disclose amountblinder key to mediators 2020-01-23 04:17:02 +09: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
wiz
0adf889f94
Add L-BTC to list of main crypto currencies 2020-01-21 22:20:22 +09: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
efba975813
Avoid race condition in LocalBitcoinNodeTests
Previously, Travis CI was failing non-deterministically due to a race
condition in which a thread was started in order to call the blocking
ServerSocket.accept() method, and sometimes the subsequent attempt by
LocalBitcoinNode.detectAndRun() to connect to that socket's port would
occur before the thread had actually called the accept() method.

This commit simplifies the approach by removing the thread entirely. As
it turns out, calling accept() is not necessary; simply constructing a
new ServerSocket() binds to and listens on the given port, such that a
subsequent attempt to connect() will succeed.
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
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
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
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
e67746b0a4
Remove TestConfig in favor of reworked Config ctors 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
6d6d41b329
Broaden BisqExcutable exception handling
Previously, certain exceptions e.g. IllegalArgumentException would
result in the Bisq process exiting with an stack trace. This change
broadens exception handling during argument parsing such that all
Throwable subclasses are caught and the Bisq process exits gracefully
with a simple error message.
2020-01-20 16:46:56 +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
1216ba2e2c
Finish moving 'referralId' option handling to Config 2020-01-20 16:40:32 +01:00
Chris Beams
c6d042568a
Finish moving 'useDevMode' option handling to Config 2020-01-20 16:40:32 +01:00
Chris Beams
9ff6dd2c82
Finish moving 'useDevPrivilegeKeys' option handling to Config 2020-01-20 16:40:32 +01:00
Chris Beams
43fb851514
Remove now unused DaoOptionKeys class 2020-01-20 16:40:32 +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
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
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
769c62b7b3
Finish moving 'bitcoinRegtestHost' option handling to Config 2020-01-20 16:39:34 +01:00
Chris Beams
326375e4e4
Remove now unused NetworkOptionKeys class 2020-01-20 16:39:34 +01:00
Chris Beams
8e4107d80a
Remove obsolete NETWORK_ID option key
NETWORK_ID has not been in use since commit de93a6fa1, except by
the DummySeedNode test class, where its use has been preserved as string
literals.
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
a2f5d5a77a
Remove now unused AppOptionKeys class 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
13db7672a6
Remove unused 'desktopWithHttpApi' option handling 2020-01-20 16:39:30 +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
Chris Beams
6a20013c77
Finish moving 'appName' option handling to Config 2020-01-20 16:39:30 +01:00
Chris Beams
1842c47b2b
Remove long-unused core.btc.UserAgent class
This was added way back in 8f8866da and has since fallen out of use
entirely.

Removing it now because it depends on BisqEnvironment.appName, which
will be moved to Config in the next commit.
2020-01-20 16:39:30 +01:00
Chris Beams
e0766af5d0
Finish moving 'userDataDir' option handling to Config 2020-01-20 16:39:30 +01:00
Chris Beams
a194107646
Finish moving 'appDataDir' option handling to Config
NOTE: This removes entirely the old BisqExecutable.appDataDir method
implemented for the v0.5.3 hotfix that renames the data dir from 'bisq'
to 'Bisq'. See a7f3d68cb for details.
2020-01-20 16:39:30 +01:00
Chris Beams
ceac8bb9e2
Finish moving baseCurrencyNetwork option handling to Config 2020-01-20 16:39:29 +01:00
Chris Beams
e2781c16c5
Move 'dumpStatistics' option handling from BisqEnvironment to Config 2020-01-20 16:39:29 +01:00
Chris Beams
6c1ef5921c
Remove BisqException parser calls for options already moved to Config
Set OptionParser.allowsUnrecognizedOptions(true) to make sure
BisqEnvironment doesn't fail while options are still being transferred
one-by-one to Config.
2020-01-20 16:39:29 +01:00
Chris Beams
f029fea386
Move 'useDevPrivilegeKeys' option handling from BisqEnvironment to Config 2020-01-20 16:39:29 +01:00
Chris Beams
f3e0b853db
Move 'btcNetworkDir' and co from BisqEnvironment to Config 2020-01-20 16:37:56 +01:00
Chris Beams
70bdccb258
Move 'useDevMode' option handling from BisqEnvironment to Config 2020-01-20 16:37:55 +01:00
Chris Beams
cdaa901a29
Move 'referralId' option handling from BisqEnvironment to Config 2020-01-20 16:37:55 +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
sqrrm
92466f96eb
Merge pull request #3888 from cbeams/grpc-poc
Introduce gRPC API proof of concept
2020-01-20 16:19:40 +01:00
Chris Beams
1e8633b03b
Organize io.grpc imports correctly
And remove entry for the no longer used io.bisq.generated package.
2020-01-20 12:16:57 +01:00
Chris Beams
9fceba63e2
Remove duplicate attempt to start BisqGrpcServer
Problem: a stack trace was being thrown during daemon startup from
BisqDaemonMain.onSetupComplete when it attempted to start a
second BisqGrpcServer and failed to bind to the already-bound port.
The first BisqGrpcServer is started in
BisqDaemonMain.onApplicationStarted much earlier in the startup process.

Solution: remove the second attempt to start the server by removing
BisqDaemonMain's implementation of onSetupComplete, and in turn remove
the now-obsolete bisqGrpcServer field as well.

This change also eliminates the BisqGrpcServer.blockUntilShutdown
method, which in turn called the underlying grpc server's
awaitTermination method. As the comment there explained, this was
thought to be necessary because grpc "does not use daemon threads by
default", but this is actually incorrect. According to the grpc Javadoc
at [1], "Grpc uses non-daemon Threads by default and thus a Server will
continue to run even after the main thread has terminated."

[1]: https://git.io/JePjn
2020-01-20 12:14:33 +01:00
Chris Beams
aff760514b
Sever dependency from :desktop => :grpc
The :grpc module will soon be renamed to :daemon. These two modules
represent two separate and equal modes of running bisq, either as a
desktop GUI or as a daemon. They are both applications, and one should
not depend on the other as it would be illogical and confusing to model
things that way. The reason for the current dependency from :desktop to
:grpc is because :grpc is the home of BisqGrpcServer. This change moves
this class up to :core, in a new bisq.core.grpc package, such that both
the :desktop and :daemon applications can pull it in cleanly.

The CoreApi 'facade' that BisqGrpcServer uses to abstract away bisq
internals has been moved from bisq.core to bisq.core.grpc as well and
for the same reasons detailed in 8b30c22d6.

This change also renames the Java package for generated grpc types from
bisq.grpc.protobuf to bisq.core.grpc (the same new package that
BisqGrpcServer and CoreApi now live in). Again, this is for reasons of
cohesion: BisqGrpcServer is the only user of these grpc-generated types,
and they should logically live in the same package (even if they
physically live in separate source dirs at the build level).
2020-01-20 12:12:09 +01:00
Chris Beams
7a718f0ed5
Move grpc generation from :grpc to :core
Such that :grpc (soon to be renamed to :daemon), :cli and :desktop can
access these types.
2020-01-20 12:07:55 +01:00
Chris Beams
8b30c22d6e
Move bisq.core{=>.app}.CoreModule
There are two structural / organizational reasons for this move:

 1. References from one package to another should always be upward or
 lateral, never downward, as the latter causes package cycles (aka
 'tangles') which damage the suppleness and understandability of a large
 codebase. Prior to this change the high-level bisq.core.CoreModule
 class imported many classes from child packages like
 bisq.core.{btc,dao,user,util}, etc. By moving CoreModule down into the
 '.app' package, it can reference all these other packages as siblings
 instead of doing so as a parent.

 2. the bisq.core.desktop and bisq.core.app packages are the only
 locations that reference the CoreModule class. By moving the class
 into bisq.core.app, greater cohesion is acheived, again making the
 codebase that much easier to read and understand.
2020-01-20 12:07:43 +01:00
wiz
9acc17bc1d
Remove 2 btcnodes not operated by active bisq contributors 2020-01-20 08:00:05 +09:00
Dominykas Mostauskis
86489e0d74
Improve readability of the daily burnt BSQ chart
Relevant issue thread: #3753

Currently the daily burnt BSQ chart under 'DAO -> Facts and Figures' is
distorted by outliers. This introduces a 'Zoom to inliers' toggle (off
by default), which, when toggled on, effectively zooms the chart to
inliers, thus removing the distortion. Also, a moving average is
plotted, to further improve the chart's readibility.

The chart is also changed from an area chart to a line chart, on the
presumption that it was an area chart for cosmetic reasons, but now that
there are two series in it (the moving average was added) an area chart
makes less sense.

Another noteworthy change is that the other chart in the screen, monthly
issued BSQ, has its Y axis set to start at zero, so as to improve
readability. This might seem outside the scope of this commit, but the
other changes involved some refactoring, which involved cleaning up some
duplicated logic, which involved configuring both of these charts
together, which involved forcing zero to be on the axis.

This implementation mixes some plotting logic (responsible for zooming
in on inliers) into the view logic, because I opted to implement said
zooming as an external manipulation of a chart's axis. I chose this in
favor of implementing a new Chart, because it would have required
including multiple large classes (relevant JavaFX's classes can't be
ergonomically extended) to the code base. I presumed that my chosen
solution will be easier to maintain.

I am not entirely happy with this choice and can see myself introducing
some plotting-related classes to encapsulate creating charts like these,
thus unmixing plotting logic from view logic. In the meantime this is a
working solution, and I plan to continue working on these charts in the
near future.
2020-01-18 15:35:56 +02:00
sqrrm
5233b85708
Merge pull request #3881 from bisq-network/release/v1.2.5
Release/v1.2.5
2020-01-15 13:09:15 +01:00
sqrrm
0ece6aa72b
Merge pull request #3895 from devinbileck/ignored-peers-and-btc-nodes
Validate ignored peers and BTC nodes
2020-01-14 15:18:47 +01:00
Christoph Atteneder
17c37db887
Merge branch 'master' of github.com:bisq-network/bisq into release/v1.2.5
# Conflicts:
#	core/src/main/resources/i18n/displayStrings_el.properties
2020-01-13 15:20:15 +01:00
Devin Bileck
61d20268f2
Revert to using provided BTC nodes if custom nodes are invalid
If the user entered an invalid hostname for a custom BTC node, such as a
V3 onion address, after restarting Bisq they would be presented with an
error due to the node being unreachable and unable to continue nor
correct the config.

So now a warning message will be shown in this situation informing the
user of an invalid config and once they restart their client they will
connect to the provided BTC nodes.

Fixes #3137
2020-01-12 22:58:34 -08:00
Devin Bileck
9e33ca9e43
Capitalize connection failed string 2020-01-12 22:52:33 -08:00
Devin Bileck
5e52dc58a8
Add input validation for ignored peers and BTC nodes
Ignored peers and BTC nodes input fields will now only accept IPv4 and
V2 onion addresses, with multiple addresses separated using a comma.
2020-01-12 22:52:32 -08:00
Chris Beams
65175a7f4f
Remove --desktopWith{Grpc|Http}Api options for now
The previous commit introduces the BisqGrpcServer as a proof of concept,
but it is not yet ready for production use. This commit removes the
`--desktopWithGrpcApi` option that starts the gRPC server until such
time that it is production-ready.

This change also removes the `--desktopWithHttpApi` option for starting
an HTTP API server. The option has been in place for some time, but it
was 'false advertising' in the sense that nothing actually happened if
the user specified it, because there is in fact no HTTP API
implementation to be started.

Note that when the gRPC API option is reintroduced, it will be renamed
to `--rpcserver` or similar, following the convention in Bitcoin Core.
2020-01-10 19:48:26 +01:00
chimp1984
5c02ce5766
Introduce gRPC API proof of concept
This commit introduces a new `grpc` module including the following key
types:

 - BisqGrpcServer: The API implementation itself, along with generated
   gRPC Response/Reploy types defined in grpc/src/main/proto/grpc.proto.

 - BisqGrpcServerMain: A 'headless' / daemon-like entry point for
   running a Bisq node without the JavaFX desktop UI.

 - BisqGrpcClient: A simple, repl-style client for the API that allows
   the user to exercise the various endpoints as seen in the example
   below.

In the `desktop` module, the BisqAppMain class has been modified to
start a BisqGrpcServer instance if the `--desktopWithGrpcApi` option has
been set to `true`.

In the `core` module, a new `CoreApi` class has been introduced
providing a kind of comprehensive facade for all Bisq functionality to
be exposed via the RPC API.

How to explore the proof of concept:

 1. Run the main() method in BisqAppMain providing
 `--desktopWithGrpcApi=true` as a program argument or alternatively, run
 the main() method in BisqGrpcServerMain, where no special option is
 required. In either case, you'll notice the following entry in the log
 output:

    INFO  bisq.grpc.BisqGrpcServer: Server started, listening on 8888

 2. Now run the main() method in BisqGrpcClient. Once it has started up
 you are connected to the gRPC server started in step 1 above. To
 exercise the API, type `getVersion` via stdin and hit return. You
 should see the following response:

    INFO bisq.grpc.BisqGrpcClient - 1.2.4

 Likewise, you can type `getBalance` and you'll see the following
 response:

    INFO bisq.grpc.BisqGrpcClient - 0.00 BTC

 and so forth for each of the implemented endpoints. For a list of
 implemented endpoints, see BisqGrpcServer.start().

Note once again that the code here is merely a proof of concept and
should not be considered complete or production-ready in any way. In a
subsequent commit, the `--desktopWithGrpcApi` option will be disabled in
order to avoid any potential production use.

The content of this commit is the result of squashing a number of
commits originally authored by chimp1984 in the `chimp1984` fork's `grpc`
branch.

Co-authored-by: Chris Beams <chris@beams.io>
2020-01-10 19:48:26 +01:00
wiz
4e30402d78
Dark mode isn't beta anymore 🎉 2020-01-09 20:56:21 +09:00
Christoph Atteneder
ffb346794a
Remove dead code 2020-01-08 21:39:28 +01:00
Christoph Atteneder
ce1e954236
Remove dead code 2020-01-08 21:23:02 +01:00
Christoph Atteneder
eada8d6a3d
Update bitcoinj checkpoints file 2020-01-08 09:13:52 +01:00
Christoph Atteneder
744173ce61
Merge pull request #3875 from wiz/disable-z33nukt7ngik3cpe-btcnode
Temporarily disable z33nukt7ngik3cpe btcnode due to failing service c…
2020-01-08 09:08:55 +01:00
Christoph Atteneder
9523c04788
Merge pull request #3874 from wiz/tweak-wiz-btcnode-clearnet
Update clearnet hostnames / IPs for 2 btcnodes operated by @wiz
2020-01-08 09:08:35 +01:00
Christoph Atteneder
c960e6d3fc
Merge pull request #3873 from wiz/add-m52go-btcnode
Add new 4nnuyxm5k5tlyjq3.onion:8333 btcnode operated by @m52go
2020-01-08 09:08:13 +01:00
Christoph Atteneder
40a1527d6c
Update translations 2020-01-08 09:04:35 +01:00
Christoph Atteneder
653b59b798
Remove Greek from supported core languages 2020-01-08 09:04:17 +01:00
wiz
14d20aaf39
Temporarily disable z33nukt7ngik3cpe btcnode due to failing service checks 2020-01-08 08:56:04 +01:00
wiz
f4a560bcbe
Migrated onions for my 2 btcnodes to new servers, only clearnet changed 2020-01-08 08:55:50 +01:00
wiz
87b6f080a0
Add new 4nnuyxm5k5tlyjq3.onion:8333 btcnode operated by @m52go 2020-01-08 08:55:34 +01:00
wiz
248ae1c63b
Add bsq.bisq.cc BSQ explorer operated by @m52go 2020-01-08 08:55:12 +01:00
wiz
b67f901f18
Temporarily disable z33nukt7ngik3cpe btcnode due to failing service checks 2020-01-08 07:57:41 +09:00
wiz
be59df4ff7
Migrated onions for my 2 btcnodes to new servers, only clearnet changed 2020-01-08 07:31:34 +09:00
wiz
e75bc14037
Add new 4nnuyxm5k5tlyjq3.onion:8333 btcnode operated by @m52go 2020-01-08 07:12:18 +09:00
wiz
5c6c5f77e8
Add bsq.bisq.cc BSQ explorer operated by @m52go 2020-01-08 06:47:33 +09:00
Christoph Atteneder
166d38f1e9
Use general "(required minimum)" label with BTC value if min value is used 2020-01-07 19:53:36 +01:00
Christoph Atteneder
4377a10007
Show minimum security deposit in create offer dialog when used
In the past we allowed the user to enter a percentage of the trade amount
although it wasn't used if the minimum security deposit was higher.
2020-01-07 19:53:14 +01:00
Christoph Atteneder
9ec10cf0e9
Add information if minimum trading fee or minimum security deposit is used 2020-01-07 19:53:07 +01:00
Christoph Atteneder
fe06e5888f
Use trading fee in BSQ fee comparison 2020-01-07 19:52:53 +01:00
Christoph Atteneder
e7c16a6fe7
Use general "(required minimum)" label with BTC value if min value is used 2020-01-07 18:20:33 +01:00
Christoph Atteneder
d904d1ee6a
Show minimum security deposit in create offer dialog when used
In the past we allowed the user to enter a percentage of the trade amount
although it wasn't used if the minimum security deposit was higher.
2020-01-07 17:30:00 +01:00
Christoph Atteneder
e6f491c8ac
Add information if minimum trading fee or minimum security deposit is used 2020-01-07 16:32:24 +01:00
Christoph Atteneder
02ac14e234
Use trading fee in BSQ fee comparison 2020-01-07 16:28:56 +01:00
wiz
7b5128652a Add BSQ explorers into v1.2.5 release (#3864)
* Add bsq.ninja BSQ explorer operated by @wiz

* Add bsq.bisq.services BSQ explorer

* Add bsq.sqrrm.net BSQ explorer operated by @sqrrm

* Add bsq.vante.me BSQ explorer operated by @mrosseel

* Add bsq.emzy.de BSQ explorer operated by @emzy

Co-authored-by: Devin Bileck <603793+devinbileck@users.noreply.github.com>
2020-01-07 14:30:24 +01:00
wiz
a4a5415a57
Add bsq.emzy.de BSQ explorer operated by @emzy 2020-01-06 22:27:50 +09:00
wiz
0c160d08ff
Add bsq.vante.me BSQ explorer operated by @mrosseel 2020-01-06 20:34:56 +09:00
wiz
44152fdb57
Add bsq.sqrrm.net BSQ explorer operated by @sqrrm 2020-01-06 19:44:25 +09:00
Devin Bileck
a55c3b5bc2
Add bsq.bisq.services BSQ explorer 2020-01-06 00:22:53 -08:00
wiz
f4b16d2308
Add bsq.ninja BSQ explorer operated by @wiz 2020-01-06 06:33:47 +09:00
wiz
988f920051
Check existence of selected block explorer using name string comparison
After further testing, I realized I introduced a bug in commit
4f4b0f6ce9 because apparently the
ArrayList.contains() method does not properly work for
BlockChainExplorer object - to fix this I implemented a new
contains() method that uses string comparison instead
2020-01-03 20:13:17 +01:00
wiz
c0783205bb
Check existence of selected block explorer using name string comparison
After further testing, I realized I introduced a bug in commit
4f4b0f6ce9 because apparently the
ArrayList.contains() method does not properly work for
BlockChainExplorer object - to fix this I implemented a new
contains() method that uses string comparison instead
2020-01-04 03:52:11 +09:00
Christoph Atteneder
8e2bad462a
Show the correct sign state icon for accounts that are able to sign (30+ days)
This behavior was different during development time and wasn't updated properly in the UI.
2020-01-03 12:00:35 +01:00
sqrrm
ae2e06de23
Merge pull request #3827 from chimp1984/use-min-refund-at-mediated-payout
Use min. refund at mediated payout
2020-01-03 11:17:49 +01:00
Christoph Atteneder
2792a20afb
Upgrade mempool.space to full block explorer (#3843)
* Upgrade mempool.space to full block explorer functionality

* Add mempool.space Tor V2 block explorer

* If no valid Bitcoin block explorer is set, use the 1st block explorer
2020-01-03 11:12:43 +01:00
Christoph Atteneder
4e905e872e
Merge pull request #3812 from stejbac/fix-some-doc-comment-tags
Fix doc comment warnings in TradeWalletService & OfferUtil
2020-01-03 10:25:14 +01:00
wiz
4f4b0f6ce9
If no valid Bitcoin block explorer is set, use the 1st block explorer 2020-01-03 18:17:41 +09:00
chimp1984
37ef8c0d85
Add comment 2020-01-03 02:13:40 +01:00
Pac
df49d5cdbd
Fix bank account number label for Swedish language
According to issue #3641, the label "Bankgiro number", as it was
hardcoded in BankUtil.java, should not be used in Sweden.
The label "Kontonummer" is the correct one to be used in Sweden and
Norway.

Account number validation is implemented to Norwegian accounts in
AccountNrValidator.java.
There is no validation implemented to Swedish accounts, so nothing
to change there.
If account validation for Sweden is needed, a different method would
be needed.

Fixes #3641
2020-01-02 17:29:58 -03:00
Christoph Atteneder
9a558472f6
Merge pull request #3830 from chimp1984/only-move-to-failed-trades-for-critical-reject-msg
Only move to failed trades if the reject msg is critical
2020-01-02 19:01:28 +01:00
sqrrm
3a74e74e15
Merge pull request #3828 from stejbac/speed-up-trade-charts-view-load
Speed up trades charts view load
2020-01-02 18:46:25 +01:00
sqrrm
eeea465a0c
Merge pull request #3826 from chimp1984/increase-security-deposits
Increase security deposits
2020-01-02 12:18:05 +01:00
sqrrm
567684172d
Merge pull request #3821 from chimp1984/handle-spv-resync-edge-cases
Improve handling of spv resync edge case
2020-01-02 12:04:31 +01:00
wiz
678b8b20bd
Add mempool.space Tor V2 block explorer 2019-12-31 22:16:05 +09:00
wiz
47d0f4f8cd
Upgrade mempool.space to full block explorer functionality 2019-12-31 21:25:49 +09:00
Christoph Atteneder
7980d1ee5d
Add 2 new columns to vote result (#3822)
* Add 2 new columns to vote result

Add threshold and quorum column.
Combine name and link column.
Add sorting function for accepted column.
Adjust column width.

* Fix sorting functions

* Improve column sorting
2019-12-27 19:05:36 +01:00
Christoph Atteneder
42cabe0077
Merge pull request #3813 from wiz/re-enable-kanocztomas-btcnode
Re-enable mbm6ffx6j5ygi2ck.onion btcnode operated by @KanoczTomas
2019-12-27 12:12:13 +01:00
chimp1984
7e44c60b10
Only move to failed trades if the reject msg is critical
We got a report where a "tx already known" message caused a failed
trade but the deposit tx was valid.
To avoid such false positives we only handle reject messages which
we consider clearly critical.
2019-12-24 23:08:45 -05:00
Steven Barclay
0bcf238d71
Optimise CurrencyUtil.get[Fiat|Crypto|Trade]Currency
Use a LinkedHashMap in place of a List, for the caching CurrencyUtil
fields 'allSortedFiatCurrencies' & 'allSortedCryptoCurrencies', using
the same iteration order as before. In this way, we can avoid a linear
search in the lookup methods getFiatCurrency & getCryptoCurrency.

In particular, this speeds up the activation of TradesChartsView (and to
a lesser extent OfferBookChartView), which make a lot of calls to
CurrencyUtil.getTradeCurrency in the fillTradeCurrencies/updateChartData
methods respectively.
2019-12-23 22:29:32 +00:00
chimp1984
47647a98f8
Improve text 2019-12-23 13:19:48 -05:00
chimp1984
fadd384443
Use min. refund at mediated payout
At mediation we require a min. payout to the losing party to keep
incentive for the trader to accept the mediated payout. For Refund
agent cases we do not have that restriction.
2019-12-23 12:55:55 -05:00
chimp1984
95a79a3536
Refactoring: Remove unused parameter 2019-12-23 12:00:58 -05:00
chimp1984
223441bb7d
Adjust security deposits
According to https://github.com/bisq-network/proposals/issues/155

For buyer:
Default: 15%
Min. 15% for Altcoin, 15% for Fiat
Max. 50% for Altcoin, 50% for Fiat
Absolute min. deposit in BTC: 0.006 BTC (currently 40 USD)

For Seller:
Fixed: 15%
Absolute min. deposit in BTC: 0.006 BTC (currently 40 USD)
2019-12-23 11:49:11 -05:00
Steven Barclay
24889c87d7
Remove unused fields passed as constructor params from various classes
These are mostly injected objects that are now redundant, such as some
CoinFormatter and Preferences fields.

Also do some additional minor tidying of TradesChartsViewModel.
2019-12-22 23:48:57 +00:00
chimp1984
31b618d862
Add 2 new columns to vote result
Add threshold and quorum column.
Combine name and link column.
Add sorting function for accepted column.
Adjust column width.
2019-12-21 19:27:28 -05:00
chimp1984
29a8b10cdc
Improve popup text 2019-12-21 17:51:18 -05:00
chimp1984
292ac30f85
Handle unconfirmed BSQ change at spv resync
In case we had an unconfirmed change output we reset the
unconfirmedBsqChangeOutputList so that after a SPV resync we do not
have any dangling BSQ utxos in that list which would cause an incorrect
BSQ balance state after the SPV resync.
2019-12-21 16:59:20 -05:00
chimp1984
de144143e5
Add button for shutdown
If a trader has a pending trade with an unconfirmed tx and is doing a
spv resync, the deposit tx is not found. They get displayed a popup
asking to restart and if problem continues to move trade to failed
trades. In regtest testing the missing deposit tx was always received
from the network at a restart. So this commit adds another button as
default button to shut down Bisq so that the user do first that activity
instead of moving the trade to failed trades.
It is not guaranteed that the trader will receive the missing deposit tx
at restart, but at least it is better as the state before. We should
find a way how to distinguish a valid unconfirmed tx from an invalid one
but it is not clear yet how we can do that and if it is feasible with
doing that with BitcoinJ only. It might require a external service to
look up the tx if it is in the mem pool, but even that will never gie a
100% certainty.
2019-12-21 16:17:12 -05:00
wiz
97b0651669
Re-enable mbm6ffx6j5ygi2ck.onion btcnode operated by @KanoczTomas
Fixes #3810
2019-12-20 02:10:10 +09:00
Steven Barclay
4b03f06af8
Fix doc comment warnings in TradeWalletService & OfferUtil
Add missing @param, @return and @throws tags and improve formatting.

(Also add some missing @Nullable method parameter annotations.)
2019-12-19 14:35:22 +00:00
Christoph Atteneder
334ebfc794
Merge pull request #3804 from SimoneBovi/days_repeated
Fix double presence of the word "days"
2019-12-19 10:36:29 +01:00
Christoph Atteneder
b5ddb630ef
Remove unused method parameters (#3806)
* Remove unused parameters from assorted methods

Exclude abstract or default methods, as well as cases where the
parameter is currently unused but is probably intended to be used later.

* Actually use the injected Clock param of isDateInTolerance

Use 'clock.millis()' instead of "new Date().getTime()" in SignedWitness
& AccountAgeWitness, as the latter may have been left as an oversight.

Also tidy the date field of the toString() methods.

* Suppress warnings of unused method params which may be needed later

Also fix forwarding of telescoping method parameters in FormBuilder and
FormattingUtils.
2019-12-19 10:23:16 +01:00
Simone Bovi
4b68f45f56
Fix double presence of the word days 2019-12-19 10:19:31 +01:00
Steven Barclay
d0a76b9ff2
Suppress warnings of unused method params which may be needed later
Also fix forwarding of telescoping method parameters in FormBuilder and
FormattingUtils.
2019-12-19 03:43:02 +00:00
Steven Barclay
cc7d0dec26
Actually use the injected Clock param of isDateInTolerance
Use 'clock.millis()' instead of "new Date().getTime()" in SignedWitness
& AccountAgeWitness, as the latter may have been left as an oversight.

Also tidy the date field of the toString() methods.
2019-12-19 03:43:02 +00:00
Steven Barclay
78d61e0958
Remove unused parameters from assorted methods
Exclude abstract or default methods, as well as cases where the
parameter is currently unused but is probably intended to be used later.
2019-12-19 03:42:54 +00:00
wiz
f85ef5b7eb
Fix random BSQ block explorer selection by setting Nullable 2019-12-18 17:54:00 +09:00
Christoph Atteneder
2782e58c65
Add user preference combobox for BSQ block explorer with random default (#3792)
* Add user preference combobox for BSQ block explorer with random default

* Remove betanet and testnet BSQ block explorers

* Always check if a valid BSQ block explorer is set
2019-12-18 08:55:33 +01:00
wiz
8b23cacd2c
Always check if a valid BSQ block explorer is set 2019-12-18 16:38:31 +09:00
Christoph Atteneder
543a11e1ec
Merge pull request #3777 from beingindot/revolut-phonenumber-validation
Revolut account should accept only phone number
2019-12-18 08:33:03 +01:00
beingindot
da683e8b49
Revolut account should accept only phone number
For issue #3728
	Till now we used to accept email or phone number
	Now we are accepting only phone number in input though
	for display we will provide backward compatibility.

	Added list of countries accepted from official revolut website
	https://www.revolut.com/en-US/help/getting-started/verifying-identity/what-countries-are-supported

	Based on the country selected, we will validate the given
	phone number input.
2019-12-17 21:02:39 +05:30
wiz
e41df654b0
Remove betanet and testnet BSQ block explorers 2019-12-17 19:41:32 +09:00
Christoph Atteneder
6f1dbf1c09
Add shortcut list (#3695)
* Remove short cut for legacy arbitrator registration

* Change shortcut for reRepublishAllGovernanceData

* Use isAltOrCtrlPressed for removeFailedTrade

* Remove showStatisticsPopup

This was useful for legacy arbitrators as they received the trade fee

* Cleanup

- Remove setColumnSpan for titledGroupBg
- Fix row length

* Add list of shortcuts

* Update comment

* Change "click" to "press"
2019-12-17 11:22:34 +01:00
Christoph Atteneder
20b56c7bde
Merge pull request #3773 from stejbac/add-tx-map-to-daostate
Add transient tx map to DaoState to speed up getTx queries
2019-12-16 15:21:03 +01:00
wiz
78a72a2cc8
Add user preference combobox for BSQ block explorer with random default 2019-12-16 00:19:13 +09:00
Christoph Atteneder
26291eb0ee
Not allow bitcoinj to auto connect to localhost when localhost was not detected by client
This fixes the problem if the local bitcoin core node is not detected by our client,
but bitcoinj is able to connect to it because of the auto connect to localhost behavior.
In that case the minimum required nodes to broadcast a transaction will be 4 (provided nodes settings),
but bitcoinj will only connect to one node. The requirement of 4 nodes will be never fulfilled and
the transaction never broadcasted.
2019-12-12 17:27:15 +01:00
Steven Barclay
b22e4ad113
Encapsulate mutable Block tx list and DaoState tx cache
Avoid mutating the Block tx list or the DaoState tx cache/index via a
Lombok getter. Instead wrap each in an unmodifiable[List|Map] & provide
specific mutator methods for use by DaoStateService to add newly parsed
transactions or load a DAO snapshot.

Also rename txMap to txCache, replace remaining use of getTxStream() in
the JSON file exporter with getUnorderedTxStream() (as this is safe) and
swap the arguments of the txCache initialisation merge function, for
exact consistency with the pre-caching behaviour.

Finally, add a missing assertDaoStateChange() and remove a potentially
harmful assertion from DaoStateService.onNewTxForLastBlock.

This is based on a suggested patch by @chimp1984 in the PR #3773 review.
2019-12-12 03:08:56 +00:00
Steven Barclay
4277cf83ca
Use unordered Tx stream from daoState.txMap wherever possible
Add getUnorderedTxStream() method to DaoStateService to stream directly
from the txMap cache/index wherever it is obviously safe to do so,
instead of iterating through the entire block list via getTxStream().

Also make getTxs() return a view of the txMap values in place of a copy.

This should improve efficiency slightly.
2019-12-11 12:44:34 +00:00
Steven Barclay
0fa21b5f1a
Add transient tx map to DaoState to speed up getTx queries
Build a HashMap of all BSQ transactions found, when loading the DaoState
from disc, and store it in a transient field which is always kept in
sync with the associated list of blocks. (The latter is only modified in
a couple of places in DaoStateService, making this straightforward.)

This is to speed up daoStateService.getTx(id), which is called from many
places and appears to be a significant bottleneck. In particular, the
initial load of the results in VoteResultView.doFillCycleList was very
slow (taking nearly a minute on a Core i3 machine) and likely to suffer
a quadratic slowdown (#cycles * #tx's) over time.
2019-12-11 11:26:08 +00:00
Christoph Atteneder
3fe84975ad
Merge pull request #3747 from julianknutsen/clean-up-pse-objs
(6/6) Clean up technical debt in P2PDataStorage and ProtectedStorageEntry objects
2019-12-09 20:34:26 +01:00
Florian Reimair
30f96643b2
Merge pull request #3771 from ripcurlx/fix-dark-mode-switch-plus-cleanup
Fixes dark mode switch after restart
2019-12-09 17:43:39 +01:00
Christoph Atteneder
b2c006d4a3
Update css theme property when read from data store 2019-12-09 15:44:52 +01:00
Christoph Atteneder
f398117147
Remove unnecessary indirection for setting custom withdrawal fees 2019-12-09 15:35:15 +01:00
Christoph Atteneder
af46a7f697
Merge pull request #3760 from wiz/ef5qnzx6znifo3df-transfer
Transfer seednode ef5qnzx6znifo3df.onion to @wiz and @emzy
2019-12-09 12:21:45 +01:00
sqrrm
b2ea064b93
Merge pull request #3745 from dmos62/master
Rename "Spread" tab to a more general "Details"
2019-12-07 14:44:01 +01:00
chimp1984
734b1f08f7
Change "click" to "press" 2019-12-06 23:35:05 -05:00
wiz
a34610ed98
Transfer seednode ef5qnzx6znifo3df.onion to @wiz and @emzy 2019-12-07 02:19:13 +09:00
sqrrm
2e196ec722
Merge pull request #3743 from ripcurlx/fix-refundagents-supported-language-warning
Display warning based on supported languages by mediators and refund agents
2019-12-06 15:34:32 +01:00
Christoph Atteneder
44b4f429da
Merge branch 'master' of github.com:bisq-network/bisq into release/v1.2.4
# Conflicts:
#	core/src/main/resources/i18n/displayStrings_zh-hant.properties
2019-12-06 11:30:10 +01:00
Dominykas Mostauskis
7e5422f0ef
Rename "Spread" tab to a more general "Details"
Because spread is one of many columns in the table, calling the whole tab spread is not general enough.
2019-12-05 13:27:35 +01:00
Christoph Atteneder
acd4350762
Update data stores, translations and bitcoinj checkpoints (#3748)
* Update bitcoinj checkpoint file

* Update translations

* Update data stores
2019-12-04 22:26:42 +01:00
Christoph Atteneder
87670c1e5e
Display warning based on supported languages by mediators and refund agents 2019-12-04 12:32:25 +01:00
Julian Knutsen
bfdb8f5715
Make isDataOwner a private policy decision in BroadcastHandler
isDataOwner is used when deciding how many peer nodes should receive
a BroadcastMessage. If the BroadcastMessage originated
on the local node it is sent to ALL peer nodes with a small delay.

If the node is only relaying the message (it originated on a different
node) it is sent to MAX(peers.size(), 7) peers with a delay that is
twice as long.

All the information needed to determine whether or not the
BroadcastMessage originated on the local node is available at the final
broadcast site and there is no reason to have callers pass it in.

In the event that the sender address is not known during broadcast (which
is only a remote possibility due to how early the local node address
is set during startup) we can default to relay mode.

This first patch just removes the deep parameters. The next will remove
everything else. There is one real change in LiteNodeNetworkService.java
where it was using the local node when it should have been using the
peer node. This was updated to the correct behavior.
2019-12-03 12:33:29 -08:00
Julian Knutsen
9f69134568
[REFACTOR] Clean up ClientAPI for refreshTTL
Remove isDataOwner from the client API. All users pass in true. All test
users don't care.
2019-12-03 12:30:07 -08:00
Julian Knutsen
77413c9671
[REFACTOR] Clean up ClientAPI for remove
Remove isDataOwner from the client API. All users pass in true. All test
users don't care.
2019-12-03 12:30:06 -08:00
Julian Knutsen
0e6b1a2044
[REFACTOR] Clean up ClientAPI for addProtectedStorageEntry
Remove isDataOwner from the client API. All users pass in true. All test
users don't care.
2019-12-03 12:30:06 -08:00
Julian Knutsen
ecae31eddb
[RENAME] LazyProcessedPayload to ProcessOncePersistableNetworkPayload
Name is left over from previous implementation. Change it to be more
relevant to the current code and update comments to indicate the
current usage.
2019-12-03 12:20:41 -08:00
wiz
f0cbddc545
Add Chinese Traditional file to update_translations.sh script 2019-12-03 12:01:02 +01:00
wiz
2d188000c2
Add zh-hant translations (Chinese Traditional) 2019-12-03 12:00:54 +01:00
wiz
ba492b88e6
Adjust update_translations.sh language tags for script/regional variants 2019-12-03 11:50:55 +01:00
wiz
0bf75aeb42
Fix language tags so script and regional variants work correctly 2019-12-03 11:50:45 +01:00
wiz
4dab4fc25e
Add Chinese Traditional file to update_translations.sh script 2019-12-03 19:49:47 +09:00
wiz
62fde1e7ab
Add zh-hant translations (Chinese Traditional) 2019-12-03 19:49:44 +09:00
Christoph Atteneder
5a0db50d3c
Update strings to reflect bisq is exchange network (#3681)
* Update strings to reflect bisq is exchange network

Motivated by changes done to the website, as described in
https://github.com/bisq-network/bisq-website/pull/280

* Use lowercase 'bitcoin'

Based on feedback mentioned in this comment:
https://github.com/bisq-network/bisq-website/pull/280#discussion_r351491215
2019-12-03 11:43:47 +01:00
Christoph Atteneder
d8e19c4e8c
Use correct language tags for script and regional language variants (#3716)
* Fix language tags so script and regional variants work correctly

* Adjust update_translations.sh language tags for script/regional variants

ACKs for top commit:
  @ripcurlx:
    ACK 089232716d
2019-12-03 11:37:32 +01:00
chimp1984
c2e8806d16
Add handling of mediationResultState to isFundsLockedIn
Fixes https://github.com/bisq-network/bisq/issues/3721
(part of the problem was that the trade ended up in failed trade)

Refactor method and add comments.
We did not handle the case of a mediated payout. isPayoutPublished() is
only reflecting non-disputed trade payouts.
2019-12-02 11:58:12 +01:00
chimp1984
04c02589aa
Refactoring: Replace isGreaterThan(Coin.ZERO) with isPositive() 2019-12-02 11:57:25 +01:00
chimp1984
fdc582a60e
Do not add an output if value is 0 BTC
Fixes https://github.com/bisq-network/bisq/issues/3721 and
https://github.com/bisq-network/bisq/issues/3722

There are still more issues as such a payout tx will cause that the
trade ends up in failed trades. This commit only fixes the invalid
tx issue.
2019-12-02 11:57:12 +01:00
Christoph Atteneder
51982fdcd6
Merge pull request #3726 from chimp1984/do-not-move-mediated-trades-to-failed-trades
Add handling of mediationResultState to isFundsLockedIn
2019-12-02 11:12:21 +01:00
chimp1984
9ac64e5e3e
Add handling of mediationResultState to isFundsLockedIn
Fixes https://github.com/bisq-network/bisq/issues/3721
(part of the problem was that the trade ended up in failed trade)

Refactor method and add comments.
We did not handle the case of a mediated payout. isPayoutPublished() is
only reflecting non-disputed trade payouts.
2019-12-01 19:23:45 -05:00
chimp1984
c126f0ec09
Refactoring: Replace isGreaterThan(Coin.ZERO) with isPositive() 2019-12-01 18:34:58 -05:00
chimp1984
bfa123bf6c
Do not add an output if value is 0 BTC
Fixes https://github.com/bisq-network/bisq/issues/3721 and
https://github.com/bisq-network/bisq/issues/3722

There are still more issues as such a payout tx will cause that the
trade ends up in failed trades. This commit only fixes the invalid
tx issue.
2019-12-01 18:34:13 -05:00
wiz
089232716d
Adjust update_translations.sh language tags for script/regional variants 2019-11-29 11:34:22 +09:00
wiz
9d25041746
Fix language tags so script and regional variants work correctly 2019-11-29 11:29:21 +09:00
Devin Bileck
e443b8fade
Use lowercase 'bitcoin'
Based on feedback mentioned in this comment:
https://github.com/bisq-network/bisq-website/pull/280#discussion_r351491215
2019-11-27 22:36:53 -08:00
Steve Jain
548a217751
Replace arbitration link in tac
With link to v1.2 dispute resolution documentation.
2019-11-27 10:30:39 +01:00
chimp1984
88cbecd8ed
Use 2of2 multisig deposit tx version for manual payout
With v1.2 we use 2of2 multisig for deposit tx. This commit changes the
manual payout window to reflect that.

- Remove unused code from legacy arbitration
- Fix comments
2019-11-27 10:30:25 +01:00
Christoph Atteneder
e00ae654d4
Merge pull request #3696 from m52go/fix-ua-arblink
Replace arbitration link in tac
2019-11-27 09:11:15 +01:00
Christoph Atteneder
c131a890f2
Update translations 2019-11-27 08:54:35 +01:00
Christoph Atteneder
cf3a13e08a
Update bitcoinj checkpoints file 2019-11-27 08:51:49 +01:00
Steve Jain
4c27da7644
Replace arbitration link in tac
With link to v1.2 dispute resolution documentation.
2019-11-26 23:33:25 -05:00
chimp1984
a67b960df9
Update comment 2019-11-26 15:47:21 -05:00
chimp1984
477f9de23a
Use 2of2 multisig deposit tx version for manual payout
With v1.2 we use 2of2 multisig for deposit tx. This commit changes the
manual payout window to reflect that.

- Remove unused code from legacy arbitration
- Fix comments
2019-11-26 13:33:30 -05:00
chimp1984
91b76d4231
Add list of shortcuts 2019-11-26 12:51:57 -05:00
Christoph Atteneder
06f0d6b191
Reputation BSQ added to BSQ Wallet screen (#3366)
* BSQ Merit now displayed - fixes issue #3352

* Broke merit text setting to 2 lines.

* Fix formatting
2019-11-26 15:50:35 +01:00
Christoph Atteneder
a7b9cfdec7
Merge pull request #3676 from chimp1984/dont-show-rejected-bonded-roles
Only show accepted bonded roles in bond view.
2019-11-26 14:43:54 +01:00
Christoph Atteneder
e0a92ca9fe
Prevent taking of offers with unequal bank account types (excl. SEPA) (#3673)
* Use strict stubbing for ReceiptValidatorTest to avoid confusion

Remove redundant stubs from the MoneyGram and Western Union tests and
ensure that all such stubs result in failure. In particular, the 'offer'
mock is never accessed directly by ReceiptValidator.

* Prevent taking of offers with unequal bank account types

Use stricter criteria when deciding which of the taker's accounts (if
any) are valid for a given offer. Specifically, prevent National Bank
accounts from being used to take Same / Specific Bank(s) offers, so the
three payment method types can never being mixed.

This prevents an error on the trading peer when the trade starts, due to
enforcement of equal maker & taker payment method IDs (except for SEPA)
in the Contract payload constructor.

This partially addresses #3602, where the erroneous peer response causes
the taker to be presented with a confusing timeout.
2019-11-26 14:39:18 +01:00
Christoph Atteneder
62aea83308
Cleanup fmxlview and javax imports (#3661)
* Remove @FxmlView from abstract view classes

* Use generic javax imports for DI

* Additional cleanup of redundant DI annotations
2019-11-26 14:36:01 +01:00
Christoph Atteneder
66b2306ed9
P2PDataStorage and FileManager improvements (#3690)
* [PR COMMENTS] Make maxSequenceNumberBeforePurge final

Instead of using a subclass that overwrites a value, utilize Guice
to inject the real value of 10000 in the app and let the tests overwrite
it with their own.

* [TESTS] Clean up 'Analyze Code' warnings

Remove unused imports and clean up some access modifiers now that
the final test structure is complete

* [REFACTOR] HashMapListener::onAdded/onRemoved

Previously, this interface was called each time an item was changed. This
required listeners to understand performance implications of multiple
adds or removes in a short time span.

Instead, give each listener the ability to process a list of added or
removed entrys which can help them avoid performance issues.

This patch is just a refactor. Each listener is called once for each
ProtectedStorageEntry. Future patches will change this.

* [REFACTOR] removeFromMapAndDataStore can operate on Collections

Minor performance overhead for constructing MapEntry and Collections
of one element, but keeps the code cleaner and all removes can still
use the same logic to remove from map, delete from data store, signal
listeners, etc.

The MapEntry type is used instead of Pair since it will require less
operations when this is eventually used in the removeExpiredEntries path.

* Change removeFromMapAndDataStore to signal listeners at the end in a batch

All current users still call this one-at-a-time. But, it gives the ability
for the expire code path to remove in a batch.

* Update removeExpiredEntries to remove all items in a batch

This will cause HashMapChangedListeners to receive just one onRemoved()
call for the expire work instead of multiple onRemoved() calls for each
item.

This required a bit of updating for the remove validation in tests so
that it correctly compares onRemoved with multiple items.

* ProposalService::onProtectedDataRemoved signals listeners once on batch removes

#3143 identified an issue that tempProposals listeners were being
signaled once for each item that was removed during the P2PDataStore
operation that expired old TempProposal objects. Some of the listeners
are very expensive (ProposalListPresentation::updateLists()) which results
in large UI performance issues.

Now that the infrastructure is in place to receive updates from the
P2PDataStore in a batch, the ProposalService can apply all of the removes
received from the P2PDataStore at once. This results in only 1 onChanged()
callback for each listener.

The end result is that updateLists() is only called once and the performance
problems are reduced.

This removes the need for #3148 and those interfaces will be removed in
the next patch.

* Remove HashmapChangedListener::onBatch operations

Now that the only user of this interface has been removed, go ahead
and delete it. This is a partial revert of
f5d75c4f60 that includes the code that was
added into ProposalService that subscribed to the P2PDataStore.

* [TESTS] Regression test for #3629

Write a test that shows the incorrect behavior for #3629, the hashmap
is rebuilt from disk using the 20-byte key instead of the 32-byte key.

* [BUGFIX] Reconstruct HashMap using 32-byte key

Addresses the first half of #3629 by ensuring that the reconstructed
HashMap always has the 32-byte key for each payload.

It turns out, the TempProposalStore persists the ProtectedStorageEntrys
on-disk as a List and doesn't persist the key at all. Then, on
reconstruction, it creates the 20-byte key for its internal map.

The fix is to update the TempProposalStore to use the 32-byte key instead.
This means that all writes, reads, and reconstrution of the TempProposalStore
uses the 32-byte key which matches perfectly with the in-memory map
of the P2PDataStorage that expects 32-byte keys.

Important to note that until all seednodes receive this update, nodes
will continue to have both the 20-byte and 32-byte keys in their HashMap.

* [BUGFIX] Use 32-byte key in requestData path

Addresses the second half of #3629 by using the HashMap, not the
protectedDataStore to generate the known keys in the requestData path.

This won't have any bandwidth reduction until all seednodes have the
update and only have the 32-byte key in their HashMap.

fixes #3629

* [DEAD CODE] Remove getProtectedDataStoreMap

The only user has been migrated to getMap(). Delete it so future
development doesn't have the same 20-byte vs 32-byte key issue.

* [TESTS] Allow tests to validate SequenceNumberMap write separately

In order to implement remove-before-add behavior, we need a way to
verify that the SequenceNumberMap was the only item updated.

* Implement remove-before-add message sequence behavior

It is possible to receive a RemoveData or RemoveMailboxData message
before the relevant AddData, but the current code does not handle
it.

This results in internal state updates and signal handler's being called
when an Add is received with a lower sequence number than a previously
seen Remove.

Minor test validation changes to allow tests to specify that only the
SequenceNumberMap should be written during an operation.

* [TESTS] Allow remove() verification to be more flexible

Now that we have introduced remove-before-add, we need a way
to validate that the SequenceNumberMap was written, but nothing
else. Add this feature to the validation path.

* Broadcast remove-before-add messages to P2P network

In order to aid in propagation of remove() messages, broadcast them
in the event the remove is seen before the add.

* [TESTS] Clean up remove verification helpers

Now that there are cases where the SequenceNumberMap and Broadcast
are called, but no other internal state is updated, the existing helper
functions conflate too many decisions. Remove them in favor of explicitly
defining each state change expected.

* [BUGFIX] Fix duplicate sequence number use case (startup)

Fix a bug introduced in d484617385 that
did not properly handle a valid use case for duplicate sequence numbers.

For in-memory-only ProtectedStoragePayloads, the client nodes need a way
to reconstruct the Payloads after startup from peer and seed nodes. This
involves sending a ProtectedStorageEntry with a sequence number that
is equal to the last one the client had already seen.

This patch adds tests to confirm the bug and fix as well as the changes
necessary to allow adding of Payloads that were previously seen, but
removed during a restart.

* Clean up AtomicBoolean usage in FileManager

Although the code was correct, it was hard to understand the relationship
between the to-be-written object and the savePending flag.

Trade two dependent atomics for one and comment the code to make it more
clear for the next reader.

* [DEADCODE] Clean up FileManager.java

* [BUGFIX] Shorter delay values not taking precedence

Fix a bug in the FileManager where a saveLater called with a low delay
won't execute until the delay specified by a previous saveLater call.

The trade off here is the execution of a task that returns early vs.
losing the requested delay.

* [REFACTOR] Inline saveNowInternal

Only one caller after deadcode removal.
2019-11-26 14:34:32 +01:00
Florian Reimair
d12843a74c
Merge pull request #3682 from ripcurlx/improve-account-signing
Improve account signing security
2019-11-26 12:50:12 +01:00
Devin Bileck
70296a94af
Update strings to reflect bisq is exchange network
Motivated by changes done to the website, as described in
https://github.com/bisq-network/bisq-website/pull/280
2019-11-25 00:28:50 -08:00
chimp1984
ff10f7cf3f
Only show accepted bonded roles in bond view.
Fixes #3271

Replaces https://github.com/bisq-network/bisq/pull/3320
2019-11-24 13:10:10 -05:00
Justin Carter
fe00f4aac9
Use correct monetary format in BsqFormatter
Also remove logic regarding base currency. Only BTC is currently
supported so there is no need to keep the logic around.
2019-11-24 07:59:02 +01:00
Steven Barclay
fc7d31ef83
Prevent taking of offers with unequal bank account types
Use stricter criteria when deciding which of the taker's accounts (if
any) are valid for a given offer. Specifically, prevent National Bank
accounts from being used to take Same / Specific Bank(s) offers, so the
three payment method types can never being mixed.

This prevents an error on the trading peer when the trade starts, due to
enforcement of equal maker & taker payment method IDs (except for SEPA)
in the Contract payload constructor.

This partially addresses #3602, where the erroneous peer response causes
the taker to be presented with a confusing timeout.
2019-11-24 05:08:42 +00:00
Steven Barclay
e5afb17269
Use strict stubbing for ReceiptValidatorTest to avoid confusion
Remove redundant stubs from the MoneyGram and Western Union tests and
ensure that all such stubs result in failure. In particular, the 'offer'
mock is never accessed directly by ReceiptValidator.
2019-11-24 02:22:11 +00:00
Justin Carter
d4e7f86ff6
Use generic javax imports for DI 2019-11-22 14:50:21 +01:00
Christoph Atteneder
0ac6bf1307
Only allow seller side to sign accounts
This prevents a scammer to use publicly known account details
(without being in control of the account) as a seller to get
signed by a buyer. The money received in the seller account might
not be detected by the legitimate owner and/or the money not sent back.
30 days later the scammer could use this signed account as seed to peer sign other stolen accounts.
2019-11-22 11:32:43 +01:00
Christoph Atteneder
46ce873b01
Add additional trade amount limit for trades that qualify for account signing
Should make it easier to detect by a stolen bank account owner as buyer that an outgoing transactions is taking place.
2019-11-22 11:26:46 +01:00
Julian Knutsen
e212240b88
[BUGFIX] Reconstruct HashMap using 32-byte key
Addresses the first half of #3629 by ensuring that the reconstructed
HashMap always has the 32-byte key for each payload.

It turns out, the TempProposalStore persists the ProtectedStorageEntrys
on-disk as a List and doesn't persist the key at all. Then, on
reconstruction, it creates the 20-byte key for its internal map.

The fix is to update the TempProposalStore to use the 32-byte key instead.
This means that all writes, reads, and reconstrution of the TempProposalStore
uses the 32-byte key which matches perfectly with the in-memory map
of the P2PDataStorage that expects 32-byte keys.

Important to note that until all seednodes receive this update, nodes
will continue to have both the 20-byte and 32-byte keys in their HashMap.
2019-11-20 16:15:52 -08:00
Dimitris Apostolou
587b55d37b
Fix typos and cleanup 2019-11-20 22:56:19 +02:00
Julian Knutsen
a8139f3a04
Remove HashmapChangedListener::onBatch operations
Now that the only user of this interface has been removed, go ahead
and delete it. This is a partial revert of
f5d75c4f60 that includes the code that was
added into ProposalService that subscribed to the P2PDataStore.
2019-11-19 08:37:40 -08:00
Julian Knutsen
a50e59f7eb
ProposalService::onProtectedDataRemoved signals listeners once on batch removes
#3143 identified an issue that tempProposals listeners were being
signaled once for each item that was removed during the P2PDataStore
operation that expired old TempProposal objects. Some of the listeners
are very expensive (ProposalListPresentation::updateLists()) which results
in large UI performance issues.

Now that the infrastructure is in place to receive updates from the
P2PDataStore in a batch, the ProposalService can apply all of the removes
received from the P2PDataStore at once. This results in only 1 onChanged()
callback for each listener.

The end result is that updateLists() is only called once and the performance
problems are reduced.

This removes the need for #3148 and those interfaces will be removed in
the next patch.
2019-11-19 08:37:39 -08:00
Julian Knutsen
b281566e14
[REFACTOR] HashMapListener::onAdded/onRemoved
Previously, this interface was called each time an item was changed. This
required listeners to understand performance implications of multiple
adds or removes in a short time span.

Instead, give each listener the ability to process a list of added or
removed entrys which can help them avoid performance issues.

This patch is just a refactor. Each listener is called once for each
ProtectedStorageEntry. Future patches will change this.
2019-11-19 08:37:38 -08:00
Justin Carter
80fda1ec2c
Inject CoinFormatter via BTC_FORMATTER_KEY 2019-11-19 15:54:18 +01:00