Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay broadcasting of taker fee tx #2488

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
03d0a22
Allow spending of unconfirmed BSQ change outputs
ManfredKarrer Mar 1, 2019
4332c16
Cleanup
ManfredKarrer Mar 1, 2019
dd96a18
Delay broadcasting of taker fee tx
ManfredKarrer Mar 2, 2019
e62557c
Merge branch 'master' into allow-spending-unconfirmed-bsq-utxs
ManfredKarrer Mar 2, 2019
6c11fc1
Add altcoin payment method for live trading
ManfredKarrer Mar 3, 2019
11adc99
Use super classes for cryptCurrencyAccount and payload
ManfredKarrer Mar 3, 2019
54e39c3
Remove dev button, add "trade instant" checkbox
ManfredKarrer Mar 3, 2019
992480d
Refactoring: Renaming
ManfredKarrer Mar 3, 2019
9475cf2
Merge branch 'master' into allow-spending-unconfirmed-bsq-utxs
ManfredKarrer Mar 3, 2019
1802508
Fix BSQ balance display for unconfirmed change outputs
ManfredKarrer Mar 3, 2019
568be3d
Add missing check for isAvailableForSpending at unverifiedBalance
ManfredKarrer Mar 3, 2019
a0dd010
Fix balance update in case at vote result. Rename methods
ManfredKarrer Mar 3, 2019
8d73308
Refactor: Rename onParseTxsComplete to onParseBlockComplete
ManfredKarrer Mar 3, 2019
e414e91
Refactor: Rename onParseTxsCompleteAfterBatchProcessing to
ManfredKarrer Mar 3, 2019
c5a383d
Fix balance for confiscated bonds
ManfredKarrer Mar 3, 2019
b9bfa83
Merge branch 'master' into avoid-taker-fee-publishing-for-failed-trades
ManfredKarrer Mar 3, 2019
f44e9b1
Merge branch 'master' into avoid-taker-fee-publishing-for-failed-trades
ManfredKarrer Mar 3, 2019
44f5798
Merge branch 'master' into add-live-trading
ManfredKarrer Mar 4, 2019
997819e
Add line break
ManfredKarrer Mar 4, 2019
0711ab9
Reduce timeout to 90 sec
ManfredKarrer Mar 4, 2019
ed6fa7b
Increase TTL for offer from 7 to 8 min.
ManfredKarrer Mar 4, 2019
afd9d9c
Fix table layout
ManfredKarrer Mar 4, 2019
35dfc4b
Delay broadcasting of taker fee tx
ManfredKarrer Mar 2, 2019
db4c6f5
Reduce timeout to 90 sec
ManfredKarrer Mar 4, 2019
e4bd079
List Arqma (ARQ)
ArqTras Mar 4, 2019
5b6d986
Merge pull request #2433 from ArqTras/arqma
ripcurlx Mar 4, 2019
9e7a619
Merge branch 'master' into add-live-trading
ManfredKarrer Mar 4, 2019
804f8e9
Improve wording
ManfredKarrer Mar 4, 2019
dcadbdf
Merge branch 'master' into avoid-taker-fee-publishing-for-failed-trades
ManfredKarrer Mar 4, 2019
f790bfc
Merge branch 'add-live-trading'
ManfredKarrer Mar 4, 2019
c91792c
Fix incorrect BSQ validator in send BSQ view
ManfredKarrer Mar 4, 2019
64f085c
Merge branch 'allow-spending-unconfirmed-bsq-utxs'
ManfredKarrer Mar 4, 2019
ba376fe
Add TxType to bsqWalletService.commit call
ManfredKarrer Mar 4, 2019
46d15dc
Merge remote-tracking branch 'origin/avoid-taker-fee-publishing-for-f…
ManfredKarrer Mar 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions assets/src/main/java/bisq/asset/coins/Arqma.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.asset.coins;

import bisq.asset.AltCoinAccountDisclaimer;
import bisq.asset.Coin;
import bisq.asset.CryptoNoteAddressValidator;

@AltCoinAccountDisclaimer("account.altcoin.popup.arq.msg")
public class Arqma extends Coin {

public Arqma() {
super("Arqma", "ARQ", new CryptoNoteAddressValidator(0x2cca, 0x6847));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
bisq.asset.coins.Actinium
bisq.asset.coins.Adeptio
bisq.asset.coins.Aeon
bisq.asset.coins.Arqma
bisq.asset.coins.Askcoin
bisq.asset.coins.Australiacash
bisq.asset.coins.Beam
Expand Down
44 changes: 44 additions & 0 deletions assets/src/test/java/bisq/asset/coins/ArqmaTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.asset.coins;

import bisq.asset.AbstractAssetTest;
import org.junit.Test;

public class ArqmaTest extends AbstractAssetTest {

public ArqmaTest() {
super(new Arqma());
}

@Test
public void testValidAddresses() {
assertValidAddress("ar3ZLUTSac5DhxhyLJB11gcXWLYPKJchg7c8hoaKmqchC9TtHEdXzxGgt2vzCLUYwtSvkJQTXNCjzCR7KZiFUySV138PEopVC");
assertValidAddress("aRS3V2hXuVAGAb5XWcDvN7McsSyqrEZ3XWyfMdEDCqioWNmVUuoKyNxDo7rwPCg55Ugb6KHXLN7hLZEGcnZzbm8M7uJ9YdVpeN");
assertValidAddress("ar3mXR6SQeC3P9Dmq2LGsAeq5eDvjiNnYaywtqdNzixe6xLr38DiNVaaRKMkAQkR3NV3TuVAwAwEGH3QDgXJF3th1RwxABa9a");
}

@Test
public void testInvalidAddresses() {
assertInvalidAddress("");
assertInvalidAddress("ar3ZLUTSac5DhxhyLJB11gcXWLYPKJchg7c8hoaKmqchC9TtHEdXzxGgt2vzCLUYwtSvkJQTXNCjzCR7KZiFUySV138PEopV");
assertInvalidAddress("aRS3V2hXuVAGAb5XWcDvN7McsSyqrEZ3XWyfMdEDCqioWNmVUuoKyNxDo7rwPCg55Ugb6KHXLN7hLZEGcnZzbm8M7uJ9YdVpeNZz");
assertInvalidAddress("aRV3V2hXuVAGAb5XWcDvN7McsSyqrEZ3XWyfMdEDCqioWNmVUuoKyNxDo7rwPCg55Ugb6KHXLN7hLZEGcnZzbm8M7uJ9YdVpeN");
assertInvalidAddress("ar3mXR6SQeC3P9Dmq2LGsAeq5eDvjiNnYaywtqdNzi#exLr38DiNVaaRKMkAQkR3NV3TuVAwAwEGH3QDgXJF3th1RwxABa9a");
}
}
16 changes: 16 additions & 0 deletions common/src/main/proto/pb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,7 @@ message PaymentAccountPayload {
HalCashAccountPayload hal_cash_account_payload = 24;
PromptPayAccountPayload prompt_pay_account_payload = 25;
AdvancedCashAccountPayload advanced_cash_account_payload = 26;
InstantCryptoCurrencyAccountPayload instant_crypto_currency_account_payload = 27;
}
map<string, string> exclude_from_json_data = 15;
}
Expand Down Expand Up @@ -836,6 +837,10 @@ message CryptoCurrencyAccountPayload {
string address = 1;
}

message InstantCryptoCurrencyAccountPayload {
string address = 1;
}

message FasterPaymentsAccountPayload {
string sort_code = 1;
string account_nr = 2;
Expand Down Expand Up @@ -954,6 +959,7 @@ message PersistableEnvelope {
DaoStateStore dao_state_store = 24;
MyReputationList my_reputation_list = 25;
MyProofOfBurnList my_proof_of_burn_list = 26;
UnconfirmedBsqChangeOutputList unconfirmed_bsq_change_output_list = 27;
}
}

Expand Down Expand Up @@ -1405,6 +1411,12 @@ message BaseTxOutput {
}
}

message UnconfirmedTxOutput {
int32 index = 1;
int64 value = 2;
string tx_id = 3;
}

message RawTxOutput {
}

Expand Down Expand Up @@ -1571,6 +1583,10 @@ message MyProofOfBurnList {
repeated MyProofOfBurn my_proof_of_burn = 1;
}

message UnconfirmedBsqChangeOutputList {
repeated UnconfirmedTxOutput unconfirmed_tx_output = 1;
}

message TempProposalPayload {
Proposal proposal = 1;
bytes owner_pub_key_encoded = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
import org.bitcoinj.core.Coin;

public interface BsqBalanceListener {
void onUpdateBalances(Coin availableBalance,
void onUpdateBalances(Coin availableConfirmedBalance,
Coin availableNonBsqBalance,
Coin unverifiedBalance,
Coin unconfirmedChangeBalance,
Coin lockedForVotingBalance,
Coin lockedInBondsBalance,
Coin unlockingBondsBalance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public Coin getChange(Coin target, CoinSelection coinSelection) throws Insuffici
return Coin.valueOf(change);
}

// We allow spending own pending txs and if permitForeignPendingTx is set as well foreign unconfirmed txs.
// We allow spending from own unconfirmed txs and if permitForeignPendingTx is set as well from foreign
// unconfirmed txs.
protected boolean isTxSpendable(Transaction tx) {
TransactionConfidence confidence = tx.getConfidence();
TransactionConfidence.ConfidenceType type = confidence.getConfidenceType();
Expand Down
29 changes: 24 additions & 5 deletions core/src/main/java/bisq/core/btc/wallet/BsqCoinSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

import bisq.core.dao.state.DaoStateService;
import bisq.core.dao.state.model.blockchain.TxOutputKey;
import bisq.core.dao.state.unconfirmed.UnconfirmedBsqChangeOutputListService;

import org.bitcoinj.core.Transaction;
import org.bitcoinj.core.TransactionOutput;

import javax.inject.Inject;
Expand All @@ -32,18 +34,35 @@
*/
@Slf4j
public class BsqCoinSelector extends BisqDefaultCoinSelector {
private DaoStateService daoStateService;
private final DaoStateService daoStateService;
private final UnconfirmedBsqChangeOutputListService unconfirmedBsqChangeOutputListService;

@Inject
public BsqCoinSelector(DaoStateService daoStateService) {
super(true);
public BsqCoinSelector(DaoStateService daoStateService, UnconfirmedBsqChangeOutputListService unconfirmedBsqChangeOutputListService) {
// permitForeignPendingTx is not relevant here as we do not support pending foreign utxos anyway.
super(false);
this.daoStateService = daoStateService;
this.unconfirmedBsqChangeOutputListService = unconfirmedBsqChangeOutputListService;
}

@Override
protected boolean isTxOutputSpendable(TransactionOutput output) {
// output.getParentTransaction() cannot be null as it is checked in calling method
return output.getParentTransaction() != null &&
daoStateService.isTxOutputSpendable(new TxOutputKey(output.getParentTransaction().getHashAsString(), output.getIndex()));
Transaction parentTransaction = output.getParentTransaction();
if (parentTransaction == null)
return false;

// If it is a normal confirmed BSQ output we use the default lookup at the daoState
if (daoStateService.isTxOutputSpendable(new TxOutputKey(parentTransaction.getHashAsString(), output.getIndex())))
return true;

// It might be that it is an unconfirmed change output which we allow to be used for spending without requiring a confirmation.
// We check if we have the output in the dao state, if so we have a confirmed but unspendable output (e.g. confiscated).
if (daoStateService.getTxOutput(new TxOutputKey(parentTransaction.getHashAsString(), output.getIndex())).isPresent())
return false;

// Only if its not existing yet in the dao state (unconfirmed) we use our unconfirmedBsqChangeOutputList to
// check if it is an own change output.
return unconfirmedBsqChangeOutputListService.hasTransactionOutput(output);
}
}
Loading