Commit Graph

5342 Commits

Author SHA1 Message Date
chimp1984
ed099981fa
Make findWitness public
Improve logs if trade limit was violated
2020-12-09 13:58:16 -05:00
ghubstan
144c5a82cc
Merge branch 'master' into 04-add-sendbtc-impl 2020-12-09 10:44:17 -03:00
ghubstan
6c9f0c252d
Add new api method 'sendbtc' and test
Takes an address, amount, and optional txfeerate param,
returns a lightweight TxInfo proto.

Also overloaded two BtcWalletService methods to allow sendbtc
to pass in the tx fee rate -- overriding the fee service and
custom fee rate setting.
2020-12-08 21:12:02 -03:00
chimp1984
ce68f2e24a
Check also for depositTxId in trade and check if both
txId and tx.getId are the same.

We got some reports where users have no deposit tx displayed in the
trade after spv resync but cannot move the trade to failed trades.
It seems the invalid txId is still stored in the trade but the tx itself
got removed from the wallet after reysnc. We check not that both the tx
and the txId need to be present.
2020-12-08 17:11:58 -05:00
ghubstan
2842070afd
Merge branch 'master' into 03-add-txFeeRate-param 2020-12-08 19:04:27 -03:00
Christoph Atteneder
29c2e0002d
Merge branch 'master' of github.com:bisq-network/bisq into hotfix/v1.5.1
# Conflicts:
#	build.gradle
#	core/src/main/java/bisq/core/btc/setup/WalletConfig.java
#	desktop/package/linux/Dockerfile
#	desktop/package/linux/package.sh
#	desktop/package/linux/release.sh
#	desktop/package/macosx/create_app.sh
#	desktop/package/macosx/finalize.sh
#	desktop/package/macosx/insert_snapshot_version.sh
#	desktop/package/windows/package.bat
#	desktop/package/windows/release.bat
#	relay/src/main/resources/version.txt
#	seednode/src/main/java/bisq/seednode/SeedNodeMain.java
2020-12-08 22:19:11 +01:00
chimp1984
960b835f3f
Check if maker fee tx is already spent or has invalid structure.
If so show popup to remove that offer.
Add maker fee tx ix to offer details window.
If invalid, add error msg to offer details window.
2020-12-08 15:45:51 -05:00
chimp1984
cd98617ec8
Property fields must not bet set from non JavaFX threads.
So we map those setters to our UserThread.

How to reproduce issue?
Restore from seed triggered following exception:

Dec-08 13:20:04.547 [ STARTING] ERROR bisq.common.setup.CommonSetup: Stack trace:
java.lang.IllegalStateException: Not on FX application thread; currentThread =  STARTING
	at com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:291)
	at com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(QuantumToolkit.java:424)
	at javafx.scene.Parent$3.onProposedChange(Parent.java:471)
	at com.sun.javafx.collections.VetoableListDecorator.setAll(VetoableListDecorator.java:113)
	at com.sun.javafx.collections.VetoableListDecorator.setAll(VetoableListDecorator.java:108)
	at javafx.scene.control.skin.LabeledSkinBase.updateChildren(LabeledSkinBase.java:272)
	at javafx.scene.control.skin.LabeledSkinBase.lambda$new$11(LabeledSkinBase.java:220)
	at com.sun.javafx.scene.control.LambdaMultiplePropertyChangeListenerHandler.lambda$new$1(LambdaMultiplePropertyChangeListenerHandler.java:49)
	at javafx.beans.value.WeakChangeListener.changed(WeakChangeListener.java:86)
	at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:181)
	at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
	at javafx.beans.property.StringPropertyBase.fireValueChangedEvent(StringPropertyBase.java:104)
	at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:111)
	at javafx.beans.property.StringPropertyBase.access$000(StringPropertyBase.java:50)
	at javafx.beans.property.StringPropertyBase$Listener.invalidated(StringPropertyBase.java:231)
	at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:136)
	at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
	at javafx.beans.property.StringPropertyBase.fireValueChangedEvent(StringPropertyBase.java:104)
	at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:111)
	at javafx.beans.property.StringPropertyBase.access$000(StringPropertyBase.java:50)
	at javafx.beans.property.StringPropertyBase$Listener.invalidated(StringPropertyBase.java:231)
	at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:348)
	at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
	at javafx.beans.property.StringPropertyBase.fireValueChangedEvent(StringPropertyBase.java:104)
	at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:111)
	at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:145)
	at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:50)
	at bisq.core.app.WalletAppSetup.lambda$init$1(WalletAppSetup.java:170)
	at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:181)
	at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
	at javafx.beans.binding.ObjectBinding.invalidate(ObjectBinding.java:170)
	at com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:52)
	at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:136)
	at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
	at javafx.beans.property.IntegerPropertyBase.fireValueChangedEvent(IntegerPropertyBase.java:107)
	at javafx.beans.property.IntegerPropertyBase.markInvalid(IntegerPropertyBase.java:114)
	at javafx.beans.property.IntegerPropertyBase.set(IntegerPropertyBase.java:148)
	at bisq.core.btc.setup.WalletsSetup$1.onSetupCompleted(WalletsSetup.java:245)
2020-12-08 13:22:43 -05:00
Christoph Atteneder
6431d639ae
Merge pull request #4908 from chimp1984/add-memo-field-at-step4
Add memo field at step4
2020-12-08 16:35:16 +01:00
chimp1984
455c9b0ff3
Avoid logging warning at startup 2020-12-08 10:13:31 -05:00
Christoph Atteneder
d41692602a
Merge pull request #4903 from oscarguindzberg/bloomFilterFix
Upate bitcoinj to commit dcf8af0 - Bloom filter fix
2020-12-08 15:03:28 +01:00
Christoph Atteneder
89e55774c7
Merge pull request #4910 from chimp1984/remove-log-entry
Improve logs
2020-12-08 15:03:09 +01:00
sqrrm
2a2f05f408
Merge pull request #4912 from chimp1984/add-serialized-tx-as-hex-to-trade-details
Add "Raw deposit transaction as hex" to details window
2020-12-08 12:28:15 +01:00
chimp1984
25d227556b
Add "Raw deposit transaction as hex" to details window
Rename Contract as json button to detail data
2020-12-07 20:25:29 -05:00
chimp1984
d0005e45f4
Add logs of tx in case of exceptions 2020-12-07 19:47:44 -05:00
chimp1984
a3df372ecd
Apply project format rules (no code change) 2020-12-07 19:47:05 -05:00
chimp1984
b5e19312c5
Remove logs logging absolute path to data directory 2020-12-07 19:35:01 -05:00
chimp1984
38d52ff6f9
Add more logs to AddressEntry domain 2020-12-07 19:32:32 -05:00
chimp1984
f4fd286b86
Remove verbose log 2020-12-07 17:56:28 -05:00
chimp1984
30ff8c3853
Remove paymentAccount from log 2020-12-07 14:53:45 -05:00
chimp1984
249c6143c9
Use preferredTradeCurrency is fiat, otherwise the users country currency 2020-12-07 13:48:43 -05:00
chimp1984
a7765d0cce
Use 30 day average BSQ price for calculating BSQ fee 2020-12-07 13:45:02 -05:00
chimp1984
5a0634f94d
Move methods to AveragePriceUtil 2020-12-07 13:24:17 -05:00
chimp1984
f745f0f0d6
Move methods from AxisInlierUtils to InlierUtil
We will need some of those methods later inside another core util class.
2020-12-07 13:21:44 -05:00
chimp1984
104b7edc99
Add memo field at withdraw to external wallet screen
Implements https://github.com/bisq-network/bisq/issues/4869
2020-12-07 12:32:56 -05:00
chimp1984
959c53c18d
Apply project format rules (no code change) 2020-12-07 12:31:34 -05:00
chimp1984
e2f9009fce
Remove dev log, fix typo in log 2020-12-07 10:33:41 -05:00
Oscar Guindzberg
9ca20d8b3d
Use bitcoinj 0.15.8 (commit dcf8af0) 2020-12-07 11:39:58 -03:00
sqrrm
74485f0844
Merge pull request #4884 from ghubstan/01-refactor-getdust
Refactor: move getDust(Transaction transaction)
2020-12-07 14:12:59 +01:00
ghubstan
159d4cc6f5
Add optional txFeeRate parameter to api sendbsq
If present in the sendbsq command, the parameter will override the fee
service and custom fee rate setting for the BSQ transaction.

Also changed the sendbsq grpc return type to a lightweight TX proto wrapper.

Besides some small refactoring in the CLI, all the changes are
adjustments for this new sendbsq parameter and its new grpc return value.
2020-12-04 17:17:37 -03:00
chimp1984
82445c0e28
In case the peers witness is not found and the trade amount
is not exceeding TOLERATED_SMALL_TRADE_AMOUNT (0.01 BTC) we
return true for verifyPeersTradeAmount.
Before such offers could not be taken even the witness
check would be irrelevant as the trade amount is below the
threshold where we require account age witness.
2020-12-04 12:40:30 -05:00
ghubstan
900d498ee1
Merge branch 'master' into 02-refactor-completePreparedSendBsqTx 2020-12-04 14:22:45 -03:00
ghubstan
dc6144d337
Refactor BtcWalletService to let api override fee rates
BtcWalletService was changed to allow the api to override tx fee
rates from the sendbsq and sendbtc methods.  The api methods will
still be able to use the network fee service and custom tx fee rate
preference, and set / unset the custom tx fee rate preference, but
the change will permit the addition of an optional txFeeRate parameter
to the sendbsq and sendbtc methods (todo).  A few other minor changes
(style and removal of never thrown ex spec) were also made to this class.

Two BtcWalletService methods were refactored.

- The redundant (was always true) boolean isSendTx argument was removed
  from the completePreparedVoteRevealTx method signature.

- The redundant (was always true) boolean useCustomTxFee was removed
  from the completePreparedBsqTx method signature.

- The completePreparedSendBsqTx method was overloaded with a 2nd parameter
  (Coin txFeePerVbyte) to allow api to override fee service and custom
  tx fee rate when sending BSQ or BTC.

- The completePreparedBsqTx method was overloaded with a 3rd parameter
  (Coin txFeePerVbyte) to allow api to override fee service and custom
  tx fee rate when sending BSQ or BTC.

The following line was deleted from the completePreparedBsqTx method
because txFeePerVbyte is now an argument:

	Coin txFeePerVbyte = useCustomTxFee ? getTxFeeForWithdrawalPerVbyte() : feeService.getTxFeePerVbyte();

This useCustomTxFee value was always true, and redudant here because
getTxFeeForWithdrawalPerVbyte() returns feeService.getTxFeePerVbyte()
or the custom fee rate preference. i.e.,

Coin txFeePerVbyte = useCustomTxFee ? getTxFeeForWithdrawalPerVbyte() : feeService.getTxFeePerVbyte();

	is equivalent to

Coin txFeePerVbyte = getTxFeeForWithdrawalPerVbyte();

LockupTxService, UnlockTxService, BsqSendView, and BsqTransferService
were adjusted to this BtcWalletService refactoring.
2020-12-04 14:17:24 -03:00
Christoph Atteneder
588623eb2d
Merge pull request #4885 from chimp1984/fix-bug-with-reapplying-past-trade-state
Avoid that buyer switches back to trade step 2 at startup after payment confirmed
2020-12-04 16:41:41 +01:00
chimp1984
c04b95b996
Remove checkNotNull for takerFeeTxId 2020-12-04 10:10:57 -05:00
sqrrm
57681245ff
Merge pull request #4889 from chimp1984/avoid-case-of-multi-trades-with-same-offer-id
Avoid case of multi trades with same offer
2020-12-04 00:48:45 +01:00
chimp1984
8f99ca0b63
Add uid to trade to make sure that look up for process model cannot
fail in case of multiple trades with the same offer id.
Use uid instead of the weaker offerId as key for the tradeProtocolByTradeId map
2020-12-03 14:43:35 -05:00
chimp1984
2d5fc33ba4
Move MakerRemovesOpenOffer to first task to avoid that if take offer
fails early that we get another trade with same id at maker in case another use takes the offer afterwards.
2020-12-03 14:19:24 -05:00
Christoph Atteneder
91a1a92ac4
Merge pull request #4877 from Jakub-CZ/fix_warning_message
Fix warning about rejected transaction
2020-12-03 19:28:06 +01:00
Christoph Atteneder
baa038aa39
Merge pull request #4886 from jmacxx/hotfix/v1.5.1
add logging of Tx hex
2020-12-03 19:18:50 +01:00
chimp1984
1fdc43e4d0
Increase timeout for trade protocol task runners from 30 to 60 sec 2020-12-03 11:53:35 -05:00
jmacxx
fa80553890
add logging of Tx hex 2020-12-03 10:22:07 -06:00
chimp1984
f843b5477b
Fixes https://github.com/bisq-network/bisq/issues/4864
When seller if offline we resend the CounterCurrencyTransferStartedMessage at startup.
That caused the trade state set to BUYER_SENT_FIAT_PAYMENT_INITIATED_MSG and then after
the msg was stored in mailbox to BUYER_STORED_IN_MAILBOX_FIAT_PAYMENT_INITIATED_MSG.
Those 2 msg trigger diff. UI states which led to the UI glitch that the UI moved to
step 2 and then to step 3 which was correct but confusing to the user.

Now we only apply BUYER_SENT_FIAT_PAYMENT_INITIATED_MSG is trade state ordinal is
smaller avoiding that UI glitch.
2020-12-03 11:19:18 -05:00
ghubstan
74261b1749
Refactor: move getDust(Transaction transaction)
The api is going to need this method, so it was moved from desktop to core.

- Moved the method from WithdrawalView to WalletService.

- Removed an unused initilizer in WithdrawalView.
2020-12-03 12:16:04 -03:00
chimp1984
29d757b741
- revent that a wrong tx is set as deposit tx
We check if the txIds of the inputs matches our maker fee tx and taker fee tx and if the depositTxAddress we
use for the confidence lookup is use as an output address.
This prevents that past txs which have the our depositTxAddress as input or output (deposit or payout txs) could
be interpreted as our deposit tx. This happened because if a bug which caused re-use of the Multisig address
entries and if both traders use the same key for multiple trades the depositTxAddress would be the same.
We fix that bug as well but we also need to avoid that past already used addresses might be taken again
(the Multisig flag got reverted to available in the address entry).

- Add check to swapTradeEntryToAvailableEntry to not swap MULTI_SIG entries.

- Remove swap for MULTI_SIG entries at resetAddressEntriesForPendingTrade

- Add check to swapToAvailable to not swap MULTI_SIG entries.

- Remove swaps for MULTI_SIG entries

- Add setCoinLockedInMultiSigAddressEntry method

- Make coinLockedInMultiSig final and remove setter but use it in constructor.

- Rename getCoinLockedInMultiSig to getCoinLockedInMultiSigAsCoin
We use an immutable list when operating on AddressEntry so changes on the
object would not be reflected in the list.
The only mutable field (beside non critical cache fields) is the keyPair.
Might be good to refactor that as well at some point.

- Add setCoinLockedInMultiSigAddressEntrymethods

- Apply API changes:
-- resetCoinLockedInMultiSigAddressEntry
-- setCoinLockedInMultiSigAddressEntry
-- renamed methods
2020-12-03 10:01:01 -05:00
chimp1984
a39f2e8fcb
Apply project format rules (no code change) 2020-12-03 09:54:43 -05:00
sqrrm
9b774d1515
Merge pull request #4858 from ghubstan/21-fee-rate-apis
Add tx fee rate api methods:  gettxfeerate, settxfeerate, unsettxfeerate
2020-12-03 10:41:54 +01:00
Jakub Loucký
b8bdbbc551
Fix warning for rejected transaction 2020-12-02 21:16:41 +01:00
ghubstan
7f636e45f9
Prevent attempt to send amount of BSQ < dust 2020-12-02 15:21:20 -03:00
ghubstan
2efd094f68
Remove method only used in class' toString 2020-12-02 15:01:34 -03:00
ghubstan
65df9e1503
Change sendbsq's amount parameter type to String 2020-12-02 14:52:05 -03:00
ghubstan
9b4bdfc5ad
Make salt an editable payment acct json form field
Users need to be able to preserve their acct age when moving a
payment account to a new client.

Also adjusted affected tests, and did some minor refactoring
of the custom gson type adaptor.
2020-12-02 13:52:39 -03:00
ghubstan
987d89319e
Use ListenableFuture and callback when requesting tx fee
This change fixes the blocking problem in the fee rate request api.
Also redefined the TxFeeRateInfo.

- Redefined grpc.proto message TxFeeRateInfo, added
  lastFeeServiceRequestTs field. (CLI user may want to know
  TS of last fee request.)

- Adjusted TxFeeRateInfo proto wrapper.

- Adjusted CurrencyFormat and BtcTxFeeRateTest to new TxFeeRateInfo.

- Added @Getter annotation to FeeService.  (CLI user may want to know
  TS of last fee request).

- Pass resultHandler from GrpcWalletsService through CoreApi, to
  CoreWalletsService's tx fee rate api methods.
2020-12-01 21:10:47 -03:00
ghubstan
faf030fbc5
Add useCustomTxFeeRate field to TxFeeRateInfo proto wrapper
This is set from the core preferences.isUseCustomWithdrawalTxFee(),
and simplifies fee changing logic in the API.
2020-12-01 17:14:08 -03:00
ghubstan
62a2aa8543
Don't be so polite 2020-12-01 15:55:53 -03:00
ghubstan
45cfb95245
Remove many log.isDebugEnabled() checks
These do not buy enough in the way of performance, at the cost of
so many additional lines.  Buy these checks should be done for
debug log statements that have expensive parameters.
2020-12-01 15:48:11 -03:00
Christoph Atteneder
740071d54c
Merge pull request #4859 from oscarguindzberg/fixEmergencyPayout
Fix emergency payout
2020-12-01 13:58:01 +01:00
Christoph Atteneder
49d0e75eac
Merge pull request #4852 from chimp1984/stop-rpc-service-at-shutdown
Shut down rpc service at app shut down routine
2020-11-30 15:29:36 +01:00
Christoph Atteneder
c7b92c36c9
Merge pull request #4850 from chimp1984/improve-stratup-info-display
Improve startup info display
2020-11-27 16:08:07 +01:00
Steven Barclay
d59b425c94
Add missing output value check to takerSignsDepositTx
Make sure the taker checks the value of the 2-of-2 multisig output of
the deposit tx created by the maker, before signing it. This avoids a
potential security hole, where the maker attempts to steal most of the
deposit by using the wrong output value and adding an extra 'change'
output to himself.

Note that there's no actual vulnerability at present, as the output
value is indirectly checked via the validation of the delayed payout tx.
In particular, the extra checks added in 345426f as part of #4789 (Fix
remaining blackmail vulnerabilities) place a lower bound on the delayed
payout tx input value and with it the deposit tx output value. However,
explicitly checking the amount is more robust.
2020-11-26 23:39:51 +00:00
Oscar Guindzberg
f2acf42edc
Set payoutTx as parent tx 2020-11-26 20:30:23 -03:00
Oscar Guindzberg
0b834a94f8
Use empty byte array for script sig 2020-11-26 20:30:00 -03:00
Oscar Guindzberg
91a2def86e
Use AddressEntry.getAddress() 2020-11-26 20:28:50 -03:00
ghubstan
0b0f9f1120
Add gettxfeerate, settxfeerate, unsettxfeerate implementations 2020-11-26 18:36:15 -03:00
ghubstan
abe7160608
Add TxFeeRateInfo proto wrapper 2020-11-26 18:35:24 -03:00
ghubstan
5a06e4ea3e
Adjust to changed CoinUtil 2020-11-26 17:19:47 -03:00
ghubstan
8f13b85e19
Merge branch 'master' into 20-pr-change-requests-A 2020-11-26 17:19:00 -03:00
ghubstan
15592887dd
Implement fromProto
This is marked unused, but it will be in future tests.
2020-11-26 15:06:14 -03:00
ghubstan
9d863e5a40
Remove deprecated method long getAvailableBalance 2020-11-26 14:25:24 -03:00
chimp1984
1b68b02857
Shut down rpc service at app shut down routine 2020-11-26 11:31:05 -05:00
chimp1984
673a4d8718
Improve block % and fee display 2020-11-26 11:19:01 -05:00
chimp1984
3ded086808
Add stateStartingOrRunning check (if we close before state
is ready we would get an exception in walletConfig.chain())
2020-11-26 11:18:38 -05:00
chimp1984
e1180d9662
Reformat, org imports (no code change) 2020-11-26 11:16:10 -05:00
Christoph Atteneder
99d5652aef
Merge pull request #4841 from jmacxx/fix_issue_4833
Prompt for confirmation before initiating SPV resync
2020-11-26 16:13:00 +01:00
Christoph Atteneder
4e4711a6f5
Merge pull request #4845 from jmacxx/fix_issue_4641
Show price deviation in portfolio open offers and history view
2020-11-26 15:33:50 +01:00
Christoph Atteneder
11b0a466ce
Merge branch 'master' of github.com:bisq-network/bisq into release/v1.5.0
# Conflicts:
#	core/src/main/java/bisq/core/provider/fee/FeeService.java
#	core/src/main/resources/i18n/displayStrings.properties
#	seednode/src/main/java/bisq/seednode/SeedNodeMain.java
2020-11-25 14:05:37 +01:00
jmacxx
2e52b5472f
Show price deviation in portfolio open offers and closed trades
Fixes #4641
2020-11-24 23:03:53 -06:00
sqrrm
3a5fba8196
Merge pull request #4838 from ripcurlx/update-resources-for-v1.5.0
Update resources for v1.5.0
2020-11-24 10:27:53 +01:00
Christoph Atteneder
788e0259d8
Merge branch 'release/v1.5.0' of github.com:bisq-network/bisq into add-delay-to-exit
# Conflicts:
#	core/src/main/java/bisq/core/app/BisqExecutable.java
2020-11-24 09:23:16 +01:00
Christoph Atteneder
94453cf27c
Merge pull request #4829 from chimp1984/prevent-downgrade
Check if user has downgraded to an older version
2020-11-24 09:15:47 +01:00
chimp1984
6b3a002b1c
Add 1 sec delay before calling exit
To persist in the very last moment before exit might cause problems on some OS.
We do not have confirmed that this might be an issue but to be on the safe side
we add a 1 sec. delay between persistence completed and exit.
2020-11-23 18:22:44 -05:00
Oscar Guindzberg
e667f8fbad
Upgrade bitcoinj to commit 60b4f2f 2020-11-23 14:39:26 -03:00
jmacxx
395af3c4c8
Prompt for confirmation before initiating SPV resync
Allows user to back off if invoked by accident.
2020-11-23 11:37:31 -06:00
Christoph Atteneder
06a7d6fb14
Update translations for v1.5.0 (update 2) 2020-11-23 11:23:25 +01:00
Christoph Atteneder
06c16a1734
Update bitcoinj checkpoints for v1.5.0 (update 2) 2020-11-23 11:23:04 +01:00
Christoph Atteneder
3c944722e9
Merge pull request #4831 from jmacxx/json_dump_active_currencies
Create JSON files of actively traded crypto and fiat assets
2020-11-23 09:46:13 +01:00
jmacxx
53a90f9d17
create JSON files of actively traded crypto and fiat assets 2020-11-21 23:23:16 -06:00
ghubstan
23bfa2e7fc
Refactor didReadCountryField to set country on MoneyGram acct
MoneyGram is not a CountryBasedPaymentAccount, but it does
have a country field.
2020-11-21 15:22:15 -03:00
ghubstan
636fac9170
Add isMoneyGramAccount to abstract PaymentAccount 2020-11-21 15:21:10 -03:00
chimp1984
9360e89ae8
Check if user has downgraded to an older version. If so require shutdown
and do not read or write persisted data.

We had recently a case where a user downgraded from 1.4.2 to 1.3.9 and
this caused failed trades and the wallet funds have been missing due to
some complexities of the wallet wegwit upgrade. The fund could be recovered
but it took quite some effort.
As downgrade is never tested and can lead to all kind of weird bugs we
should prevent that users accidentally can do it.
If there is valid reason to downgrade they can remove the version file.
2020-11-20 15:27:50 -05:00
chimp1984
9da231ed8b
Fix typo 2020-11-20 10:28:59 -05:00
ghubstan
58f1af6f45
Log server stack traces, pass concise err msgs to CLI
For exceptions caught in the server, we want to log a reason and a
full stack trace, then send less verbose exception msgs up to the CLI.
2020-11-20 12:00:22 -03:00
Christoph Atteneder
2fe702cf3d
Merge pull request #4825 from huey735/rename-trade-payout-option
Rename getsAll payout option string
2020-11-20 09:49:59 +01:00
Huey
604a64e4a5
Rename getsAll payout option string
Renamed it to better represent the outcome of this option since
the winning party doesn't in fact get all the funds in escrow.
2020-11-19 17:41:39 +00:00
Steven Barclay
345426fb50
Add further validation checks for delayed payout tx
Do some extra sanity checks like tx.outputSum < tx.inputSum, to rule out
any edge cases where an invalid delayed payout tx might still arise.
2020-11-19 17:30:16 +00:00
Steven Barclay
3574204e7d
Fix faulty signature check in finalizeDelayedPayoutTx
Make sure to use the segwit version of Script.correctlySpends in
TradeWalletService.finalizeDelayedPayoutTx, which requires the input
value and witness to be passed explicitly (as the latter holds the
actual signature). This was causing BuyerFinalizesDelayedPayoutTx to
fail to do any kind of signature check.

Also refactor the method slightly and remove a redundant call to
WalletService.checkScriptSig (which does the same thing as
TransactionInput.verify) in the branch used by the seller.
2020-11-19 17:19:14 +00:00
Steven Barclay
69d1e16f5e
Prevent takers from using non-segwit deposit tx inputs
Disallow non-P2WH depositTx inputs from the taker, while continuing to
allow them from the maker, so that offers created pre-v1.5.0 can still
be taken. (After some time, those inputs could be disallowed too.)

This is mainly to prevent mass blackmail attacks, where more victims'
money could be locked up than the DAO could possibly compensate them all
for. (This is probably only an attractive attack for a buyer anyway, at
least with the earlier commits.)
2020-11-19 17:19:14 +00:00
Steven Barclay
5a3b072692
Withhold witnesses in buyer->seller depositTx data, until last step
Strip all input witnesses from the depositTx message fields sent from
the buyer, until the last (DelayedPayoutTxSignatureResponse) message is
sent, where they can be bundled in as an extra field. Since the witness
data doesn't affect the final deposit tx id, the seller does not need to
know it until actually publishing the tx.

In the (fully) segwit case, this allows the buyer to prevent the seller
from publishing the deposit tx until the buyer has a valid, fully signed
delayedPayoutTx. Provide the final witness data in an extra 'depositTx'
field in DelayedPayoutTxSignatureResponse, which the seller can merge
with his depositTx witness block (for his own input signatures).
2020-11-19 17:19:13 +00:00
Steven Barclay
803035bdbb
Add new BuyerFinalizesDelayedPayoutTx task
Improve validation of the buyer's delayed payout tx (both before & after
they get the final DepositTxAndDelayedPayoutTxMessage from the peer), by
finalising it independently of the seller. This is now possible since
their 2-of-2 signature is included in the DelayedPayoutSignatureRequest.
Check that the final delayedPayoutTx received from the seller matches it
byte-for-byte (which actually makes its receipt redundant now).

This also fixes an apparent security bug, where the final validation of
the delayedPayoutTx appears to skip any kind of signature check (only a
deposit tx hash check, which is still necessary).

Finally, optimistically check the deposit tx against the input of the
prepared delayedPayoutTx received from the seller, in the case that the
former is non-malleable (that is, the fully segwit case) and thus has a
stable ID given by the hash of the buyer's preparedDepositTx.
2020-11-19 17:19:13 +00:00
Steven Barclay
f02d5ee216
Send seller's delayedPayoutTx signature to peer ASAP
Include a new 'delayedPayoutTxSellerSignature' field with the prepared
delayed payout tx sent to the buyer, in DelayedPayoutTxSignatureRequest.
This will allow the buyer to compute the final, signed delayedPayoutTx
as early as possible and withhold their deposit tx witness from the
seller until they know they have a valid delayedPayoutTx, preventing its
premature publishing in the fully segwit case. (To be done in a later
commit - for now just save the seller's delayedPayoutTx signature.)

As part of this, run the SellerSignsDelayedPayoutTx trade task at an
earlier step (just after payout tx creation) to make its signature
available to the seller ASAP. Also rename 'delayedPayoutTxSignature' to
'delayedPayoutTxBuyerSignature' in DelayedPayoutTxSignatureResponse.
2020-11-19 17:19:12 +00:00
Steven Barclay
79fa219533
Fix missing segwit case when sanitising preparedDepositTx
Make sure witness data is stripped from the seller's prepared deposit
tx, in addition to ScriptSig data, to prevent the buyer from being able
to publish it prematurely (before having signed the delayed payout tx).
2020-11-19 17:19:07 +00:00
ghubstan
ff887eb339
Fix createpaymentacct validation problems
- Add missing boilerplate error handling to GrpcPaymentAccountsService.

- Edit some PaymentAccountForm & PaymentAccountTypeAdapter exception
  messages that would be passed to CLI;  they should be in the same
  style as existing CLI err msgs.
2020-11-19 13:38:34 -03:00
Steven Barclay
88d7d96427
Fix failing OpenOfferManagerTest & PeerManagerTest
These are failing on the tip of release/1.5.0 currently due to extra
validation added to PersistenceManager, causing the build to fail upon
merging upstream. Add missing PersistenceManager.shutDown calls to the
tearDown methods of the affected tests to fix.
2020-11-19 16:47:21 +01:00
Christoph Atteneder
ce265e48b7
Merge pull request #4816 from chimp1984/reduce-persistence-interval
Fix issues with missing persistence for trade state
2020-11-19 16:33:46 +01:00
chimp1984
a4db09fe1d
Move delay for applying mailbox messages inside onInitialized
We need to set addDecryptedDirectMessageListener without
delay as otherwise we could miss direct messages (detected
with localhost testing, with tor its likely slower and
would not have been triggered).
2020-11-19 10:19:48 -05:00
chimp1984
d6f4eed39e
Add requestPersistence call at TradeTask.complete call.
This is not really needed as we call it at each state change of the
trade but gives more redundancy in case we missed one or once
changes are applied and a dev forgets to call it.

Multiple repeated calls do have close to zero costs.
2020-11-19 09:51:06 -05:00
chimp1984
da9b42fb83
Handle potential deposit confirmed state issues
The deposit confirmed state is set after we applied the mailbox messages,
which led to a task failure due wrong phase and the message was not applied.
Further it can be that the wallet is still syncing and the deposit
confirmed state is set in any time in the future.

To fix the first problem we add a bit of delay so that the trade has
been updated when we apply the mailbox messages. A better fix would be to change
the order of the methods but that is a bit tricky to get right and I dont want to
risk that for that release.

The second problem would require a large change to trigger the mailbox
processing based on wallet state. We prefer to be more tolerant with
the expected phase instead so allow the mailbox message to be processed
also in the DEPOSIT_PUBLISHED state.
This has no risks as the payout tx would be invalid anyway if the
buyer has cheated and sent the msg in not confirmed deposit tx state (only
possible with code manipulation).

A better fix would to add a listener for the wallet and process
the mailbox msg once wallet is ready and trade state set, but I
leave that for another PR.
2020-11-19 00:34:40 -05:00
chimp1984
706ec5a2ed
Add null checks for tradeManager
We get called some setter methods from protobuf methods before tradeManager is set.
2020-11-19 00:07:34 -05:00
chimp1984
438a0d8217
Remove requestPersistence in constructor as TradeManager is not set at that moment. 2020-11-18 19:58:20 -05:00
ghubstan
08228d07bc
Replace existing api method 'createpaymentacct' impl
In the CLI, this method now takes a single argument, the path to a json
file (a payment account form).  The json text is read from the file
and sent to the server, where it is serialized to a new PaymentAccount
instance, saved, and sent back to the CLI as a protobuf.PaymentAccount.

- Modified existing gRPC boilerplate in grpc.proto and GrpcPaymentAccountsService.

- Modified existing method signatures in CoreApi and CorePaymentAccountsService.

- Replaced existing method impl in CorePaymentAccountsService and
  removed dead code.

- Replaced the CLI's existing 'createpaymentacct' method impl.

- Modified existing tests.
2020-11-18 19:23:21 -03:00
Oscar Guindzberg
5906950e1f
Calculate witness sig with AES key 2020-11-18 18:28:06 -03:00
ghubstan
8996fa1748
Add boilerplate for new 'getpaymentacctform' api method 2020-11-18 16:17:24 -03:00
ghubstan
32dd727a89
Add new PaymentAccountForm to core.api.model
This class uses the gson PaymentAccountTypeAdapter to generate editable
json forms for PaymentAccount sub-types, and instantiate PaymentAccount
instances from edited json forms.
2020-11-18 16:16:04 -03:00
ghubstan
1f84ad0fd1
Add isCountryBasedPaymentAccount to abstract PaymentAccount 2020-11-18 16:15:13 -03:00
ghubstan
c25debaf99
Add new (gson) PaymentAccountTypeAdapter to core.api.model
This class does most of the work of the api's (create) PaymentAccount
json form serialization/de-serialization.
2020-11-18 16:12:42 -03:00
chimp1984
6fb36dcd41
Add more requestPersistence calls 2020-11-18 12:51:53 -05:00
chimp1984
255460e5d5
Add more requestPersistence for data changes in ProcessModel and TradingPeer 2020-11-18 12:38:39 -05:00
chimp1984
9517f427b6
Refactoring: Extract requestPersistence method 2020-11-18 12:12:59 -05:00
ghubstan
7d0648afd0
Make codacy happy again 2020-11-18 13:10:39 -03:00
ghubstan
0e0af20900
Avoid codacy issue over use of fully qualified name
Changed the core getPaymentMethods() -> getFiatPaymentMethods() to avoid

"Unnecessary use of fully qualified name 'PaymentMethod.getPaymentMethods'
due to existing static import 'bisq.core.payment.payload.PaymentMethod.*'"
2020-11-18 12:58:58 -03:00
ghubstan
0046b08f9d
Revert "Avoid codacy issue over use of fully qualified name"
This reverts commit a46526198d.

The service side method name change is not correct.
2020-11-18 12:47:12 -03:00
ghubstan
a46526198d
Avoid codacy issue over use of fully qualified name
Had to change the getPaymentMethods() names to getPaymentMethodIds() to
avoid this codacy issue:

"Unnecessary use of fully qualified name 'PaymentMethod.getPaymentMethods'
due to existing static import 'bisq.core.payment.payload.PaymentMethod.*'"

If 'PaymentMethod.getPaymentMethods' was changed to 'getPaymentMethods',
a recursive loop would result, ending in an out of stack heap crash.

This renaming of the method on the server is correct, but the CLI's
'getpaymentmethods' name was not changed.
2020-11-18 12:29:59 -03:00
ghubstan
ec381522ff
Add api method 'getpaymentmethods'
Returns a list of supported payment method IDs.  This gives CLI users
the correct payment method id for creating a new payment account.

- Added gRPC service GetPaymentMethods to grpc.proto.

- Added gRPC boilerplate method to GrpcPaymentAccountsService.

- Added implimentation to CoreApi -> CorePaymentAccountsService.

- Refactored PaymentAccountTest hierarchy.

- Add api method to CLI.
2020-11-18 12:03:22 -03:00
Christoph Atteneder
457257b72a
Merge pull request #4787 from chimp1984/various-monitor-improvements
Various monitor improvements
2020-11-18 11:01:01 +01:00
Christoph Atteneder
29b2c33222
Merge pull request #4814 from jmacxx/improve_account_aging_column
Improve UI/UX for account aging column in 'Offers' section of GUI
2020-11-18 10:41:10 +01:00
chimp1984
fa0c28adf6
Add requestPersistence calls
We relied on the shutdwon routine to be called reliably but it seems that is not the case as some bug reports show.
So we call requestPersistence at every write access of the trade object
2020-11-17 22:35:51 -05:00
chimp1984
6d7c3ad4dc
Remove dev log 2020-11-17 20:15:54 -05:00
chimp1984
5b97b97349
Add missing fields in toString method 2020-11-17 20:12:25 -05:00
jmacxx
dd26077caa
Improve UI/UX for account aging column in 'Offers' section of GUI
Showing 'x' days until limits lifted (signed, pending)
Showing clock icon (signed, pending)
Showing outlined check icon (aging accounts)
Showing account age (unsigned or aging)
Changed column name from 'Signed since' to 'Account info'

Fixed bug when switching between altcoins and fiat order books
the account info column was being added back to the table in
the wrong position.
2020-11-16 10:44:01 -06:00
ghubstan
530a9f95a4
Remove unused imports 2020-11-14 13:34:59 -03:00
ghubstan
187a85f95b
Fix typo 2020-11-14 13:19:24 -03:00
ghubstan
7e9ab22d65
Refactor api getbalance methods.
This change fixes the recently bloated wallet balances api.  Now there
is one CLI getbalance [bsq|btc] method that calls a getbalances(currency-code)
on the server.  The server returns full wallet balance information for
BSQ, BTC, or both if the CLI's currency argument is absent.

- grpc.proto:  Reduced number of getbalance(s) proto services from
  four to one.

- GrpcWalletsService:  Reduced number of getbalance(s) gRPC service
  boilerplate methods from four to one.

- CoreApi, CoreWalletsService:  Reduced number of getbalance(s) gRPC
  service implementation methods from four to one.

- CliMain:  Reduced number of getbalance(s) commands from four to one.

- BalancesInfo: Changed BsqBalanceInfo & BtcBalanceInfo field names
  to bsq and btc, respectively, to make calling their accessors
  more readable, less verbose.

- BtcBalanceInfo, BsqBalanceInfo: Defined static final EMPTY instances
  as place holders in a BalancesInfo returned by the gRPC server, when
  one or the other balance types is not requested.  Would be nice
  to serve Optional.empty() instead, but protobuf does not support
  it or null.

- Adjusted affected api tests and build doc.
2020-11-14 13:08:10 -03:00
sqrrm
627e0671b6
Merge pull request #4792 from ripcurlx/update-data-stores-for-v1.5.0
Update data stores for v1.5.0
2020-11-14 12:56:23 +01:00
ghubstan
722460e7e5
Support paying trade fees in bsq or btc (api)
- Add optional makerFeeCurrencyCode argument to CLI's 'createoffer'.

- Add optional takerFeeCurrencyCode argument to CLI's 'takeoffer'.

- Add isCurrencyForMakerFeeBtc field to OfferInfo proto wrapper.

- Pass fee currency argument down to CoreOffersService and CoreTradesService's
  create and take offer methods.

- Add maybeSetFeePaymentCurrencyPreference method to OfferUtil to
  conditionally set the 'payFeeInBtc' preference before creating
  or taking an offer.

- Adjust affected tests.
2020-11-13 16:36:06 -03:00
ghubstan
4a90b4008a
Resolve 'Avoid creating BigDecimal with a decimal' issue for codacy 2020-11-13 15:52:30 -03:00
ghubstan
446bd328d8
Refactor desktop's BsqSendView, share with api
Moved just enough code out of BsqSendView to avoid desktop/api
'sendbsq' duplication, at the cost of adding 1 new method to
BsqSendView.

- Created new BsqTransferModel to hold tx details shared by desktop and api.

- Created new BsqTransferService to send bsq using a BsqTransferModel shared
  by desktop and api.

- Uncommented CoreWalletsService#sendBsq implementation.

- Uncommented sendbsq tests.
2020-11-13 15:34:18 -03:00
ghubstan
0d3b3a6ead
Stub out api method 'sendbsq' in core
All the boilerplate for this method is included in this change, but
the implementation in CoreWalletsService#sendBsq is commented out
until the needed logic to send bsq is refactored out of desktop's
BsqSendView class -- to be included in the next PR.

- Added new method to CLI.

- Added the gRPC server boilerplate.

- Added the core implementation, commented out.

- Enabled tests.
2020-11-13 14:57:28 -03:00
ghubstan
208a37b339
Implement and test new getbalance(s) api methods
- Added three new methods to CLI:

      getbalances   ...	returns complete bsq and btc balance info
      getbsqbalance ...	returns complete bsq balance info
      getbtcbalance ...	returns complete btc balance info

      The old getbalance method is deprecated and will be removed
      if there is agreement to do that.

- Made the needed changes in the CLI's output formatting classes.

- Added new tests to existing BsqWalletTest, added new BtcWalletTest
  and WalletBalancesTest.

- Added disabled tests for funding a bsq wallet (todo in next PR).
2020-11-13 14:21:26 -03:00
ghubstan
c1c099c832
Implement and test api method 'getunusedbsqaddress'
- Added new method to CLI, split some long msg strings into two lines,
  and added a white space after a braceless else statement.

- Added the gRPC server boilerplate.

- Added the core implementation.

- Added a test, and moved method wallet tests into their own package.
2020-11-13 12:40:16 -03:00
ghubstan
faf45ec301
Add proto wrappers for serving bsq, btc or all balances
This change adds proto wrappers for sending bsq, btc, or all balances
to the CLI.  They will be used in future api method implementations:
getbsqbalance, getbtcbalance and getbalances.
2020-11-13 11:24:08 -03:00
Christoph Atteneder
61c8d55a6f
Merge pull request #4791 from wiz/remove-legacy-bsq-explorers
Remove legacy BSQ explorers
2020-11-13 14:07:02 +01:00
wiz
fcf7de611a
Remove legacy BSQ explorers 2020-11-13 13:45:19 +01:00
wiz
2520901350
Temporarily disable wiz's monero explorer node
Will re-enable later after making a new monero node on a new server
2020-11-13 13:45:07 +01:00
wiz
5a08c8b7ba
Remove legacy BSQ explorers 2020-11-13 21:29:36 +09:00
wiz
c2baf3fa7d
Temporarily disable wiz's monero explorer node
Will re-enable later after making a new monero node on a new server
2020-11-13 21:03:30 +09:00
Christoph Atteneder
37be138830
Update bitcoinj checkpoints for v1.5.0 2020-11-13 12:29:29 +01:00
chimp1984
a238c205ab
Add Amazon eGift Card payment method 2020-11-13 00:26:23 -05:00
chimp1984
2b807769d4
Update commit hash to 7f83d1b3 2020-11-12 15:58:58 -05:00
chimp1984
1b7c1ce49a
Only reset numAllConnectionsLostEvents if we have nodes connected 2020-11-12 15:58:57 -05:00
chimp1984
6a2583d5fa
Decrease deviationTolerance for numAllConnectionsLostEvents 2020-11-12 15:58:57 -05:00