Commit Graph

6591 Commits

Author SHA1 Message Date
Christoph Atteneder
ded4c072cb
Merge pull request #5965 from MwithM/patch-2
Include penalty for exceeding transfer limits
2022-01-24 10:30:18 +01:00
ghubstan
3e14bd3fbe
Change var name 2022-01-23 17:05:55 -03:00
ghubstan
0e020e8987
Add payout fields to trade proto msgs, show optional trade/tx fees in swaps 2022-01-23 17:03:43 -03:00
ghubstan
fadaaf9151
Display tx-fee from BsqSwapProtocolModel 2022-01-22 16:22:41 -03:00
ghubstan
6e0299642e
Fill out gettrades-help.txt 2022-01-22 16:03:34 -03:00
ghubstan
69e6c9ce70
Remove duplicated buyer/seller proto fields (already exist no OfferInfo) 2022-01-20 16:50:08 -03:00
ghubstan
2e7346a695
Fix comments 2022-01-20 15:54:19 -03:00
Christoph Atteneder
fd42c4507d
Merge pull request #5966 from jmacxx/tor_bridges_fix
Tor bridges preferences fix
2022-01-20 18:15:17 +01:00
Christoph Atteneder
300b4aa613
Merge pull request #5975 from ripcurlx/update-data-stores-for-v1.8.1
Update data stores for v1.8.1
2022-01-20 18:12:18 +01:00
Christoph Atteneder
58dca6fd1b
Merge pull request #5981 from Emzy/master
update hostname of BSQ explorer mempool.emzy.de
2022-01-20 09:49:50 +01:00
Christoph Atteneder
638d638d25
Use isFiat method for checking if it is a fiat method 2022-01-20 09:48:13 +01:00
Christoph Atteneder
cad973efd1
Not create and publish account age witnesses for BSQ swap accounts 2022-01-20 09:48:02 +01:00
Stephan Oeste
6637806019
update hostname ob BSQ explorer
The new version 2.3.0 of mempool.space supports BSQ exporer only on a separate domain.
update URL to http://bisq.mempool.emzy.de/....

There is a redirect from the old location to the new one. 
So nothing is broken and the PR is low prio.
2022-01-19 17:32:49 +01:00
Christoph Atteneder
5e158e8300
Use isFiat method for checking if it is a fiat method 2022-01-19 16:55:09 +01:00
ghubstan
3cd1e05a9f
Try to display accurate status of closed trades, or "Pending" if still open 2022-01-18 13:01:42 -03:00
Christoph Atteneder
b7af53d22f
Update bitcoinj checkpoints for v1.8.1 2022-01-18 11:33:16 +01:00
Christoph Atteneder
1f22f89bb4
Not create and publish account age witnesses for BSQ swap accounts 2022-01-18 11:29:41 +01:00
ghubstan
d98d795c77
Add server impl for gettrades (open|closed), refactor getrole methods 2022-01-16 16:46:45 -03:00
ghubstan
fdd94fe1f2
Remove commented code 2022-01-16 16:44:18 -03:00
ghubstan
a9e7484aee
Add buyer/seller dep & status-desc fields to TradeInfo 2022-01-16 16:43:34 -03:00
ghubstan
5c217793c8
Add buyer/seller dep & status-desc fields to TradeInfoV1Builder 2022-01-16 16:42:34 -03:00
ghubstan
a53fee345f
Add List<OpenOffer> getCanceledOpenOffers() ClosedTradableManager 2022-01-16 16:41:53 -03:00
ghubstan
50bbbfe6c4
Add List<Trade> getTrades() to TradeManager (w/out transitive jfx dep) 2022-01-16 16:41:09 -03:00
ghubstan
b4fa52f4e4
Add List<Trade> getTrades() to FailedTradesManager (w/out transitive jfx dep) 2022-01-16 16:39:07 -03:00
jmacxx
684fd39c75
Force persistence write when editing Tor Bridge settings.
This is necessary because Tor settings are edited before the app has
completed startup and normally persistence is prohibited.
2022-01-16 11:52:44 -06:00
MwithM
7d1e8a1649
Include penalty for exceeding transfer limits
Nequi payment method did not include that there might be a penalty for exceeding the transfer limits. I have used the same wording for every payment method.
2022-01-13 20:01:21 +01:00
Christoph Atteneder
efac836fa2
Update translations for v1.8.1 2022-01-12 10:54:00 +01:00
Christoph Atteneder
63a241a64e
Remove unused translation keys 2022-01-12 10:47:11 +01:00
Bisq GitHub Admin
808c3ad9d9
Merge pull request #5930 from xyzmaker123/modify-accepted-countries
SEPA Account - editable account name and accepted countries
2022-01-12 10:32:20 +01:00
Bisq GitHub Admin
8401b3885b
Merge pull request #5870 from jmacxx/mediation_payout_ux
Improve user experience once mediation has been accepted by both parties
2022-01-12 10:23:02 +01:00
Bisq GitHub Admin
ddead5ef54
Merge pull request #5953 from jmacxx/logs_upload
Feature enabling log file upload to mediators
2022-01-12 09:41:32 +01:00
jmacxx
d9ad531b3c
Fix issue of space in file path 2022-01-11 09:23:49 -06:00
Christoph Atteneder
a1d0e570d1
Apply minor improvements and clean-ups 2022-01-11 12:36:44 +01:00
Christoph Atteneder
310b9a97f2
Merge pull request #5949 from jmacxx/fix_trade_fee_validation
Fix trade fee validation bug
2022-01-11 11:09:09 +01:00
Christoph Atteneder
4a3e29daf5
Improve wording of trade completed notification popups 2022-01-11 11:02:55 +01:00
Christoph Atteneder
9759cebc4d
Remove unused translations 2022-01-11 10:48:06 +01:00
Christoph Atteneder
5c26c635e5
Merge pull request #5961 from ghubstan/2-api-fail-unfail-trade
Add API methods 'failtrade', 'unfailtrade' + test case (#2)
2022-01-10 12:29:54 +01:00
Christoph Atteneder
96878e5789
Merge pull request #5957 from jmacxx/fix_issue_5956
Wording for Bsq swap cancellation popups & withdrawal prompt
2022-01-10 12:01:33 +01:00
xyzmaker123
1da71f6c66
SEPA Account - possibility to modify account name 2022-01-10 10:52:39 +01:00
xyzmaker123
b3bf1903be
SEPA Account - possibility to modify accepted countries 2022-01-10 10:52:25 +01:00
jmacxx
3ea1543882
fixes for Windows compatability, test added 2022-01-07 19:42:24 -06:00
ghubstan
7690ffd953
Add API methods 'failtrade', 'unfailtrade'
Prerequisite for next PR: Add API method 'gettrades'

The `gettrades` method will show 'open', 'closed', and 'failed' trades.
Users already needed to be able to fail and unfail trades for the
same reasons they do in the UI.  API test cases will need to be able to
fail and unfail trades to check correct behavior of 'gettrades' method.

Based on branch `rename-keepfunds2closetrade`.
2022-01-07 19:11:34 -03:00
jmacxx
99b4071bdf
Wording for Bsq swap cancellation popups & withdrawal prompt 2022-01-07 10:03:14 -06:00
jmacxx
9334cffc89
Feature enabling log file upload to mediators 2022-01-06 13:22:44 -06:00
ghubstan
a9aaba87fa
Rename API method keepfunds -> closetrade
Trade proceeds and deposits have already been transfered to Bisq wallets
before the `keepfunds` command is (was) executed;  `keepfunds` merely moves
open trades to closed trades lists and persistence files.  Renaming `keepfunds`
as `closetrade` makes its purpose clear to API users.

The commit modifies only method names and comments in api server+cli classes,
apitest cases, and api trade simulation scripts.

Based on `master`
2022-01-05 12:10:46 -03:00
jmacxx
298aca40bc
Fix trade fee validation bug when two BSQ UTXOs used to pay the fee.
A test has been added to validate the UTXO issue above.
Other tests have been updated as a result of the changes in PR 5826
where fee parameter is now supplied from a filter; this results
in more accurate (less lenient) fee checking.
2022-01-04 09:25:05 -06:00
Christoph Atteneder
dde48f7d9e
Merge pull request #5935 from jmacxx/dao_state_store_and_statistics
Improve DAO state store persistence and statistics logging [chimp1984]
2022-01-03 12:24:18 +01:00
Stan
53d693d710
Merge branch 'master' into 7-deprecate-api-getmyoffer 2021-12-27 12:09:22 -03:00
ghubstan
5f571cccca
Deprecate API 'getmyoffer'
The method 'getoffer' should support looking up a user's open-offers, and other users' available offers.

- Adjust api-beta-test-guide.md to use only 'getoffer'.
- Adjust trade simulation scripts to use only 'getoffer'.
- Adjust api testcases to use 'getoffer' in place of 'getmyoffer'.
- Mark appropriate methods and protobuf msgs as deprecated.
2021-12-27 12:05:17 -03:00
jmacxx
1162060e28
Simplify the trade complete summary dialog 2021-12-24 14:22:59 -06:00
jmacxx
9378fe4603
Patch from chimp1984 improving the DaoState persistence 2021-12-23 14:40:11 -06:00
Christoph Atteneder
23d1856a60
Merge pull request #5852 from ghubstan/create-swift-acct-with-api
Support and test creation of Swift accounts via API
2021-12-20 11:49:20 +01:00
KanoczTomas
dfbde480c6
Remove trailing spaces. 2021-12-18 23:41:33 +01:00
KanoczTomas
364560e348
Correct typo in list/array of nodes 2021-12-18 22:37:04 +01:00
KanoczTomas
6969ed7a84
Add @KanoczTomas btc node with onion v3 address 2021-12-14 23:58:07 +01:00
sqrrm
cf81fd451c
Merge pull request #5876 from ghubstan/5-api-bsqswap-simulation-n-docs-update
API BSQ swap simulation script and doc updates #5
2021-12-14 15:47:51 +01:00
Christoph Atteneder
a7c38630e8
Merge branch 'master' of github.com:bisq-network/bisq into release/v1.8.0
Conflicts:
	core/src/main/resources/i18n/displayStrings_pl.properties
2021-12-13 11:51:16 +01:00
chimp1984
97e4ed5a59
Revert usage of File.separator
File.separator doesn't appear to work on Windows. It has to be "/", not "\".
See: https://github.com/bisq-network/bisq/pull/5909#pullrequestreview-827992563
2021-12-09 20:07:21 +01:00
chimp1984
0f65567e1a
In case the BSQ blocks directory does not exist in resources (as in case of REG_TEST)
we do not want to log an error stacktrace but just an info message.

Use `File.separator` instead of "/"
2021-12-09 20:07:20 +01:00
chimp1984
225b78317f
Revert usage of File.separator
File.separator doesn't appear to work on Windows. It has to be "/", not "\".
See: https://github.com/bisq-network/bisq/pull/5909#pullrequestreview-827992563
2021-12-09 13:13:37 -05:00
chimp1984
d74bffb595
In case the BSQ blocks directory does not exist in resources (as in case of REG_TEST)
we do not want to log an error stacktrace but just an info message.

Use `File.separator` instead of "/"
2021-12-09 11:04:55 -05:00
Christoph Atteneder
eb074ac0e2
Merge pull request #5908 from ripcurlx/update-data-stores-for-v1.8.0-again
Update data stores for v1.8.0 (again, again)
2021-12-09 16:03:39 +01:00
chimp1984
444d045c4f
At shutdown the executor can throw a RejectedExecutionException which
is expected as we shut down the executor immediately.
If not thrown at shutdown or exception is not a RejectedExecutionException
we log a warning and re-throw the exception (to avoid change of behaviour
of current version). The exception is likely not handled by callers and goes up to
the uncaught exception handler.
2021-12-09 10:10:06 +01:00
Bisq GitHub Admin
be4cbcdcec
Merge pull request #5901 from chimp1984/handle-RejectedExecutionException-in-RpcService
Add Exception handling at RpcService
2021-12-09 10:09:24 +01:00
Steven Barclay
e07c7b5d4b
Fix BSQ blocks resync from resources on Windows & Linux
Prevent a "URI is not hierarchical" IllegalArgumentException from the
expression, 'new File(dirUrl.toURI())', which occurs on Linux & Windows
when listing the resource directory of BSQ blocks. Adapt a solution from
StackOverflow which uses two separate code paths depending on the
environment, into the new method 'FileUtil::listResourceDirectory'.

The issue is caused by the resource URL taking one of the two forms:

  file:/Users/[USER]/Java/bisq/bisq/p2p/out/production/resources/BsqBlocks_BTC_MAINNET
  jar:file:...p2p.jar!/BsqBlocks_BTC_MAINNET

depending on whether the system is OSX or not.
2021-12-09 09:52:30 +01:00
Christoph Atteneder
601163eeb3
Merge pull request #5900 from stejbac/fix-resync-blocks-from-resources
Fix resync BSQ blocks from resources
2021-12-09 09:51:51 +01:00
Christoph Atteneder
7d66264453
Update data stores for v1.8.0 (again, again) 2021-12-08 21:13:21 +01:00
chimp1984
81d112bdf3
Add null checks
Return early at connection if stopped
Cleanup logs
2021-12-08 19:39:37 +01:00
chimp1984
ee1371276f
Reduce timeouts
Add logs when shutdown starts
2021-12-08 19:39:37 +01:00
chimp1984
d5d60b59cc
Extract duplicated code at shutdown
Move timeout before shutdown sequence starts and use a Timer thread instead of
UserThread to avoid that in case the UserThread gets blocked that the timeout
would not get triggered.
Reduce timeout from 20 sec. to 10 sec.
2021-12-08 19:39:37 +01:00
Christoph Atteneder
ff3809713b
Merge pull request #5905 from chimp1984/improve_shutdown_process
Improve shutdown process
2021-12-08 19:39:22 +01:00
chimp1984
32cd812744
Increase trade protocol timeout from 60 sec to 120 sec 2021-12-08 19:37:41 +01:00
chimp1984
3d40b3bf29
Add null checks
Return early at connection if stopped
Cleanup logs
2021-12-07 21:07:40 -05:00
chimp1984
2474e0daf9
Reduce timeouts
Add logs when shutdown starts
2021-12-07 20:45:02 -05:00
chimp1984
4eb14fb226
Extract duplicated code at shutdown
Move timeout before shutdown sequence starts and use a Timer thread instead of
UserThread to avoid that in case the UserThread gets blocked that the timeout
would not get triggered.
Reduce timeout from 20 sec. to 10 sec.
2021-12-07 20:42:53 -05:00
chimp1984
b5b7e86323
Increase trade protocol timeout from 60 sec to 120 sec 2021-12-07 19:39:22 -05:00
chimp1984
e85e46cb13
At shutdown the executor can throw a RejectedExecutionException which
is expected as we shut down the executor immediately.
If not thrown at shutdown or exception is not a RejectedExecutionException
we log a warning and re-throw the exception (to avoid change of behaviour
of current version). The exception is likely not handled by callers and goes up to
the uncaught exception handler.
2021-12-07 09:58:11 -05:00
Steven Barclay
ec58b26657
Fix BSQ blocks resync from resources on Windows & Linux
Prevent a "URI is not hierarchical" IllegalArgumentException from the
expression, 'new File(dirUrl.toURI())', which occurs on Linux & Windows
when listing the resource directory of BSQ blocks. Adapt a solution from
StackOverflow which uses two separate code paths depending on the
environment, into the new method 'FileUtil::listResourceDirectory'.

The issue is caused by the resource URL taking one of the two forms:

  file:/Users/[USER]/Java/bisq/bisq/p2p/out/production/resources/BsqBlocks_BTC_MAINNET
  jar:file:...p2p.jar!/BsqBlocks_BTC_MAINNET

depending on whether the system is OSX or not.
2021-12-07 11:48:07 +00:00
Christoph Atteneder
75ca2faeb2
Update translations for v1.8.0 (again) 2021-12-07 11:12:29 +01:00
Christoph Atteneder
ed1dac715b
Add missing import 2021-12-07 10:01:24 +01:00
Christoph Atteneder
ce541f6401
Add missing import 2021-12-07 09:51:54 +01:00
Christoph Atteneder
d39820bbcd
Apply suggestions and fix edge case when BSQ legacy payment account offer is duplicated 2021-12-07 09:41:41 +01:00
Christoph Atteneder
f41203858c
Add visual icon for duplicate offer functionality 2021-12-07 09:41:41 +01:00
Christoph Atteneder
4d1ee3fc9b
Add support to duplicate bsq swap offers 2021-12-07 09:41:40 +01:00
Bisq GitHub Admin
5041dc57ef
Merge pull request #5886 from ripcurlx/add-bsq-swap-duplicate-offer-support
Add support to duplicate BSQ swap offers
2021-12-07 09:41:10 +01:00
Steven Barclay
ceb9b9acbd
Code cleanup: proto fields, duplicated expr & null char separator
1. Reorder the PoW fields in the 'Filter' proto by field index, instead
 of contextually.
2. Deduplicate expression for 'pow' & replace if-block with boolean op
 to simplify 'FilterManager::isProofOfWorkValid'.
3. Avoid slightly confusing use of null char as a separator to prevent
 hashing collisions in 'EquihashProofOfWorkService::getChallenge'. Use
 comma separator and escape the 'itemId' & 'ownerId' arguments instead.

(based on PR #5858 review comments)
2021-12-07 09:35:45 +01:00
Steven Barclay
92209c3ed7
Inline predicates to simplify HashCashService & FilterManager
Remove all the 'challengeValidation', 'difficultyValidation' and
'testDifficulty' BiPredicate method params from 'HashCashService' &
'ProofOfWorkService', to simplify the API. These were originally
included to aid testing, but turned out to be unnecessary.

Patches committed on behalf of @chimp1984.
2021-12-07 09:35:45 +01:00
Steven Barclay
772cd74ab2
Store difficulty as floating point in Filter & PoW
Change the type of the 'difficulty' field in the Filter & ProofOfWork
proto objects from int32/bytes to double and make it use a linear scale,
in place of the original logarithmic scale which counts the (effective)
number of required zeros.

This allows fine-grained difficulty control for Equihash, though for
Hashcash it simply rounds up to the nearest power of 2 internally.

NOTE: This is a breaking change to PoW & filter serialisation (unlike
the earlier PR commits), as the proto field version nums aren't updated.
2021-12-07 09:35:44 +01:00
Steven Barclay
266a7ccea4
Add+enable service to mint/verify Equihash proofs of work
Add an abstract base class, 'ProofOfWorkService', for the existing PoW
implementation 'HashCashService' and a new 'EquihashProofOfWorkService'
PoW implementation based on Equihash-90-5 (which has 72 byte solutions &
5-10 MB peak memory usage). Since the current 'ProofOfWork' protobuf
object only provides a 64-bit counter field to hold the puzzle solution
(as that is all Hashcash requires), repurpose the 'payload' field to
hold the Equihash puzzle solution bytes, with the 'challenge' field
equal to the puzzle seed: the SHA256 hash of the offerId & makerAddress.

Use a difficulty scale factor of 3e-5 (derived from benchmarking) to try
to make the average Hashcash & Equihash puzzle solution times roughly
equal for any given log-difficulty/numLeadingZeros integer chosen in the
filter.

NOTE: An empty enabled-version-list in the filter defaults to Hashcash
(= version 0) only. The new Equihash-90-5 PoW scheme is version 1.
2021-12-07 09:35:44 +01:00
Steven Barclay
23252caa3b
Fix method name typo: redoProofOfWorkAndRepublish 2021-12-07 09:35:44 +01:00
Steven Barclay
c3e5dfd19e
Add PoW version(-list) fields to ProofOfWork & Filter
Add a numeric version field to the 'ProofOfWork' protobuf object, along
with a list of allowed version numbers, 'enabled_pow_versions', to the
filter. The versions are taken to be in order of preference from most to
least preferred when creating a PoW, with an empty list signifying use
of the default algorithm only (that is, version 0: Hashcash).

An explicit list is used instead of an upper & lower version bound, in
case a new PoW algorithm (or changed algorithm params) turns out to
provide worse resistance than an earlier version.

(The fields are unused for now, to be enabled in a later commit.)
2021-12-07 09:35:43 +01:00
Steven Barclay
484afbc522
Code cleanup: replace (Bi)Function<..,Boolean> with (Bi)Predicate<..>
Replace 'BiFunction<T, U, Boolean>' with the primitive specialisation
'BiPredicate<T, U>' in HashCashService & FilterManager.

As part of this, replace similar predicate constructs found elsewhere.
NOTE: This touches the DAO packages (trivially @ VoteResultService).
2021-12-07 09:35:41 +01:00
Christoph Atteneder
0a31bf899e
Merge pull request #5858 from stejbac/add-asic-resistant-pow
Provide ASIC resistant PoW scheme for BSQ swaps
2021-12-07 09:34:50 +01:00
Steven Barclay
24d2a7f222
Code cleanup: proto fields, duplicated expr & null char separator
1. Reorder the PoW fields in the 'Filter' proto by field index, instead
 of contextually.
2. Deduplicate expression for 'pow' & replace if-block with boolean op
 to simplify 'FilterManager::isProofOfWorkValid'.
3. Avoid slightly confusing use of null char as a separator to prevent
 hashing collisions in 'EquihashProofOfWorkService::getChallenge'. Use
 comma separator and escape the 'itemId' & 'ownerId' arguments instead.

(based on PR #5858 review comments)
2021-12-06 22:55:14 +00:00
Christoph Atteneder
f5db85bc3d
Merge pull request #5894 from chimp1984/check-recipient-address-only-after-wallet-is-synced
Fix premature validation call
2021-12-06 20:29:27 +01:00
Christoph Atteneder
2cb238318f
Fix broken test 2021-12-06 12:05:34 +01:00
Christoph Atteneder
21f84bcd45
Fix broken test 2021-12-06 12:03:26 +01:00
chimp1984
60b3e1216a
Change max retries from 3 to 12
When doing a resync from genesis the number of blocks is limited to 6000
so that requires lots of requests and with that increases risk of broken
connections. Giving more tolerance for retries avoids that the user has
to restart the app.
2021-12-06 11:52:13 +01:00
chimp1984
c34a019a31
Fixes https://github.com/bisq-network/bisq/issues/5882
When syncing from genesis the number of blocks are limited so we get the
`onParseBlockCompleteAfterBatchProcessing` called each time when the received
 blocks are processed, and as we are not at wallet height we repeat requesting
 blocks. But the new check for the BTC recipient triggers a resync from resource call.
We add now a check that we do this check only once the wallet is synced and our
block height from dao state matches wallet blockheight.
2021-12-06 11:52:12 +01:00
Christoph Atteneder
6e1a805b22
Merge pull request #5875 from chimp1984/fix-incorrect-chainheight
Fix incorrect start height for block request
2021-12-06 11:36:00 +01:00
Christoph Atteneder
e5c70717f8
Merge pull request #5884 from MwithM/patch-1
Substitute Unconfirmed for Processing BSQ swap
2021-12-06 11:29:17 +01:00
chimp1984
e802e68506
Fix handling for genesis height and case when wallet sync is not completed yet.
- At genesis we use the genesis height for request (not height+1)
- If wallet is not synced yet we do not call onParseBlockChainComplete (as it was before)
2021-12-06 11:17:41 +01:00
chimp1984
84cd67f54d
Fix incorrect start height for block request
We added 1 as with the lite monitor mode we persist the most recent block,
thus we request with the start height for the next block.
But that cause a problem at a DAO full mode which has lite monitor mode set
as then the block parsing would not be triggered.

We refactor it so that we take the chainHeight from the dao state
directly and add 1 at the requests.
We add a check if we are at chain tip, and if so we skip requests
and call the onParseBlockChainComplete directly.
2021-12-06 11:17:33 +01:00
Christoph Atteneder
319a9d96a7
Improve BSQ swap success message 2021-12-06 11:04:48 +01:00
Christoph Atteneder
a1ecf35007
Apply suggestions and fix edge case when BSQ legacy payment account offer is duplicated 2021-12-06 11:04:01 +01:00
Christoph Atteneder
ec5f217f2f
Improve warning when BSQ swap offer is removed 2021-12-06 10:43:58 +01:00
Bisq GitHub Admin
b06852be73
Merge pull request #5891 from ripcurlx/improve-remove-bsq-offer-warning
Improve warning when BSQ swap offer is removed
2021-12-06 10:43:26 +01:00
Steven Barclay
981d6ff000
Validate input script types to prevent BSQ swap tx fee underpaying
Add a check of 'scriptTypeId' field, against the output of the spending
tx, to the 'RawTransactionInput::validate' method. Also make the seller
as well as the buyer validate each raw BSQ/BTC input received from the
peer. This prevents either peer from claiming that any of their
non-segwit inputs are segwit in order to underpay the tx fee.
2021-12-04 19:52:07 +01:00
Steven Barclay
efd590b9e7
Fix BSQ swap buyer tx fee theft vulnerability
Prevent the seller from stealing the combined tx fee as change by lying
about the value of one or more of his BTC inputs, which are passed to
the buyer as raw inputs in the 'BsqSwapFinalizeTxRequest' message.

To this end, add a 'RawTransactionInput::validate' method to check the
'value' field against the output value of the respective spending tx and
run it on every seller input in 'ProcessBsqSwapFinalizeTxRequest', so
that the buyer is no longer just trusting those numbers.

Additionally, check that the spending txIds from the raw BTC inputs
supplied by the seller actually match those of his signed inputs in the
accompanying partially signed tx, thus tying the raw input values to the
seller's tx.
2021-12-04 19:52:07 +01:00
Steven Barclay
acad642b53
Fix misleading comment: BSQ swap taker tx fee tolerance
(Actual tolerance by maker of agreed tx fee is 50%, not 10%.)
2021-12-04 19:52:06 +01:00
Christoph Atteneder
628ac27e25
Merge pull request #5889 from stejbac/fix-bsq-swap-tx-fee-theft-vulnerability
Fix BSQ swap buyer tx fee theft vulnerability
2021-12-04 19:50:50 +01:00
jmacxx
4b60be0ebb
Always use fresh address for MULTI_SIG context 2021-12-04 19:49:11 +01:00
chimp1984
d7c9ce462b
Change max retries from 3 to 12
When doing a resync from genesis the number of blocks is limited to 6000
so that requires lots of requests and with that increases risk of broken
connections. Giving more tolerance for retries avoids that the user has
to restart the app.
2021-12-04 11:11:26 -05:00
chimp1984
747916ac2f
Fixes https://github.com/bisq-network/bisq/issues/5882
When syncing from genesis the number of blocks are limited so we get the
`onParseBlockCompleteAfterBatchProcessing` called each time when the received
 blocks are processed, and as we are not at wallet height we repeat requesting
 blocks. But the new check for the BTC recipient triggers a resync from resource call.
We add now a check that we do this check only once the wallet is synced and our
block height from dao state matches wallet blockheight.
2021-12-03 20:09:47 -05:00
chimp1984
c9e0265e13
Fix handling for genesis height and case when wallet sync is not completed yet.
- At genesis we use the genesis height for request (not height+1)
- If wallet is not synced yet we do not call onParseBlockChainComplete (as it was before)
2021-12-03 19:48:17 -05:00
ghubstan
5f7fd6257b
Merge branch 'master' into 6-api-xmr-trading 2021-12-03 13:19:24 -03:00
Christoph Atteneder
ccda66d2c6
Improve warning when BSQ swap offer is removed 2021-12-03 12:21:03 +01:00
Christoph Atteneder
daf762f8fa
Add visual icon for duplicate offer functionality 2021-12-03 12:02:10 +01:00
ghubstan
742a6f441e
Allow mkt price lookup for any altcoin from API 2021-12-02 19:02:03 -03:00
ghubstan
ce8b6df9c5
Adjust API CorePaymentAccountsService for creating XMR accts 2021-12-02 19:00:22 -03:00
Steven Barclay
0517facbc3
Validate input script types to prevent BSQ swap tx fee underpaying
Add a check of 'scriptTypeId' field, against the output of the spending
tx, to the 'RawTransactionInput::validate' method. Also make the seller
as well as the buyer validate each raw BSQ/BTC input received from the
peer. This prevents either peer from claiming that any of their
non-segwit inputs are segwit in order to underpay the tx fee.
2021-12-02 18:25:53 +00:00
ghubstan
b85459d7c6
Refactor api.core side editoffer validation & fix bug
The editoffer validation bug fixes:

- A trigger-price edit forced offer.price-margin=0.00.

	This needs to be checked in new apitest case asserts.

- An activate state (only) edit forced offer.isUseMarketBasedPrice=true.

	The CLI does not have the offer instance, and cannot know the correct
	value of the isUseMarketBasedPrice param sent in the editoffer request.
	The daemon has to figure this out.  If the editType parameter value
	sent to daemon is ACTIVATION_STATE_ONLY, use the current offer.isUseMarketBasedPrice.

The refactoring includes more useful and readable information in core's EditOfferValidator
and MutableOfferPayloadFields toString methods, for debugging with the daemon log. And some
adjustments for allowing edits to XMR offers.
2021-12-02 15:04:38 -03:00
ghubstan
095a49598c
Add more readable toString method to MutableOfferPayloadFields
This makes it easier to compare to EditOfferValidator.toString
2021-12-02 14:51:15 -03:00
Steven Barclay
915a79e627
Fix BSQ swap buyer tx fee theft vulnerability
Prevent the seller from stealing the combined tx fee as change by lying
about the value of one or more of his BTC inputs, which are passed to
the buyer as raw inputs in the 'BsqSwapFinalizeTxRequest' message.

To this end, add a 'RawTransactionInput::validate' method to check the
'value' field against the output value of the respective spending tx and
run it on every seller input in 'ProcessBsqSwapFinalizeTxRequest', so
that the buyer is no longer just trusting those numbers.

Additionally, check that the spending txIds from the raw BTC inputs
supplied by the seller actually match those of his signed inputs in the
accompanying partially signed tx, thus tying the raw input values to the
seller's tx.
2021-12-02 17:19:10 +00:00
Steven Barclay
8d267520c8
Fix misleading comment: BSQ swap taker tx fee tolerance
(Actual tolerance by maker of agreed tx fee is 50%, not 10%.)
2021-12-02 14:54:57 +00:00
Christoph Atteneder
1606439144
Add support to duplicate bsq swap offers 2021-12-02 13:39:11 +01:00
ghubstan
33d976cf79
Calculate offer.makerFee if offer is bsq-swap
V1 offer instances have a makeFee value, but not BSQ swap offers.
This needs to be investigated.
See commit d57d6e9852.
2021-12-01 19:06:01 -03:00
jmacxx
32f057b2ad
Always use fresh address for MULTI_SIG context 2021-12-01 13:27:43 -06:00
ghubstan
e3c40895fe
Use offer instance to determine ownership, not it's id 2021-12-01 16:05:30 -03:00
ghubstan
d57d6e9852
Use calculated offer maker fee, do not re-calculate it 2021-12-01 16:03:31 -03:00
Christoph Atteneder
f224cf7c7c
Add Polish translation 2021-12-01 15:13:57 +01:00
Christoph Atteneder
1f2a3234fe
Add Polish translation 2021-12-01 11:35:25 +01:00
MwithM
7f22ffedf9
Substitute Unconfirmed for Processing BSQ swap
**Unconfirmed** BSQ swap seems like something failed. **Processing** is used by some wallets for unconfirmed transactions and has no negative implications.
2021-12-01 11:25:14 +01:00
ghubstan
946ca460ef
Merge branch 'master' into 5-api-bsqswap-simulation-n-docs-update 2021-11-30 12:46:34 -03:00
jmacxx
cb1998db05
Bugfix: dispute ticket reopened by mailbox message 2021-11-30 10:28:11 +01:00
jmacxx
0025609375
Bugfix: dispute ticket reopened by mailbox message 2021-11-29 09:18:55 -06:00
ghubstan
6b89254588
Adjust core api method help docs for bsq swaps 2021-11-29 11:29:42 -03:00
chimp1984
bfd45d359a
Fix incorrect start height for block request
We added 1 as with the lite monitor mode we persist the most recent block,
thus we request with the start height for the next block.
But that cause a problem at a DAO full mode which has lite monitor mode set
as then the block parsing would not be triggered.

We refactor it so that we take the chainHeight from the dao state
directly and add 1 at the requests.
We add a check if we are at chain tip, and if so we skip requests
and call the onParseBlockChainComplete directly.
2021-11-28 00:27:04 +01:00
ghubstan
64f228d872
Make rpc GetOfferCategory service work for my+avail offers
There are some use cases where the CLI needs to know what kind of offer
is being acted on before the request is made, For example:

There are differences between a BsqSwap 'takeoffer'request, and a v1
'takeoffer' request.

A BsqSwap offer cannot be edited by an 'editoffer' request, and an
attempt should be blocked by the CLI.

- Append isMyOffer GetOfferCategoryRequest rpc msg def.

- Adjust daemon.grpc services for new boolean GetOfferCategoryRequest param.

- Adjust core.api for new boolean GetOfferCategoryRequest param.

- Add validation check in core.api EditOfferValidator to block attempt to
  edit a BsqSwap offer.

- Refactor CoreOffersService get*offer(id) methods to optionally throw
  excpetions.
2021-11-27 14:01:14 -03:00
Steven Barclay
e383edc38a
Inline predicates to simplify HashCashService & FilterManager
Remove all the 'challengeValidation', 'difficultyValidation' and
'testDifficulty' BiPredicate method params from 'HashCashService' &
'ProofOfWorkService', to simplify the API. These were originally
included to aid testing, but turned out to be unnecessary.

Patches committed on behalf of @chimp1984.
2021-11-27 05:59:41 +00:00
jmacxx
670c5418ee
Improve user experience once mediation has been accepted by both parties
Transitions to Trade Step 4 (previously it would close/remove the trade).
2021-11-26 20:55:46 -06:00
Steven Barclay
e0595aa284
Store difficulty as floating point in Filter & PoW
Change the type of the 'difficulty' field in the Filter & ProofOfWork
proto objects from int32/bytes to double and make it use a linear scale,
in place of the original logarithmic scale which counts the (effective)
number of required zeros.

This allows fine-grained difficulty control for Equihash, though for
Hashcash it simply rounds up to the nearest power of 2 internally.

NOTE: This is a breaking change to PoW & filter serialisation (unlike
the earlier PR commits), as the proto field version nums aren't updated.
2021-11-26 04:08:15 +00:00
ghubstan
00a5e2b650
Merge branch 'master' into 2-refactor-api-bsqswap-support 2021-11-25 14:33:48 -03:00
Steven Barclay
0c94e232f8
Add+enable service to mint/verify Equihash proofs of work
Add an abstract base class, 'ProofOfWorkService', for the existing PoW
implementation 'HashCashService' and a new 'EquihashProofOfWorkService'
PoW implementation based on Equihash-90-5 (which has 72 byte solutions &
5-10 MB peak memory usage). Since the current 'ProofOfWork' protobuf
object only provides a 64-bit counter field to hold the puzzle solution
(as that is all Hashcash requires), repurpose the 'payload' field to
hold the Equihash puzzle solution bytes, with the 'challenge' field
equal to the puzzle seed: the SHA256 hash of the offerId & makerAddress.

Use a difficulty scale factor of 3e-5 (derived from benchmarking) to try
to make the average Hashcash & Equihash puzzle solution times roughly
equal for any given log-difficulty/numLeadingZeros integer chosen in the
filter.

NOTE: An empty enabled-version-list in the filter defaults to Hashcash
(= version 0) only. The new Equihash-90-5 PoW scheme is version 1.
2021-11-25 17:17:45 +00:00
Steven Barclay
647fc862d4
Fix method name typo: redoProofOfWorkAndRepublish 2021-11-25 11:45:23 +00:00
jmacxx
dfc7361b04
Add new block listener to update locked balance display 2021-11-25 09:55:04 +01:00
jmacxx
f0efe7175c
Fix exception in Portfolio History screen 2021-11-25 09:54:54 +01:00
Christoph Atteneder
ba6d5e2c73
Merge pull request #5842 from jmacxx/fix_exception_portfolio_history
Bug fixes: Locked Balance display; Portfolio History screen
2021-11-25 09:54:31 +01:00
ghubstan
c177b3b834
Merge branch 'master' into 2-api-bsq-swap-scratch 2021-11-24 13:14:13 -03:00
ghubstan
3aae052813
Refactor core.api trade service implemenentations for BSQ swaps
A minor refactoring to support serving TradeModel instances to CLI.
For example, the CLI 'gettrade' command must return a v1 Trade or
BSQ swap trade.
2021-11-24 13:05:09 -03:00