mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 15:00:30 +01:00
Fix typos and cleanup
This commit is contained in:
parent
ab214d3fe7
commit
587b55d37b
87 changed files with 177 additions and 177 deletions
|
@ -100,7 +100,7 @@ public class SignedWitnessService {
|
|||
addToMap((SignedWitness) payload);
|
||||
});
|
||||
|
||||
// At startup the P2PDataStorage initializes earlier, otherwise we ge the listener called.
|
||||
// At startup the P2PDataStorage initializes earlier, otherwise we get the listener called.
|
||||
p2PService.getP2PDataStorage().getAppendOnlyDataStoreMap().values().forEach(e -> {
|
||||
if (e instanceof SignedWitness)
|
||||
addToMap((SignedWitness) e);
|
||||
|
|
|
@ -87,7 +87,7 @@ public class AccountAgeWitness implements LazyProcessedPayload, PersistableNetwo
|
|||
|
||||
@Override
|
||||
public boolean isDateInTolerance(Clock clock) {
|
||||
// We don't allow older or newer then 1 day.
|
||||
// We don't allow older or newer than 1 day.
|
||||
// Preventing forward dating is also important to protect against a sophisticated attack
|
||||
return Math.abs(new Date().getTime() - date) <= TOLERANCE;
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ public class AccountAgeWitnessService {
|
|||
addToMap((AccountAgeWitness) payload);
|
||||
});
|
||||
|
||||
// At startup the P2PDataStorage initializes earlier, otherwise we ge the listener called.
|
||||
// At startup the P2PDataStorage initializes earlier, otherwise we get the listener called.
|
||||
p2PService.getP2PDataStorage().getAppendOnlyDataStoreMap().values().forEach(e -> {
|
||||
if (e instanceof AccountAgeWitness)
|
||||
addToMap((AccountAgeWitness) e);
|
||||
|
@ -522,7 +522,7 @@ public class AccountAgeWitnessService {
|
|||
private boolean verifyPeersCurrentDate(Date peersCurrentDate, ErrorMessageHandler errorMessageHandler) {
|
||||
final boolean result = Math.abs(peersCurrentDate.getTime() - new Date().getTime()) <= TimeUnit.DAYS.toMillis(1);
|
||||
if (!result) {
|
||||
final String msg = "Peers current date is further then 1 day off to our current date. " +
|
||||
final String msg = "Peers current date is further than 1 day off to our current date. " +
|
||||
"PeersCurrentDate=" + peersCurrentDate + "; myCurrentDate=" + new Date();
|
||||
log.warn(msg);
|
||||
errorMessageHandler.handleErrorMessage(msg);
|
||||
|
|
|
@ -168,7 +168,7 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
|
|||
* The parsing is done when the actual value is going to be retrieved, i.e. options.valueOf(attributename).
|
||||
*
|
||||
* In order to keep usability high, we work around the aforementioned characteristics by catching the exception below
|
||||
* (valueOf is called somewhere in getBisqEnvironment), thus, neatly inform the user of a ill-formed parameter and stop execution.
|
||||
* (valueOf is called somewhere in getBisqEnvironment), thus, neatly inform the user of an ill-formed parameter and stop execution.
|
||||
*
|
||||
* Might be changed when the project features more user parameters meant for the user.
|
||||
*/
|
||||
|
|
|
@ -501,7 +501,7 @@ public class BisqSetup {
|
|||
// We want to test if the client is compiled with the correct crypto provider (BountyCastle)
|
||||
// and if the unlimited Strength for cryptographic keys is set.
|
||||
// If users compile themselves they might miss that step and then would get an exception in the trade.
|
||||
// To avoid that we add here at startup a sample encryption and signing to see if it don't causes an exception.
|
||||
// To avoid that we add a sample encryption and signing here at startup to see if it doesn't cause an exception.
|
||||
// See: https://github.com/bisq-network/exchange/blob/master/doc/build.md#7-enable-unlimited-strength-for-cryptographic-keys
|
||||
new Thread(() -> {
|
||||
try {
|
||||
|
@ -780,13 +780,13 @@ public class BisqSetup {
|
|||
if (filter != null && filterWarningHandler != null) {
|
||||
if (filter.getSeedNodes() != null && !filter.getSeedNodes().isEmpty()) {
|
||||
log.warn(Res.get("popup.warning.nodeBanned", Res.get("popup.warning.seed")));
|
||||
// Lets keep that more silent. Might be used in case a node is unstable and we don't want to confuse users.
|
||||
// Let's keep that more silent. Might be used in case a node is unstable and we don't want to confuse users.
|
||||
// filterWarningHandler.accept(Res.get("popup.warning.nodeBanned", Res.get("popup.warning.seed")));
|
||||
}
|
||||
|
||||
if (filter.getPriceRelayNodes() != null && !filter.getPriceRelayNodes().isEmpty()) {
|
||||
log.warn(Res.get("popup.warning.nodeBanned", Res.get("popup.warning.priceRelay")));
|
||||
// Lets keep that more silent. Might be used in case a node is unstable and we don't want to confuse users.
|
||||
// Let's keep that more silent. Might be used in case a node is unstable and we don't want to confuse users.
|
||||
// filterWarningHandler.accept(Res.get("popup.warning.nodeBanned", Res.get("popup.warning.priceRelay")));
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class SetupUtils {
|
|||
// We want to test if the client is compiled with the correct crypto provider (BountyCastle)
|
||||
// and if the unlimited Strength for cryptographic keys is set.
|
||||
// If users compile themselves they might miss that step and then would get an exception in the trade.
|
||||
// To avoid that we add here at startup a sample encryption and signing to see if it don't causes an exception.
|
||||
// To avoid that we add a sample encryption and signing here at startup to see if it doesn't cause an exception.
|
||||
// See: https://github.com/bisq-network/exchange/blob/master/doc/build.md#7-enable-unlimited-strength-for-cryptographic-keys
|
||||
Thread checkCryptoThread = new Thread(() -> {
|
||||
try {
|
||||
|
|
|
@ -54,7 +54,7 @@ public class BitcoinModule extends AppModule {
|
|||
|
||||
@Override
|
||||
protected void configure() {
|
||||
// If we we have selected BTC_DAO_REGTEST or BTC_DAO_TESTNET we use our master regtest node,
|
||||
// If we have selected BTC_DAO_REGTEST or BTC_DAO_TESTNET we use our master regtest node,
|
||||
// otherwise the specified host or default (localhost)
|
||||
String regTestHost = environment.getProperty(BtcOptionKeys.REG_TEST_HOST, String.class, "");
|
||||
if (regTestHost.isEmpty()) {
|
||||
|
|
|
@ -42,7 +42,7 @@ import javax.annotation.Nullable;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Every trade use a addressEntry with a dedicated address for all transactions related to the trade.
|
||||
* Every trade uses a addressEntry with a dedicated address for all transactions related to the trade.
|
||||
* That way we have a kind of separated trade wallet, isolated from other transactions and avoiding coin merge.
|
||||
* If we would not avoid coin merge the user would lose privacy between trades.
|
||||
*/
|
||||
|
@ -60,7 +60,7 @@ public final class AddressEntry implements PersistablePayload {
|
|||
|
||||
// keyPair can be null in case the object is created from deserialization as it is transient.
|
||||
// It will be restored when the wallet is ready at setDeterministicKey
|
||||
// So after startup it never must be null
|
||||
// So after startup it must never be null
|
||||
|
||||
@Nullable
|
||||
@Getter
|
||||
|
|
|
@ -111,7 +111,7 @@ public final class AddressEntryList implements PersistableEnvelope, PersistedDat
|
|||
add(new AddressEntry(wallet.freshReceiveKey(), AddressEntry.Context.ARBITRATOR));
|
||||
|
||||
// In case we restore from seed words and have balance we need to add the relevant addresses to our list.
|
||||
// IssuedReceiveAddresses does not contain all addressed where we expect balance so we need to listen to
|
||||
// IssuedReceiveAddresses does not contain all addresses where we expect balance so we need to listen to
|
||||
// incoming txs at blockchain sync to add the rest.
|
||||
if (wallet.getBalance().isPositive()) {
|
||||
wallet.getIssuedReceiveAddresses().forEach(address -> {
|
||||
|
|
|
@ -60,7 +60,7 @@ import static com.google.common.base.Preconditions.checkState;
|
|||
// override it.
|
||||
// The changes to DefaultRiskAnalysis are: removal of the RBF check and accept as standard an OP_RETURN outputs
|
||||
// with 0 value.
|
||||
// For Bisq's use cases RBF is not considered risky. Requiring a confirmation for RBF payments from a users
|
||||
// For Bisq's use cases RBF is not considered risky. Requiring a confirmation for RBF payments from a user's
|
||||
// external wallet to Bisq would hurt usability. The trade transaction requires anyway a confirmation and we don't see
|
||||
// a use case where a Bisq user accepts unconfirmed payment from untrusted peers and would not wait anyway for at least
|
||||
// one confirmation.
|
||||
|
|
|
@ -61,7 +61,7 @@ public class BsqCoinSelector extends BisqDefaultCoinSelector {
|
|||
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
|
||||
// Only if it's 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);
|
||||
}
|
||||
|
|
|
@ -613,7 +613,7 @@ public class BsqWalletService extends WalletService implements DaoStateListener
|
|||
|
||||
// We need to require one BSQ change output as we could otherwise not be able to distinguish between 2
|
||||
// structurally same transactions where only the BSQ fee is different. In case of asset listing fee and proof of
|
||||
// burn it is a user input, so it is not know to the parser, instead we derive the burned fee from the parser.
|
||||
// burn it is a user input, so it is not known to the parser, instead we derive the burned fee from the parser.
|
||||
|
||||
// In case of proposal fee we could derive it from the params.
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class BtcCoinSelector extends BisqDefaultCoinSelector {
|
|||
}
|
||||
}
|
||||
|
||||
// We ignore utxos which are considered dust attacks for spying on users wallets.
|
||||
// We ignore utxos which are considered dust attacks for spying on users' wallets.
|
||||
// The ignoreDustThreshold value is set in the preferences. If not set we use default non dust
|
||||
// value of 546 sat.
|
||||
@Override
|
||||
|
|
|
@ -408,13 +408,13 @@ public class BtcWalletService extends WalletService {
|
|||
TransactionVerificationException, WalletException, InsufficientMoneyException {
|
||||
// preparedBsqTx has following structure:
|
||||
// inputs [1-n] BSQ inputs
|
||||
// outputs [1] BSQ receivers output
|
||||
// outputs [1] BSQ receiver's output
|
||||
// outputs [0-1] BSQ change output
|
||||
|
||||
// We add BTC mining fee. Result tx looks like:
|
||||
// inputs [1-n] BSQ inputs
|
||||
// inputs [1-n] BTC inputs
|
||||
// outputs [1] BSQ receivers output
|
||||
// outputs [1] BSQ receiver's output
|
||||
// outputs [0-1] BSQ change output
|
||||
// outputs [0-1] BTC change output
|
||||
// mining fee: BTC mining fee
|
||||
|
@ -426,14 +426,14 @@ public class BtcWalletService extends WalletService {
|
|||
|
||||
// preparedBsqTx has following structure:
|
||||
// inputs [1-n] BSQ inputs
|
||||
// outputs [1] BSQ receivers output
|
||||
// outputs [1] BSQ receiver's output
|
||||
// outputs [0-1] BSQ change output
|
||||
// mining fee: optional burned BSQ fee (only if opReturnData != null)
|
||||
|
||||
// We add BTC mining fee. Result tx looks like:
|
||||
// inputs [1-n] BSQ inputs
|
||||
// inputs [1-n] BTC inputs
|
||||
// outputs [0-1] BSQ receivers output
|
||||
// outputs [0-1] BSQ receiver's output
|
||||
// outputs [0-1] BSQ change output
|
||||
// outputs [0-1] BTC change output
|
||||
// outputs [0-1] OP_RETURN with opReturnData (only if opReturnData != null)
|
||||
|
@ -672,7 +672,7 @@ public class BtcWalletService extends WalletService {
|
|||
|
||||
public void resetAddressEntriesForPendingTrade(String offerId) {
|
||||
swapTradeEntryToAvailableEntry(offerId, AddressEntry.Context.MULTI_SIG);
|
||||
// We swap also TRADE_PAYOUT to be sure all is cleaned up. There might be cases where a user cannot send the funds
|
||||
// We swap also TRADE_PAYOUT to be sure all is cleaned up. There might be cases where a user cannot send the funds
|
||||
// to an external wallet directly in the last step of the trade, but the funds are in the Bisq wallet anyway and
|
||||
// the dealing with the external wallet is pure UI thing. The user can move the funds to the wallet and then
|
||||
// send out the funds to the external wallet. As this cleanup is a rare situation and most users do not use
|
||||
|
@ -1110,7 +1110,7 @@ public class BtcWalletService extends WalletService {
|
|||
return sendRequest;
|
||||
}
|
||||
|
||||
// We ignore utxos which are considered dust attacks for spying on users wallets.
|
||||
// We ignore utxos which are considered dust attacks for spying on users' wallets.
|
||||
// The ignoreDustThreshold value is set in the preferences. If not set we use default non dust
|
||||
// value of 546 sat.
|
||||
@Override
|
||||
|
|
|
@ -49,7 +49,7 @@ public class NonBsqCoinSelector extends BisqDefaultCoinSelector {
|
|||
if (parentTransaction == null)
|
||||
return false;
|
||||
|
||||
// It is important to not allow pending txs as otherwise unconfirmed BSQ txs would considered nonBSQ as
|
||||
// It is important to not allow pending txs as otherwise unconfirmed BSQ txs would be considered nonBSQ as
|
||||
// below outputIsNotInBsqState would be true.
|
||||
if (parentTransaction.getConfidence().getConfidenceType() != TransactionConfidence.ConfidenceType.BUILDING)
|
||||
return false;
|
||||
|
|
|
@ -206,7 +206,7 @@ public class TradeWalletService {
|
|||
// outputs [0-1] BTC change output
|
||||
// mining fee: BTC mining fee + burned BSQ fee
|
||||
|
||||
// In case of txs for burned BSQ fees we have no receiver output and it might be that there is no change outputs
|
||||
// In case of txs for burned BSQ fees we have no receiver output and it might be that there are no change outputs
|
||||
// We need to guarantee that min. 1 valid output is added (OP_RETURN does not count). So we use a higher input
|
||||
// for BTC to force an additional change output.
|
||||
|
||||
|
@ -273,7 +273,7 @@ public class TradeWalletService {
|
|||
|
||||
// We construct the deposit transaction in the way that the buyer is always the first entry (inputs, outputs, MS keys) and then the seller.
|
||||
// In the creation of the deposit tx the taker/maker roles are the determining roles instead of buyer/seller.
|
||||
// In the payout tx is is the buyer/seller role. We keep the buyer/seller ordering over all transactions to not get confusion with ordering,
|
||||
// In the payout tx it is the buyer/seller role. We keep the buyer/seller ordering over all transactions to not get confusion with ordering,
|
||||
// which is important to follow correctly specially for the order of the MS keys.
|
||||
|
||||
|
||||
|
@ -437,7 +437,7 @@ public class TradeWalletService {
|
|||
List<TransactionInput> makerInputs = dummyTx.getInputs();
|
||||
TransactionOutput makerOutput = null;
|
||||
|
||||
// We don't support more then 1 optional change output
|
||||
// We don't support more than 1 optional change output
|
||||
checkArgument(dummyTx.getOutputs().size() < 3, "dummyTx.getOutputs().size() >= 3");
|
||||
|
||||
// Only save change outputs, the dummy output is ignored (that's why we start with index 1)
|
||||
|
@ -457,14 +457,14 @@ public class TradeWalletService {
|
|||
}
|
||||
|
||||
// Add seller inputs
|
||||
// the sellers input is not signed so we attach empty script bytes
|
||||
// the seller's input is not signed so we attach empty script bytes
|
||||
for (RawTransactionInput rawTransactionInput : takerRawTransactionInputs)
|
||||
preparedDepositTx.addInput(getTransactionInput(preparedDepositTx, new byte[]{}, rawTransactionInput));
|
||||
} else {
|
||||
// taker is buyer role
|
||||
|
||||
// Add buyer inputs
|
||||
// the sellers input is not signed so we attach empty script bytes
|
||||
// the seller's input is not signed so we attach empty script bytes
|
||||
for (RawTransactionInput rawTransactionInput : takerRawTransactionInputs)
|
||||
preparedDepositTx.addInput(getTransactionInput(preparedDepositTx, new byte[]{}, rawTransactionInput));
|
||||
|
||||
|
@ -1012,7 +1012,7 @@ public class TradeWalletService {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// Emergency payout tool. Used only in cased when the payput from the arbitrator does not work because some data
|
||||
// Emergency payout tool. Used only in cased when the payout from the arbitrator does not work because some data
|
||||
// in the trade/dispute are messed up.
|
||||
// We keep here arbitratorPayoutAmount just in case (requires cooperation from peer anyway)
|
||||
public Transaction emergencySignAndPublishPayoutTxFrom2of3MultiSig(String depositTxHex,
|
||||
|
@ -1297,7 +1297,7 @@ public class TradeWalletService {
|
|||
Address changeAddress) throws WalletException {
|
||||
SendRequest sendRequest = null;
|
||||
try {
|
||||
// Lets let the framework do the work to find the right inputs
|
||||
// Let the framework do the work to find the right inputs
|
||||
sendRequest = SendRequest.forTx(transaction);
|
||||
sendRequest.shuffleOutputs = false;
|
||||
sendRequest.aesKey = aesKey;
|
||||
|
|
|
@ -96,8 +96,8 @@ public class TxBroadcaster {
|
|||
|
||||
broadcastTimerMap.put(txId, timeoutTimer);
|
||||
} else {
|
||||
// Would be due a wrong way how to use the API (calling 2 times a broadcast with same tx).
|
||||
// An arbitrator reported to got the error after a manual payout, need to investigate why...
|
||||
// Would be the wrong way how to use the API (calling 2 times a broadcast with same tx).
|
||||
// An arbitrator reported that got the error after a manual payout, need to investigate why...
|
||||
stopAndRemoveTimer(txId);
|
||||
UserThread.execute(() -> callback.onFailure(new TxBroadcastException("We got broadcastTx called with a tx " +
|
||||
"which has an open timeoutTimer. txId=" + txId, txId)));
|
||||
|
|
|
@ -258,7 +258,7 @@ public abstract class WalletService {
|
|||
KeyBag maybeDecryptingKeyBag = new DecryptingKeyBag(wallet, aesKey);
|
||||
if (txIn.getConnectedOutput() != null) {
|
||||
try {
|
||||
// We assume if its already signed, its hopefully got a SIGHASH type that will not invalidate when
|
||||
// We assume if it's already signed, it's hopefully got a SIGHASH type that will not invalidate when
|
||||
// we sign missing pieces (to check this would require either assuming any signatures are signing
|
||||
// standard output types or a way to get processed signatures out of script execution)
|
||||
txIn.getScriptSig().correctlySpends(tx, index, txIn.getConnectedOutput().getScriptPubKey(), Script.ALL_VERIFY_FLAGS);
|
||||
|
@ -277,11 +277,11 @@ public abstract class WalletService {
|
|||
Transaction partialTx = propTx.partialTx;
|
||||
txIn = partialTx.getInput(index);
|
||||
if (txIn.getConnectedOutput() != null) {
|
||||
// If we dont have a sig we don't do the check to avoid error reports of failed sig checks
|
||||
// If we don't have a sig we don't do the check to avoid error reports of failed sig checks
|
||||
final List<ScriptChunk> chunks = txIn.getConnectedOutput().getScriptPubKey().getChunks();
|
||||
if (!chunks.isEmpty() && chunks.get(0).data != null && chunks.get(0).data.length > 0) {
|
||||
try {
|
||||
// We assume if its already signed, its hopefully got a SIGHASH type that will not invalidate when
|
||||
// We assume if it's already signed, it's hopefully got a SIGHASH type that will not invalidate when
|
||||
// we sign missing pieces (to check this would require either assuming any signatures are signing
|
||||
// standard output types or a way to get processed signatures out of script execution)
|
||||
txIn.getScriptSig().correctlySpends(tx, index, txIn.getConnectedOutput().getScriptPubKey(), Script.ALL_VERIFY_FLAGS);
|
||||
|
|
|
@ -149,7 +149,7 @@ public class WalletsManager {
|
|||
}
|
||||
}
|
||||
|
||||
// A bsq tx has miner fees in btc included. Thus we need to handle it at both wallets.
|
||||
// A bsq tx has miner fees in btc included. Thus we need to handle it on both wallets.
|
||||
public void publishAndCommitBsqTx(Transaction tx, TxType txType, TxBroadcaster.Callback callback) {
|
||||
// We need to create another instance, otherwise the tx would trigger an invalid state exception
|
||||
// if it gets committed 2 times
|
||||
|
|
|
@ -299,7 +299,7 @@ public class DaoFacade implements DaoSetupService {
|
|||
return ProposalConsensus.getFee(daoStateService, chainHeight);
|
||||
}
|
||||
|
||||
// Publish proposal tx, proposal payload and and persist it to myProposalList
|
||||
// Publish proposal tx, proposal payload and persist it to myProposalList
|
||||
public void publishMyProposal(Proposal proposal, Transaction transaction, ResultHandler resultHandler,
|
||||
ErrorMessageHandler errorMessageHandler) {
|
||||
myProposalListService.publishTxAndPayload(proposal, transaction, resultHandler, errorMessageHandler);
|
||||
|
@ -393,7 +393,7 @@ public class DaoFacade implements DaoSetupService {
|
|||
// Use case: Presentation of phases
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Because last block in request and voting phases must not be used fo making a tx as it will get confirmed in the
|
||||
// Because last block in request and voting phases must not be used for making a tx as it will get confirmed in the
|
||||
// next block which would be already the next phase we hide that last block to the user and add it to the break.
|
||||
public int getFirstBlockOfPhaseForDisplay(int height, DaoPhase.Phase phase) {
|
||||
int firstBlock = periodService.getFirstBlockOfPhase(height, phase);
|
||||
|
@ -422,7 +422,7 @@ public class DaoFacade implements DaoSetupService {
|
|||
return firstBlock;
|
||||
}
|
||||
|
||||
// Because last block in request and voting phases must not be used fo making a tx as it will get confirmed in the
|
||||
// Because last block in request and voting phases must not be used for making a tx as it will get confirmed in the
|
||||
// next block which would be already the next phase we hide that last block to the user and add it to the break.
|
||||
public int getLastBlockOfPhaseForDisplay(int height, DaoPhase.Phase phase) {
|
||||
int lastBlock = periodService.getLastBlockOfPhase(height, phase);
|
||||
|
|
|
@ -32,8 +32,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||
|
||||
/**
|
||||
* We don't persist that list but use it only for encoding the VoteWithProposalTxId list
|
||||
* to PB bytes in the blindVote. The bytes gets encrypted and later decrypted. To use a ByteOutputStream
|
||||
* and add all list elements would work for encryption but for decrypting we don't know the length of an list entry
|
||||
* to PB bytes in the blindVote. The bytes get encrypted and later decrypted. To use a ByteOutputStream
|
||||
* and add all list elements would work for encryption but for decrypting we don't know the length of a list entry
|
||||
* and it would make the process complicate (e.g. require a custom serialisation format).
|
||||
*/
|
||||
@Slf4j
|
||||
|
|
|
@ -117,8 +117,8 @@ public class MyBondedReputationRepository implements DaoSetupService, BsqWalletS
|
|||
if (BondRepository.isConfiscated(myBondedReputation, daoStateService)) {
|
||||
myBondedReputation.setBondState(BondState.CONFISCATED);
|
||||
} else {
|
||||
// We don't have a UI use case for showing LOCKUP_TX_PENDING yet, but lets keep the code so if needed
|
||||
// its there.
|
||||
// We don't have a UI use case for showing LOCKUP_TX_PENDING yet, but let's keep the code so if needed
|
||||
// it's there.
|
||||
if (BondRepository.isLockupTxUnconfirmed(bsqWalletService, myBondedReputation.getBondedAsset()) &&
|
||||
myBondedReputation.getBondState() == BondState.READY_FOR_LOCKUP) {
|
||||
myBondedReputation.setBondState(BondState.LOCKUP_TX_PENDING);
|
||||
|
|
|
@ -94,7 +94,7 @@ public class BondedRolesRepository extends BondRepository<BondedRole, Role> {
|
|||
String lockupTxId = lockupTxOutput.getTxId();
|
||||
daoStateService.getTx(lockupTxId).ifPresent(lockupTx -> {
|
||||
byte[] opReturnData = lockupTx.getLastTxOutput().getOpReturnData();
|
||||
// We used the hash of th bonded bondedAsset object as our hash in OpReturn of the lock up tx to have a
|
||||
// We used the hash of the bonded bondedAsset object as our hash in OpReturn of the lock up tx to have a
|
||||
// unique binding of the tx to the data object.
|
||||
byte[] hash = BondConsensus.getHashFromOpReturnData(opReturnData);
|
||||
Optional<Role> candidate = findBondedAssetByHash(hash);
|
||||
|
|
|
@ -121,11 +121,11 @@ public class MeritConsensus {
|
|||
if (issuanceHeight < 0)
|
||||
throw new IllegalArgumentException("issuanceHeight must not be negative. issuanceHeight=" + issuanceHeight);
|
||||
|
||||
// We use a linear function to apply a factor for the issuance amount of 1 if the issuance was recent and 0
|
||||
// We use a linear function to apply a factor for the issuance amount of 1 if the issuance was recent and 0
|
||||
// if the issuance was 2 years old or older.
|
||||
// To avoid rounding issues with double values we multiply initially with a large number and divide at the end
|
||||
// by that number again. As we multiply the amount in satoshi we get a reasonable good precision even the long
|
||||
// division is not using rounding. Sticking with long values makes that operation more safe against consensus
|
||||
// by that number again. As we multiply the amount in satoshis we get a reasonable good precision even the long
|
||||
// division is not using rounding. Sticking with long values makes that operation safer against consensus
|
||||
// failures causes by rounding differences with double.
|
||||
|
||||
long maxAge = 2 * blocksPerYear; // maxAge=100 000 (MeritConsensus.BLOCKS_PER_YEAR is 50_000)
|
||||
|
|
|
@ -54,14 +54,14 @@ public enum Param {
|
|||
MIN_MAKER_FEE_BTC("0.00005", ParamType.BTC, 5, 5), // 0.005% of trade amount
|
||||
MIN_TAKER_FEE_BTC("0.00005", ParamType.BTC, 5, 5),
|
||||
|
||||
// Fee in BSQ satoshi for a 1 BTC trade. 100 Satoshi = 1 BSQ
|
||||
// Fee in BSQ satoshis for a 1 BTC trade. 100 satoshis = 1 BSQ
|
||||
// If 1 BTS is 1 USD the fee @5000 USD/BTC is 0.5 USD which is 10% of the BTC fee of 5 USD.
|
||||
// Might need adjustment if BSQ/BTC rate changes.
|
||||
DEFAULT_MAKER_FEE_BSQ("0.50", ParamType.BSQ, 5, 5), // ~ 0.01% of trade amount
|
||||
DEFAULT_TAKER_FEE_BSQ("1.5", ParamType.BSQ, 5, 5),
|
||||
// Min fee is the smallest fee allowed for a trade. If the default fee would be less than min fee the
|
||||
// min fee is used instead.
|
||||
// 0.03 BSQ (3 satoshi) for a 1 BTC trade. 0.05 USD if 1 BSQ = 1 USD, 10 % of the BTC fee
|
||||
// 0.03 BSQ (3 satoshis) for a 1 BTC trade. 0.05 USD if 1 BSQ = 1 USD, 10 % of the BTC fee
|
||||
MIN_MAKER_FEE_BSQ("0.03", ParamType.BSQ, 5, 5), // 0.0003%.
|
||||
MIN_TAKER_FEE_BSQ("0.03", ParamType.BSQ, 5, 5),
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public abstract class BaseProposalFactory<R extends Proposal> {
|
|||
throws ProposalValidationException, InsufficientMoneyException, TxException {
|
||||
this.name = name;
|
||||
this.link = link;
|
||||
// As we don't know the txId yes we create a temp proposal with txId set to an empty string.
|
||||
// As we don't know the txId yet we create a temp proposal with txId set to an empty string.
|
||||
R proposal = createProposalWithoutTxId();
|
||||
proposalValidator.validateDataFields(proposal);
|
||||
Transaction transaction = createTransaction(proposal);
|
||||
|
|
|
@ -190,7 +190,7 @@ public class ProposalListPresentation implements DaoStateListener, HashMapChange
|
|||
// in the list.
|
||||
// If a tx is not found in the daoStateService it can be that it is either unconfirmed or invalid.
|
||||
// To avoid inclusion of invalid txs we add a check for the confidence type PENDING from the bsqWalletService.
|
||||
// So we only add proposals if they are unconfirmed and therefor not yet parsed. Once confirmed they have to be
|
||||
// So we only add proposals if they are unconfirmed and therefore not yet parsed. Once confirmed they have to be
|
||||
// found in the daoStateService.
|
||||
List<Proposal> myUnconfirmedProposals = myProposalListService.getList().stream()
|
||||
.filter(p -> !daoStateService.getTx(p.getTxId()).isPresent()) // Tx is still not in our bsq blocks
|
||||
|
|
|
@ -159,7 +159,7 @@ public class ProposalService implements HashMapChangedListener, AppendOnlyDataSt
|
|||
|
||||
@Override
|
||||
public void onParseBlockCompleteAfterBatchProcessing(Block block) {
|
||||
// We try to broadcast at any block in the break1 phase. If we have received the data already we do not
|
||||
// We try to broadcast at any block in the break1 phase. If we have received the data already we do not
|
||||
// broadcast so we do not flood the network.
|
||||
if (periodService.isInPhase(block.getHeight(), DaoPhase.Phase.BREAK1)) {
|
||||
// We only republish if we are completed with parsing old blocks, otherwise we would republish old
|
||||
|
@ -171,7 +171,7 @@ public class ProposalService implements HashMapChangedListener, AppendOnlyDataSt
|
|||
|
||||
@Override
|
||||
public void onParseBlockChainComplete() {
|
||||
// Fill the lists with the data we have collected in out stores.
|
||||
// Fill the lists with the data we have collected in our stores.
|
||||
fillListFromProtectedStore();
|
||||
fillListFromAppendOnlyDataStore();
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class RemoveAssetValidator extends ProposalValidator implements Consensus
|
|||
RemoveAssetProposal removeAssetProposal = (RemoveAssetProposal) proposal;
|
||||
notEmpty(removeAssetProposal.getTickerSymbol(), "TickerSymbol must not be empty");
|
||||
|
||||
// We want to avoid that someone cause damage by inserting a super long string. Real ticker symbols
|
||||
// We want to avoid that someone causes damage by inserting a super long string. Real ticker symbols
|
||||
// are usually very short but we don't want to add additional restrictions here.
|
||||
checkArgument(removeAssetProposal.getTickerSymbol().length() <= 100, "TickerSymbol must not exceed 100 chars");
|
||||
} catch (ProposalValidationException e) {
|
||||
|
|
|
@ -65,7 +65,7 @@ public class VoteResultConsensus {
|
|||
}
|
||||
|
||||
// We compare first by stake and in case we have multiple entries with same stake we use the
|
||||
// hex encoded hashOfProposalList for comparision
|
||||
// hex encoded hashOfProposalList for comparison
|
||||
@Nullable
|
||||
public static byte[] getMajorityHash(List<VoteResultService.HashWithStake> hashWithStakeList)
|
||||
throws VoteResultException.ValidationException, VoteResultException.ConsensusException {
|
||||
|
|
|
@ -93,7 +93,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
|
||||
/**
|
||||
* Calculates the result of the voting at the VoteResult period.
|
||||
* We take all data from the bitcoin domain and additionally the blindVote list which we received from the p2p network.
|
||||
* We take all data from the bitcoin domain and additionally the blindVote list which we received from the p2p network.
|
||||
* Due to eventual consistency we use the hash of the data view of the voters (majority by merit+stake). If our local
|
||||
* blindVote list contains the blindVotes used by the voters we can calculate the result, otherwise we need to request
|
||||
* the missing blindVotes from the network.
|
||||
|
@ -411,7 +411,7 @@ public class VoteResultService implements DaoStateListener, DaoSetupService {
|
|||
if (!missingBallots.isEmpty())
|
||||
throw new VoteResultException.MissingBallotException(ballots, missingBallots);
|
||||
|
||||
// If we received a proposal after we had already voted we consider it as an proposal withhold attack and
|
||||
// If we received a proposal after we had already voted we consider it as a proposal withhold attack and
|
||||
// treat the proposal as it was voted with a rejected vote.
|
||||
ballotByTxIdMap.entrySet().stream()
|
||||
.filter(e -> !voteByTxIdMap.keySet().contains(e.getKey()))
|
||||
|
|
|
@ -165,9 +165,9 @@ public class VoteRevealService implements DaoStateListener, DaoSetupService {
|
|||
// Creation of vote reveal tx is done without user activity!
|
||||
// We create automatically the vote reveal tx when we are in the reveal phase of the current cycle when
|
||||
// the blind vote was created in case we have not done it already.
|
||||
// The voter need to be at least once online in the reveal phase when he has a blind vote created,
|
||||
// The voter needs to be at least once online in the reveal phase when he has a blind vote created,
|
||||
// otherwise his vote becomes invalid.
|
||||
// In case the user miss the vote reveal phase an (invalid) vote reveal tx will be created the next time the user is
|
||||
// In case the user misses the vote reveal phase an (invalid) vote reveal tx will be created the next time the user is
|
||||
// online. That tx only serves the purpose to unlock the stake from the blind vote but it will be ignored for voting.
|
||||
// A blind vote which did not get revealed might still be part of the majority hash calculation as we cannot know
|
||||
// which blind votes might be revealed until the phase is over at the moment when we publish the vote reveal tx.
|
||||
|
@ -203,7 +203,7 @@ public class VoteRevealService implements DaoStateListener, DaoSetupService {
|
|||
// BSQ because the blind vote tx is already in the snapshot and does not get parsed
|
||||
// again. It would require a reset of the snapshot and parse all blocks again.
|
||||
// As this is an exceptional case we prefer to have a simple solution instead and just
|
||||
// publish the vote reveal tx but are aware that is is invalid.
|
||||
// publish the vote reveal tx but are aware that it is invalid.
|
||||
log.warn("We missed the vote reveal phase but publish now the tx to unlock our locked " +
|
||||
"BSQ from the blind vote tx. BlindVoteTxId={}, blockHeight={}",
|
||||
blindVoteTxId, chainHeight);
|
||||
|
|
|
@ -62,7 +62,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
|
||||
/**
|
||||
* Monitors the BlindVote P2P network payloads with using a hash of a sorted list of BlindVotes from one cycle and
|
||||
* make it accessible to the network so we can detect quickly if any consensus issue arise.
|
||||
* make it accessible to the network so we can detect quickly if any consensus issue arises.
|
||||
* We create that hash at the first block of the VoteReveal phase. There is one hash created per cycle.
|
||||
* The hash contains the hash of the previous block so we can ensure the validity of the whole history by
|
||||
* comparing the last block.
|
||||
|
|
|
@ -69,7 +69,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
/**
|
||||
* Monitors the DaoState with using a hash fo the complete daoState and make it accessible to the network
|
||||
* Monitors the DaoState by using a hash for the complete daoState and make it accessible to the network
|
||||
* so we can detect quickly if any consensus issue arise.
|
||||
* We create that hash after parsing and processing of a block is completed. There is one hash created per block.
|
||||
* The hash contains the hash of the previous block so we can ensure the validity of the whole history by
|
||||
|
@ -253,7 +253,7 @@ public class DaoStateMonitoringService implements DaoSetupService, DaoStateListe
|
|||
}
|
||||
|
||||
public void applySnapshot(LinkedList<DaoStateHash> persistedDaoStateHashChain) {
|
||||
// We could got a reset from a reorg, so we clear all and start over from the genesis block.
|
||||
// We could get a reset from a reorg, so we clear all and start over from the genesis block.
|
||||
daoStateHashChain.clear();
|
||||
daoStateBlockChain.clear();
|
||||
daoStateNetworkService.reset();
|
||||
|
|
|
@ -62,7 +62,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
|
||||
/**
|
||||
* Monitors the Proposal P2P network payloads with using a hash of a sorted list of Proposals from one cycle and
|
||||
* make it accessible to the network so we can detect quickly if any consensus issue arise.
|
||||
* make it accessible to the network so we can detect quickly if any consensus issue arises.
|
||||
* We create that hash at the first block of the BlindVote phase. There is one hash created per cycle.
|
||||
* The hash contains the hash of the previous block so we can ensure the validity of the whole history by
|
||||
* comparing the last block.
|
||||
|
|
|
@ -237,7 +237,7 @@ public abstract class BsqNode implements DaoSetupService {
|
|||
// not connecting from the latest height we had. The list is sorted by height
|
||||
if (!pendingBlocks.isEmpty()) {
|
||||
// We take only first element after sorting (so it is the block with the next height) to avoid that
|
||||
// we would repeat calls in recursions in case we would iterate the list.
|
||||
// we would repeat calls in recursions in case we would iterate the list.
|
||||
pendingBlocks.sort(Comparator.comparing(RawBlock::getHeight));
|
||||
RawBlock nextPending = pendingBlocks.get(0);
|
||||
if (nextPending.getHeight() == daoStateService.getChainHeight() + 1)
|
||||
|
@ -247,17 +247,17 @@ public abstract class BsqNode implements DaoSetupService {
|
|||
return Optional.of(block);
|
||||
} catch (BlockHeightNotConnectingException e) {
|
||||
// There is no guaranteed order how we receive blocks. We could have received block 102 before 101.
|
||||
// If block is in future we move the block to teh pendingBlocks list. At next block we look up the
|
||||
// If block is in the future we move the block to the pendingBlocks list. At next block we look up the
|
||||
// list if there is any potential candidate with the correct height and if so we remove that from that list.
|
||||
|
||||
int heightForNextBlock = daoStateService.getChainHeight() + 1;
|
||||
if (rawBlock.getHeight() > heightForNextBlock) {
|
||||
if (!pendingBlocks.contains(rawBlock)) {
|
||||
pendingBlocks.add(rawBlock);
|
||||
log.info("We received an block with a future block height. We store it as pending and try to apply " +
|
||||
log.info("We received a block with a future block height. We store it as pending and try to apply " +
|
||||
"it at the next block. rawBlock: height/hash={}/{}", rawBlock.getHeight(), rawBlock.getHash());
|
||||
} else {
|
||||
log.warn("We received an block with a future block height but we had it already added to our pendingBlocks.");
|
||||
log.warn("We received a block with a future block height but we had it already added to our pendingBlocks.");
|
||||
}
|
||||
} else if (rawBlock.getHeight() >= daoStateService.getGenesisBlockHeight()) {
|
||||
// We received an older block. We compare if we have it in our chain.
|
||||
|
|
|
@ -216,8 +216,8 @@ public class FullNode extends BsqNode {
|
|||
parseBlocksIfNewBlockAvailable(chainHeight);
|
||||
}, this::handleError);
|
||||
} else {
|
||||
log.warn("We are trying to start with a block which is above the chain height of bitcoin core. " +
|
||||
"We need probably wait longer until bitcoin core has fully synced. " +
|
||||
log.warn("We are trying to start with a block which is above the chain height of Bitcoin Core. " +
|
||||
"We need probably wait longer until Bitcoin Core has fully synced. " +
|
||||
"We try again after a delay of 1 min.");
|
||||
UserThread.runAfter(() -> requestChainHeadHeightAndParseBlocks(startBlockHeight), 60);
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ public class RpcService {
|
|||
this.client = client;
|
||||
} catch (BitcoindException | CommunicationException e) {
|
||||
if (e instanceof CommunicationException)
|
||||
log.error("Probably Bitcoin core is not running or the rpc port is not set correctly. rpcPort=" + rpcPort);
|
||||
log.error("Probably Bitcoin Core is not running or the rpc port is not set correctly. rpcPort=" + rpcPort);
|
||||
log.error(e.toString());
|
||||
e.printStackTrace();
|
||||
log.error(e.getCause() != null ? e.getCause().toString() : "e.getCause()=null");
|
||||
|
|
|
@ -44,7 +44,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Accepts a GetBlocksRequest from a lite nodes and send back a corresponding GetBlocksResponse.
|
||||
* Accepts a GetBlocksRequest from a lite node and sends back a corresponding GetBlocksResponse.
|
||||
*/
|
||||
@Slf4j
|
||||
class GetBlocksRequestHandler {
|
||||
|
|
|
@ -113,7 +113,7 @@ public class RequestBlocksHandler implements MessageListener {
|
|||
if (timeoutTimer == null) {
|
||||
timeoutTimer = UserThread.runAfter(() -> { // setup before sending to avoid race conditions
|
||||
if (!stopped) {
|
||||
String errorMessage = "A timeout occurred at sending getBlocksRequest:" + getBlocksRequest +
|
||||
String errorMessage = "A timeout occurred when sending getBlocksRequest:" + getBlocksRequest +
|
||||
" on peersNodeAddress:" + nodeAddress;
|
||||
log.debug(errorMessage + " / RequestDataHandler=" + RequestBlocksHandler.this);
|
||||
handleFault(errorMessage, nodeAddress, CloseConnectionReason.SEND_MSG_TIMEOUT);
|
||||
|
@ -135,7 +135,7 @@ public class RequestBlocksHandler implements MessageListener {
|
|||
log.info("Sending of GetBlocksRequest message to peer {} succeeded.", nodeAddress.getFullAddress());
|
||||
} else {
|
||||
log.trace("We have stopped already. We ignore that networkNode.sendMessage.onSuccess call." +
|
||||
"Might be caused by an previous timeout.");
|
||||
"Might be caused by a previous timeout.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ public class RequestBlocksHandler implements MessageListener {
|
|||
handleFault(errorMessage, nodeAddress, CloseConnectionReason.SEND_MSG_FAILURE);
|
||||
} else {
|
||||
log.trace("We have stopped already. We ignore that networkNode.sendMessage.onFailure call. " +
|
||||
"Might be caused by an previous timeout.");
|
||||
"Might be caused by a previous timeout.");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -39,7 +39,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
|
||||
/**
|
||||
* Parse a rawBlock and creates a block from it with an empty tx list.
|
||||
* Iterates all rawTx and if the tx is a a BSQ tx it gets added to the tx list.
|
||||
* Iterates all rawTx and if the tx is a BSQ tx it gets added to the tx list.
|
||||
*/
|
||||
@Slf4j
|
||||
@Immutable
|
||||
|
@ -101,7 +101,7 @@ public class BlockParser {
|
|||
|
||||
// Worst case is that all txs in a block are depending on another, so only one get resolved at each iteration.
|
||||
// Min tx size is 189 bytes (normally about 240 bytes), 1 MB can contain max. about 5300 txs (usually 2000).
|
||||
// Realistically we don't expect more then a few recursive calls.
|
||||
// Realistically we don't expect more than a few recursive calls.
|
||||
// There are some blocks with testing such dependency chains like block 130768 where at each iteration only
|
||||
// one get resolved.
|
||||
// Lately there is a patter with 24 iterations observed
|
||||
|
|
|
@ -32,7 +32,7 @@ import lombok.Data;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Used only only temporary during the transaction parsing process to support mutable data while parsing.
|
||||
* Used only temporary during the transaction parsing process to support mutable data while parsing.
|
||||
* After parsing it will get cloned to the immutable Tx.
|
||||
* We don't need to implement the ProtoBuffer methods as it is not persisted or sent over the wire.
|
||||
*/
|
||||
|
|
|
@ -46,10 +46,10 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
* happen again.
|
||||
* Further (highly unlikely) consequences could be:
|
||||
* If the BSQ output would be sent to a BSQ address the old client would accept that even it is
|
||||
* invalid according to the new rules. But sending such a output would require a manually crafted tx
|
||||
* invalid according to the new rules. But sending such an output would require a manually crafted tx
|
||||
* (not possible in the UI). Worst case a not updated user would buy invalid BSQ but that is not possible as we
|
||||
* enforce update to 1.2.0 for trading a few days after release as that release introduced the new trade protocol
|
||||
* and protection tool. Only of both both traders would have deactivated filter messages they could trade.
|
||||
* and protection tool. Only if both traders would have deactivated filter messages they could trade.
|
||||
*
|
||||
* Problem description:
|
||||
* We did not apply the check to not allow BSQ outputs after we had detected a BTC output.
|
||||
|
@ -63,7 +63,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
* The BSQ was sitting in the BTC wallet so not even visible as BSQ to the user.
|
||||
* If the user would have crafted a custom BSQ tx he could have avoided that the full trade fee was burned.
|
||||
*
|
||||
* Not an universal rule:
|
||||
* Not a universal rule:
|
||||
* We cannot enforce the rule that no BSQ output is permitted to all possible transactions because there can be cases
|
||||
* where we need to permit this case.
|
||||
* For instance in case we confiscate a lockupTx we have usually 2 BSQ outputs: The first one is the bond which
|
||||
|
@ -191,7 +191,7 @@ class TxOutputParser {
|
|||
availableInputValue -= tempTxOutput.getValue();
|
||||
|
||||
// We must not set prohibitMoreBsqOutputs at confiscation transactions as optional
|
||||
// BSQ change output (output 2) must not be confiscated.
|
||||
// BSQ change output (output 2) must not be confiscated.
|
||||
tempTxOutput.setTxOutputType(TxOutputType.BTC_OUTPUT);
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ class TxOutputParser {
|
|||
/**
|
||||
* Whether a transaction is a valid unlock bond transaction or not.
|
||||
*
|
||||
* @param txOutputValue The value of the current output, in satoshi.
|
||||
* @param txOutputValue The value of the current output, in satoshis.
|
||||
* @param index The index of the output.
|
||||
* @return True if the transaction is an unlock transaction, false otherwise.
|
||||
*/
|
||||
|
@ -302,8 +302,8 @@ class TxOutputParser {
|
|||
|
||||
// We need to require one BSQ change output as we could otherwise not be able to distinguish between 2
|
||||
// structurally same transactions where only the BSQ fee is different. In case of asset listing fee and proof of
|
||||
// burn it is a user input, so it is not know to the parser, instead we derive the burned fee from the parser.
|
||||
// In case of proposal fee we could derive it from the params.
|
||||
// burn it is a user input, so it is not known to the parser, instead we derive the burned fee from the parser.
|
||||
// In case of proposal fee we could derive it from the params.
|
||||
|
||||
// Case 1: 10 BSQ fee to burn
|
||||
// In: 17 BSQ
|
||||
|
@ -336,7 +336,7 @@ class TxOutputParser {
|
|||
// We do not permit more BSQ outputs after the issuance candidate.
|
||||
prohibitMoreBsqOutputs = true;
|
||||
|
||||
// We store the candidate but we don't apply the TxOutputType yet as we need to verify the fee after all
|
||||
// We store the candidate but we don't apply the TxOutputType yet as we need to verify the fee after all
|
||||
// outputs are parsed and check the phase. The TxParser will do that....
|
||||
optionalIssuanceCandidate = Optional.of(tempTxOutput);
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ class TxOutputParser {
|
|||
prohibitMoreBsqOutputs = true;
|
||||
} else {
|
||||
// If we have BSQ left as fee and we are at the second output it might be a compensation request output.
|
||||
// We store the candidate but we don't apply the TxOutputType yet as we need to verify the fee after all
|
||||
// We store the candidate but we don't apply the TxOutputType yet as we need to verify the fee after all
|
||||
// outputs are parsed and check the phase. The TxParser will do that....
|
||||
if (availableInputValue > 0 &&
|
||||
index == 1 &&
|
||||
|
|
|
@ -265,7 +265,7 @@ public class TxParser {
|
|||
} else {
|
||||
log.warn("It can be that we have a opReturn which is correct from its structure but the whole tx " +
|
||||
"in not valid as the issuanceCandidate in not there. " +
|
||||
"As the BSQ fee is set it must be either a buggy tx or an manually crafted invalid tx.");
|
||||
"As the BSQ fee is set it must be either a buggy tx or a manually crafted invalid tx.");
|
||||
// Even though the request part if invalid the BSQ transfer and change output should still be valid
|
||||
// as long as the BSQ change <= BSQ inputs.
|
||||
// We tolerate such an incorrect tx and do not burn the BSQ
|
||||
|
@ -373,7 +373,7 @@ public class TxParser {
|
|||
*
|
||||
* @param tempTx The temporary transaction.
|
||||
* @param optionalOpReturnType The optional OP_RETURN type of the transaction.
|
||||
* @param hasBurntBSQ If the have been remaining value from the inputs which got not spent in outputs.
|
||||
* @param hasBurntBSQ If there have been remaining value from the inputs which got not spent in outputs.
|
||||
* Might be valid BSQ fees or burned BSQ from an invalid tx.
|
||||
* @return The type of the transaction, if it is relevant to bisq.
|
||||
*/
|
||||
|
|
|
@ -238,7 +238,7 @@ public class DaoStateService implements DaoSetupService {
|
|||
daoStateListeners.forEach(l -> l.onParseBlockComplete(block));
|
||||
|
||||
// We use 2 different handlers as we don't want to update domain listeners during batch processing of all
|
||||
// blocks as that cause performance issues. In earlier versions when we updated at each block it took
|
||||
// blocks as that causes performance issues. In earlier versions when we updated at each block it took
|
||||
// 50 sec. for 4000 blocks, after that change it was about 4 sec.
|
||||
// Clients
|
||||
if (parseBlockChainComplete)
|
||||
|
@ -652,7 +652,7 @@ public class DaoStateService implements DaoSetupService {
|
|||
// Unlocking - UNLOCK txOutputs that are not yet spendable due to lock time
|
||||
// Unlocked - UNLOCK txOutputs that are spendable since the lock time has passed
|
||||
// LockTime - 0 means that the funds are spendable at the same block of the UNLOCK tx. For the user that is not
|
||||
// supported as we do not expose unconfirmed BSQ txs so lockTime of 1 is the smallest the use can actually use.
|
||||
// supported as we do not expose unconfirmed BSQ txs so lockTime of 1 is the smallest the user can actually use.
|
||||
|
||||
// LockTime
|
||||
public Optional<Integer> getLockTime(String txId) {
|
||||
|
@ -850,7 +850,7 @@ public class DaoStateService implements DaoSetupService {
|
|||
doConfiscateBond(lockupTxId);
|
||||
} else {
|
||||
// We could be more radical here and confiscate the output if it is unspent but lock time is over,
|
||||
// but its probably better to stick to the rules that confiscation can only happen before lock time
|
||||
// but it's probably better to stick to the rules that confiscation can only happen before lock time
|
||||
// is over.
|
||||
log.warn("We could not confiscate the bond because the unlock tx was already spent or lock time " +
|
||||
"has exceeded. unlockTxId={}", unlockTxId);
|
||||
|
|
|
@ -42,7 +42,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
*/
|
||||
@Slf4j
|
||||
public class DaoStateStorageService extends StoreService<DaoStateStore> {
|
||||
// We needed to rename teh db file as we have a new file structure with the hashChain feature and need to enforce the
|
||||
// We needed to rename the db file as we have a new file structure with the hashChain feature and need to enforce the
|
||||
// new file to be used.
|
||||
// We can rename to DaoStateStore before mainnet launch again.
|
||||
// Another update due to some data field changes which would cause diff. hashes, so to enforce users to get the new
|
||||
|
|
|
@ -220,7 +220,7 @@ public class DaoState implements PersistablePayload {
|
|||
// earlier blocks is included in the hash. The past blocks cannot be changed anyway when a new block arrives.
|
||||
// Reorgs are handled by rebuilding the hash chain from last snapshot.
|
||||
// Using the full blocks list becomes quite heavy. 7000 blocks are
|
||||
// about 1.4 MB and creating the hash takes 30 sec. With using just the last block we reduce the time to 7 sec.
|
||||
// about 1.4 MB and creating the hash takes 30 sec. By using just the last block we reduce the time to 7 sec.
|
||||
return getBsqStateBuilderExcludingBlocks().addBlocks(getBlocks().getLast().toProtoMessage()).build().toByteArray();
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public abstract class BaseTxOutput implements ImmutableDaoStateModel {
|
|||
protected final String txId;
|
||||
|
||||
// Before v0.9.6 it was only set if dumpBlockchainData was set to true but we changed that with 0.9.6
|
||||
// so that is is always set. We still need to support it because of backward compatibility.
|
||||
// so that it is always set. We still need to support it because of backward compatibility.
|
||||
@Nullable
|
||||
protected final PubKeyScript pubKeyScript; // Has about 50 bytes, total size of TxOutput is about 300 bytes.
|
||||
@Nullable
|
||||
|
|
|
@ -44,7 +44,7 @@ public enum TxType implements ImmutableDaoStateModel {
|
|||
UNLOCK(true, false),
|
||||
ASSET_LISTING_FEE(true, true),
|
||||
PROOF_OF_BURN(true, true),
|
||||
IRREGULAR(false, false); // the params are here irrelevant as we can have any tx which violated the rules set to irregular
|
||||
IRREGULAR(false, false); // the params are irrelevant here as we can have any tx that violated the rules set to irregular
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -34,7 +34,7 @@ import lombok.Getter;
|
|||
* the PB serialisation so changes for those would not change the hash for the dao state hash chain.
|
||||
* As the data is not used in consensus critical code yet changing fields can be tolerated.
|
||||
* For mediators and arbitrators we will use automated verification of the bond so there might be issues when we change
|
||||
* the values. So lets avoid changing anything here beside adding new entries.
|
||||
* the values. So let's avoid changing anything here beside adding new entries.
|
||||
*
|
||||
*/
|
||||
public enum BondedRoleType {
|
||||
|
@ -87,7 +87,7 @@ public enum BondedRoleType {
|
|||
/**
|
||||
* @param requiredBondUnit // requiredBondUnit for lockup tx (will be multiplied with PARAM.BONDED_ROLE_FACTOR for BSQ value)
|
||||
* @param unlockTimeInDays // unlockTime in days
|
||||
* @param link // Link to Github for role description
|
||||
* @param link // Link to GitHub for role description
|
||||
* @param allowMultipleHolders // If role can be held by multiple persons (e.g. seed nodes vs. domain name)
|
||||
*/
|
||||
BondedRoleType(long requiredBondUnit, int unlockTimeInDays, String link, boolean allowMultipleHolders) {
|
||||
|
|
|
@ -40,7 +40,7 @@ public class DaoPhase implements PersistablePayload, ImmutableDaoStateModel {
|
|||
/**
|
||||
* Enum for phase of a cycle.
|
||||
*
|
||||
* We don't want to use a enum with the duration as field because the duration can change by voting and enums
|
||||
* We don't want to use an enum with the duration as field because the duration can change by voting and enums
|
||||
* should be considered immutable.
|
||||
*/
|
||||
@Immutable
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class Role implements PersistablePayload, NetworkPayload, BondedAss
|
|||
|
||||
/**
|
||||
* @param name Full name or nickname
|
||||
* @param link Github account or forum account of user
|
||||
* @param link GitHub account or forum account of user
|
||||
* @param bondedRoleType BondedRoleType
|
||||
*/
|
||||
public Role(String name,
|
||||
|
|
|
@ -69,7 +69,7 @@ public class UnconfirmedBsqChangeOutputListService implements PersistedDataHost
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Once a tx gets committed to out BSQ wallet we store the change output for allowing it to be spent in follow-up
|
||||
* Once a tx gets committed to our BSQ wallet we store the change output for allowing it to be spent in follow-up
|
||||
* transactions.
|
||||
*/
|
||||
public void onCommitTx(Transaction tx, TxType txType, Wallet wallet) {
|
||||
|
@ -84,7 +84,7 @@ public class UnconfirmedBsqChangeOutputListService implements PersistedDataHost
|
|||
case GENESIS:
|
||||
return;
|
||||
case TRANSFER_BSQ:
|
||||
changeOutputIndex = 1; // output 0 is receivers address
|
||||
changeOutputIndex = 1; // output 0 is receiver's address
|
||||
break;
|
||||
case PAY_TRADE_FEE:
|
||||
changeOutputIndex = 0;
|
||||
|
@ -124,7 +124,7 @@ public class UnconfirmedBsqChangeOutputListService implements PersistedDataHost
|
|||
// It can be that we don't have a BSQ and a BTC change output.
|
||||
// If no BSQ change but a BTC change the index points to the BTC output and then
|
||||
// we detect that it is not part of our wallet.
|
||||
// If there is a BSQ change but no BTC change it has not effect as we ignore BTC outputs anyway.
|
||||
// If there is a BSQ change but no BTC change it has no effect as we ignore BTC outputs anyway.
|
||||
// If both change outputs do not exist then we might point to an index outside
|
||||
// of the list and we return at our scope check.
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ import javax.annotation.concurrent.Immutable;
|
|||
|
||||
/**
|
||||
* Used for tracking unconfirmed change outputs to allow them to be spent in follow up
|
||||
* transactions in txType permits it. We can assume the the user is not intending to
|
||||
* double spend own transactions as well that he does not try to spend a invalid BSQ
|
||||
* transactions in txType permits it. We can assume that the user is not intending to
|
||||
* double spend own transactions as well that he does not try to spend an invalid BSQ
|
||||
* output to a BSQ address.
|
||||
* We do not allow spending unconfirmed BSQ outputs received from elsewhere.
|
||||
*/
|
||||
|
|
|
@ -182,8 +182,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
|||
|
||||
@Override
|
||||
public protobuf.StoragePayload toProtoMessage() {
|
||||
checkNotNull(signatureAsBase64, "signatureAsBase64 must nto be null");
|
||||
checkNotNull(ownerPubKeyBytes, "ownerPubKeyBytes must nto be null");
|
||||
checkNotNull(signatureAsBase64, "signatureAsBase64 must not be null");
|
||||
checkNotNull(ownerPubKeyBytes, "ownerPubKeyBytes must not be null");
|
||||
List<protobuf.PaymentAccountFilter> paymentAccountFilterList = bannedPaymentAccounts.stream()
|
||||
.map(PaymentAccountFilter::toProtoMessage)
|
||||
.collect(Collectors.toList());
|
||||
|
|
|
@ -169,7 +169,7 @@ public class FilterManager {
|
|||
|
||||
@Override
|
||||
public void onUpdatedDataReceived() {
|
||||
// We should have received all data at that point and if the filers was not set we
|
||||
// We should have received all data at that point and if the filers were not set we
|
||||
// clean up as it might be that we missed the filter remove message if we have not been online.
|
||||
UserThread.runAfter(() -> {
|
||||
if (filterProperty.get() == null)
|
||||
|
@ -308,7 +308,7 @@ public class FilterManager {
|
|||
}
|
||||
}
|
||||
|
||||
// We dont use full data from Filter as we are only interested in the filter data not the sig and keys
|
||||
// We don't use full data from Filter as we are only interested in the filter data not the sig and keys
|
||||
private String getHexFromData(Filter filter) {
|
||||
protobuf.Filter.Builder builder = protobuf.Filter.newBuilder()
|
||||
.addAllBannedOfferIds(filter.getBannedOfferIds())
|
||||
|
|
|
@ -31,7 +31,7 @@ public class BankUtil {
|
|||
// BankName
|
||||
@SuppressWarnings("SameReturnValue")
|
||||
public static boolean isBankNameRequired(String countryCode) {
|
||||
// Currently we always return true but lets keep that method to be more flexible in case we what to not show
|
||||
// Currently we always return true but let's keep that method to be more flexible in case we what to not show
|
||||
// it at some new payment method.
|
||||
return true;
|
||||
/*
|
||||
|
@ -89,7 +89,7 @@ public class BankUtil {
|
|||
public static String getBankIdLabel(String countryCode) {
|
||||
switch (countryCode) {
|
||||
case "CA":
|
||||
return "Institution Number";// do not translate as it is used in english only
|
||||
return "Institution Number";// do not translate as it is used in English only
|
||||
case "MX":
|
||||
case "HK":
|
||||
return Res.get("payment.bankCode");
|
||||
|
@ -122,15 +122,15 @@ public class BankUtil {
|
|||
public static String getBranchIdLabel(String countryCode) {
|
||||
switch (countryCode) {
|
||||
case "GB":
|
||||
return "UK sort code"; // do not translate as it is used in english only
|
||||
return "UK sort code"; // do not translate as it is used in English only
|
||||
case "US":
|
||||
return "Routing Number"; // do not translate as it is used in english only
|
||||
return "Routing Number"; // do not translate as it is used in English only
|
||||
case "BR":
|
||||
return "Código da Agência"; // do not translate as it is used in portuguese only
|
||||
return "Código da Agência"; // do not translate as it is used in Portuguese only
|
||||
case "AU":
|
||||
return "BSB code"; // do not translate as it is used in english only
|
||||
return "BSB code"; // do not translate as it is used in English only
|
||||
case "CA":
|
||||
return "Transit Number"; // do not translate as it is used in english only
|
||||
return "Transit Number"; // do not translate as it is used in English only
|
||||
default:
|
||||
return isBranchIdRequired(countryCode) ? Res.get("payment.branchNr") : Res.get("payment.branchNrOptional");
|
||||
}
|
||||
|
@ -157,15 +157,15 @@ public class BankUtil {
|
|||
case "HK":
|
||||
return Res.get("payment.accountNr");
|
||||
case "NO":
|
||||
return "Kontonummer"; // do not translate as it is used in norwegian only
|
||||
return "Kontonummer"; // do not translate as it is used in Norwegian only
|
||||
case "SE":
|
||||
return "Bankgiro number"; // do not translate as it is used in swedish only
|
||||
return "Bankgiro number"; // do not translate as it is used in Swedish only
|
||||
case "MX":
|
||||
return "CLABE"; // do not translate as it is used in spanish only
|
||||
return "CLABE"; // do not translate as it is used in Spanish only
|
||||
case "CL":
|
||||
return "Cuenta"; // do not translate as it is used in spanish only
|
||||
return "Cuenta"; // do not translate as it is used in Spanish only
|
||||
case "AR":
|
||||
return "Número de cuenta"; // do not translate as it is used in spanish only
|
||||
return "Número de cuenta"; // do not translate as it is used in Spanish only
|
||||
default:
|
||||
return Res.get("payment.accountNrLabel");
|
||||
}
|
||||
|
@ -221,11 +221,11 @@ public class BankUtil {
|
|||
public static String getHolderIdLabel(String countryCode) {
|
||||
switch (countryCode) {
|
||||
case "BR":
|
||||
return "Cadastro de Pessoas Físicas (CPF)"; // do not translate as it is used in portuguese only
|
||||
return "Cadastro de Pessoas Físicas (CPF)"; // do not translate as it is used in Portuguese only
|
||||
case "CL":
|
||||
return "Rol Único Tributario (RUT)"; // do not translate as it is used in spanish only
|
||||
return "Rol Único Tributario (RUT)"; // do not translate as it is used in Spanish only
|
||||
case "AR":
|
||||
return "CUIL/CUIT"; // do not translate as it is used in spanish only
|
||||
return "CUIL/CUIT"; // do not translate as it is used in Spanish only
|
||||
default:
|
||||
return Res.get("payment.personalId");
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class CurrencyTuple {
|
|||
public final int precision; // precision 4 is 1/10000 -> 0.0001 is smallest unit
|
||||
|
||||
public CurrencyTuple(String code, String name) {
|
||||
// We use Fiat class and there precision is 4
|
||||
// We use Fiat class and the precision is 4
|
||||
// In future we might add custom precision per currency
|
||||
this(code, name, 4);
|
||||
}
|
||||
|
|
|
@ -332,7 +332,7 @@ public class CurrencyUtil {
|
|||
*
|
||||
* As we use a boolean result for isCryptoCurrency and isFiatCurrency we do not treat missing currencies correctly.
|
||||
* To throw an exception might be an option but that will require quite a lot of code change, so we don't do that
|
||||
* for the moment, but could be considered for the future. Another maybe better option is to introduce a enum which
|
||||
* for the moment, but could be considered for the future. Another maybe better option is to introduce an enum which
|
||||
* contains 3 entries (CryptoCurrency, Fiat, Undefined).
|
||||
*/
|
||||
public static boolean isCryptoCurrency(String currencyCode) {
|
||||
|
@ -483,7 +483,7 @@ public class CurrencyUtil {
|
|||
return optionalAsset;
|
||||
}
|
||||
|
||||
// If we are in mainnet we need have a mainet asset defined.
|
||||
// If we are in mainnet we need have a mainnet asset defined.
|
||||
throw new IllegalArgumentException("We are on mainnet and we could not find an asset with network type mainnet");
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public class GlobalSettings {
|
|||
static {
|
||||
locale = Locale.getDefault();
|
||||
|
||||
// On some systems there is not country defined, in that case we use en_US
|
||||
// On some systems there is no country defined, in that case we use en_US
|
||||
if (locale.getCountry() == null || locale.getCountry().isEmpty())
|
||||
locale = Locale.US;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ class UTF8Control extends ResourceBundle.Control {
|
|||
|
||||
public ResourceBundle newBundle(String baseName, @NotNull Locale locale, @NotNull String format, ClassLoader loader, boolean reload)
|
||||
throws IllegalAccessException, InstantiationException, IOException {
|
||||
// The below is a copy of the default implementation.
|
||||
// Below is a copy of the default implementation.
|
||||
final String bundleName = toBundleName(baseName, locale);
|
||||
final String resourceName = toResourceName(bundleName, "properties");
|
||||
ResourceBundle bundle = null;
|
||||
|
@ -152,7 +152,7 @@ class UTF8Control extends ResourceBundle.Control {
|
|||
}
|
||||
if (stream != null) {
|
||||
try {
|
||||
// Only this line is changed to make it to read properties files as UTF-8.
|
||||
// Only this line is changed to make it read properties files as UTF-8.
|
||||
bundle = new PropertyResourceBundle(new InputStreamReader(stream, "UTF-8"));
|
||||
} finally {
|
||||
stream.close();
|
||||
|
|
|
@ -55,7 +55,7 @@ public class AltcoinExchangeRate {
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert a coin amount to a altcoin amount using this exchange rate.
|
||||
* Convert a coin amount to an altcoin amount using this exchange rate.
|
||||
*
|
||||
* @throws ArithmeticException if the converted altcoin amount is too high or too low.
|
||||
*/
|
||||
|
|
|
@ -132,7 +132,7 @@ public class MobileModel {
|
|||
iPad Pro 10.5 Inch
|
||||
*/
|
||||
// iPhone 6 does not support isContentAvailable, iPhone 6s and 7 does.
|
||||
// We don't know for other versions, but lets assume all above iPhone 6 are ok.
|
||||
// We don't know about other versions, but let's assume all above iPhone 6 are ok.
|
||||
if (descriptor != null) {
|
||||
String[] descriptorTokens = descriptor.split(" ");
|
||||
if (descriptorTokens.length >= 1) {
|
||||
|
|
|
@ -77,7 +77,7 @@ public class PriceAlert {
|
|||
try {
|
||||
mobileNotificationService.sendMessage(message);
|
||||
|
||||
// If we got triggered an alert we remove the filter.
|
||||
// If an alert got triggered we remove the filter.
|
||||
user.removePriceAlertFilter();
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString());
|
||||
|
|
|
@ -241,7 +241,7 @@ public class OfferBookService {
|
|||
offer.getOfferFeePaymentTxId()
|
||||
);
|
||||
} catch (Throwable t) {
|
||||
// In case a offer was corrupted with null values we ignore it
|
||||
// In case an offer was corrupted with null values we ignore it
|
||||
return null;
|
||||
}
|
||||
})
|
||||
|
|
|
@ -147,13 +147,13 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
|
|||
// Close offer when certain price is reached
|
||||
private final boolean useAutoClose;
|
||||
// If useReOpenAfterAutoClose=true we re-open a new offer with the remaining funds if the trade amount
|
||||
// was less then the offer's max. trade amount.
|
||||
// was less than the offer's max. trade amount.
|
||||
private final boolean useReOpenAfterAutoClose;
|
||||
// Used when useAutoClose is set for canceling the offer when lowerClosePrice is triggered
|
||||
private final long lowerClosePrice;
|
||||
// Used when useAutoClose is set for canceling the offer when upperClosePrice is triggered
|
||||
private final long upperClosePrice;
|
||||
// Reserved for possible future use to support private trades where the taker need to have an accessKey
|
||||
// Reserved for possible future use to support private trades where the taker needs to have an accessKey
|
||||
private final boolean isPrivateOffer;
|
||||
@Nullable
|
||||
private final String hashOfChallenge;
|
||||
|
|
|
@ -206,7 +206,7 @@ public class OfferUtil {
|
|||
* {@code price} and {@code maxTradeLimit} and {@code factor}.
|
||||
*
|
||||
* @param amount Bitcoin amount which is a candidate for getting rounded.
|
||||
* @param price Price used in relation ot that amount.
|
||||
* @param price Price used in relation to that amount.
|
||||
* @param maxTradeLimit The max. trade limit of the users account, in satoshis.
|
||||
* @return The adjusted amount
|
||||
*/
|
||||
|
@ -223,7 +223,7 @@ public class OfferUtil {
|
|||
* {@code price} and {@code maxTradeLimit} and {@code factor}.
|
||||
*
|
||||
* @param amount Bitcoin amount which is a candidate for getting rounded.
|
||||
* @param price Price used in relation ot that amount.
|
||||
* @param price Price used in relation to that amount.
|
||||
* @param maxTradeLimit The max. trade limit of the users account, in satoshis.
|
||||
* @param factor The factor used for rounding. E.g. 1 means rounded to units of
|
||||
* 1 EUR, 10 means rounded to 10 EUR, etc.
|
||||
|
@ -233,7 +233,7 @@ public class OfferUtil {
|
|||
static Coin getAdjustedAmount(Coin amount, Price price, long maxTradeLimit, int factor) {
|
||||
checkArgument(
|
||||
amount.getValue() >= 10_000,
|
||||
"amount needs to be above minimum of 10k satoshi"
|
||||
"amount needs to be above minimum of 10k satoshis"
|
||||
);
|
||||
checkArgument(
|
||||
factor > 0,
|
||||
|
@ -251,7 +251,7 @@ public class OfferUtil {
|
|||
// We use 10 000 satoshi as min allowed amount
|
||||
checkArgument(
|
||||
minTradeAmount >= 10_000,
|
||||
"MinTradeAmount must be at least 10k satoshi"
|
||||
"MinTradeAmount must be at least 10k satoshis"
|
||||
);
|
||||
smallestUnitForAmount = Coin.valueOf(Math.max(minTradeAmount, smallestUnitForAmount.value));
|
||||
// We don't allow smaller amount values than smallestUnitForAmount
|
||||
|
|
|
@ -290,10 +290,10 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
// We republish after a bit as it might be that our connected node still has the offer in the data map
|
||||
// but other peers have it already removed because of expired TTL.
|
||||
// Those other not directly connected peers would not get the broadcast of the new offer, as the first
|
||||
// connected peer (seed node) does nto broadcast if it has the data in the map.
|
||||
// connected peer (seed node) does not broadcast if it has the data in the map.
|
||||
// To update quickly to the whole network we repeat the republishOffers call after a few seconds when we
|
||||
// are better connected to the network. There is no guarantee that all peers will receive it but we have
|
||||
// also our periodic timer, so after that longer interval the offer should be available to all peers.
|
||||
// are better connected to the network. There is no guarantee that all peers will receive it but we also
|
||||
// have our periodic timer, so after that longer interval the offer should be available to all peers.
|
||||
if (retryRepublishOffersTimer == null)
|
||||
retryRepublishOffersTimer = UserThread.runAfter(OpenOfferManager.this::republishOffers,
|
||||
REPUBLISH_AGAIN_AT_STARTUP_DELAY_SEC);
|
||||
|
@ -847,8 +847,8 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
offerBookService.addOffer(openOffer.getOffer(),
|
||||
() -> {
|
||||
if (!stopped) {
|
||||
log.debug("Successful added offer to P2P network");
|
||||
// Refresh means we send only the dat needed to refresh the TTL (hash, signature and sequence no.)
|
||||
log.debug("Successfully added offer to P2P network.");
|
||||
// Refresh means we send only the data needed to refresh the TTL (hash, signature and sequence no.)
|
||||
if (periodicRefreshOffersTimer == null)
|
||||
startPeriodicRefreshOffersTimer();
|
||||
} else {
|
||||
|
@ -857,7 +857,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
},
|
||||
errorMessage -> {
|
||||
if (!stopped) {
|
||||
log.error("Add offer to P2P network failed. " + errorMessage);
|
||||
log.error("Adding offer to P2P network failed. " + errorMessage);
|
||||
stopRetryRepublishOffersTimer();
|
||||
retryRepublishOffersTimer = UserThread.runAfter(OpenOfferManager.this::republishOffers,
|
||||
RETRY_REPUBLISH_DELAY_SEC);
|
||||
|
|
|
@ -32,7 +32,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
// We add here the SupportedCapabilitiesMessage interface as that message always predates a direct connection
|
||||
// Here we add the SupportedCapabilitiesMessage interface as that message always predates a direct connection
|
||||
// to the trading peer
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Value
|
||||
|
|
|
@ -34,7 +34,7 @@ import javax.annotation.Nullable;
|
|||
public abstract class OfferMessage extends NetworkEnvelope implements DirectMessage, UidMessage {
|
||||
public final String offerId;
|
||||
|
||||
// Added at version 0.7.1. Can be null if we receive the msg from an peer with an older version
|
||||
// Added in version 0.7.1. Can be null if we receive the msg from a peer with an older version
|
||||
@Nullable
|
||||
protected final String uid;
|
||||
|
||||
|
|
|
@ -70,11 +70,11 @@ public class ValidateOffer extends Task<PlaceOfferModel> {
|
|||
"sellerSecurityDeposit must be equal to ProposalConsensus.SELLER_SECURITY_DEPOSIT. " +
|
||||
"sellerSecurityDeposit=" + offer.getSellerSecurityDeposit().toFriendlyString());*/
|
||||
/*checkArgument(offer.getMinAmount().compareTo(ProposalConsensus.getMinTradeAmount()) >= 0,
|
||||
"MinAmount is less then " + ProposalConsensus.getMinTradeAmount().toFriendlyString());*/
|
||||
"MinAmount is less than " + ProposalConsensus.getMinTradeAmount().toFriendlyString());*/
|
||||
|
||||
checkArgument(offer.getAmount().compareTo(offer.getPaymentMethod().getMaxTradeLimitAsCoin(offer.getCurrencyCode())) <= 0,
|
||||
"Amount is larger then " + offer.getPaymentMethod().getMaxTradeLimitAsCoin(offer.getCurrencyCode()).toFriendlyString());
|
||||
checkArgument(offer.getAmount().compareTo(offer.getMinAmount()) >= 0, "MinAmount is larger then Amount");
|
||||
"Amount is larger than " + offer.getPaymentMethod().getMaxTradeLimitAsCoin(offer.getCurrencyCode()).toFriendlyString());
|
||||
checkArgument(offer.getAmount().compareTo(offer.getMinAmount()) >= 0, "MinAmount is larger than Amount");
|
||||
|
||||
checkNotNull(offer.getPrice(), "Price is null");
|
||||
checkArgument(offer.getPrice().isPositive(),
|
||||
|
|
|
@ -71,7 +71,7 @@ public class PaymentAccountUtil {
|
|||
|
||||
// TODO might be used to show more details if we get payment methods updates with diff. limits
|
||||
public static String getInfoForMismatchingPaymentMethodLimits(Offer offer, PaymentAccount paymentAccount) {
|
||||
// dont translate atm as it is not used so far in the UI just for logs
|
||||
// don't translate atm as it is not used so far in the UI just for logs
|
||||
return "Payment methods have different trade limits or trade periods.\n" +
|
||||
"Our local Payment method: " + paymentAccount.getPaymentMethod().toString() + "\n" +
|
||||
"Payment method from offer: " + offer.getPaymentMethod().toString();
|
||||
|
|
|
@ -83,7 +83,7 @@ public class TradeLimits {
|
|||
return getFirstMonthRiskBasedTradeLimit(maxLimit, riskFactor) * 4;
|
||||
}
|
||||
|
||||
// The first month we allow only 0.25% of he trade limit. We want to ensure that precision is <=4 otherwise we round.
|
||||
// The first month we allow only 0.25% of the trade limit. We want to ensure that precision is <=4 otherwise we round.
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -96,7 +96,7 @@ public class TradeLimits {
|
|||
// The first month we use 1/4 of the max limit. We multiply with riskFactor, so 1/ (4 * 8) is smallest limit in
|
||||
// first month of a maxTradeLimitHighRisk method
|
||||
long smallestLimit = maxLimit / (4 * riskFactor); // e.g. 100000000 / 32 = 3125000
|
||||
// We want to avoid more then 4 decimal places (100000000 / 32 = 3125000 or 1 BTC / 32 = 0.03125 BTC).
|
||||
// We want to avoid more than 4 decimal places (100000000 / 32 = 3125000 or 1 BTC / 32 = 0.03125 BTC).
|
||||
// We want rounding to 0.0313 BTC
|
||||
double decimalForm = MathUtils.scaleDownByPowerOf10((double) smallestLimit, 8);
|
||||
double rounded = MathUtils.roundDouble(decimalForm, 4);
|
||||
|
|
|
@ -20,7 +20,7 @@ package bisq.core.support;
|
|||
import bisq.common.proto.ProtoUtil;
|
||||
|
||||
public enum SupportType {
|
||||
ARBITRATION, // Need to be at index 0 to be the fall back for old clients
|
||||
ARBITRATION, // Need to be at index 0 to be the fallback for old clients
|
||||
MEDIATION,
|
||||
TRADE,
|
||||
REFUND;
|
||||
|
|
|
@ -145,7 +145,7 @@ public abstract class DisputeManager<T extends DisputeList<? extends DisputeList
|
|||
if (dispute.getChatMessages().stream().noneMatch(m -> m.getUid().equals(message.getUid()))) {
|
||||
dispute.addAndPersistChatMessage(message);
|
||||
} else {
|
||||
log.warn("We got a chatMessage what we have already stored. UId = {} TradeId = {}",
|
||||
log.warn("We got a chatMessage that we have already stored. UId = {} TradeId = {}",
|
||||
message.getUid(), message.getTradeId());
|
||||
}
|
||||
});
|
||||
|
|
|
@ -110,7 +110,7 @@ public abstract class DisputeAgentService<T extends DisputeAgent> {
|
|||
if (!map.containsKey(disputeAgentNodeAddress))
|
||||
map.put(disputeAgentNodeAddress, disputeAgent);
|
||||
else
|
||||
log.warn("disputeAgentAddress already exist in disputeAgent map. Seems an disputeAgent object is already registered with the same address.");
|
||||
log.warn("disputeAgentAddress already exists in disputeAgent map. Seems a disputeAgent object is already registered with the same address.");
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
|
|||
dispute.setIsClosed(true);
|
||||
|
||||
if (dispute.disputeResultProperty().get() != null) {
|
||||
log.warn("We got already a dispute result. That should only happen if a dispute needs to be closed " +
|
||||
log.warn("We already got a dispute result. That should only happen if a dispute needs to be closed " +
|
||||
"again because the first close did not succeed. TradeId = " + tradeId);
|
||||
}
|
||||
|
||||
|
@ -288,7 +288,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
|
|||
success = false;
|
||||
}
|
||||
} else {
|
||||
log.warn("We got already a payout tx. That might be the case if the other peer did not get the " +
|
||||
log.warn("We already got a payout tx. That might be the case if the other peer did not get the " +
|
||||
"payout tx and opened a dispute. TradeId = " + tradeId);
|
||||
dispute.setDisputePayoutTxId(payoutTx.getHashAsString());
|
||||
sendPeerPublishedPayoutTxMessage(payoutTx, dispute, contract);
|
||||
|
|
|
@ -122,7 +122,7 @@ public class TraderChatManager extends SupportManager {
|
|||
}
|
||||
trade.addAndPersistChatMessage(message);
|
||||
} else {
|
||||
log.warn("Trade got a chatMessage what we have already stored. UId = {} TradeId = {}",
|
||||
log.warn("Trade got a chatMessage that we have already stored. UId = {} TradeId = {}",
|
||||
message.getUid(), message.getTradeId());
|
||||
}
|
||||
});
|
||||
|
|
|
@ -685,9 +685,9 @@ public abstract class Trade implements Tradable, Model {
|
|||
return delayedPayoutTx;
|
||||
}
|
||||
|
||||
// We don't need to persist the msg as if we dont apply it it will not be removed from the P2P network and we
|
||||
// will received it again at next startup. Such might happen in edge cases when the user shuts down after we
|
||||
// received the msb but before the init is called.
|
||||
// We don't need to persist the msg as if we don't apply it it will not be removed from the P2P network and we
|
||||
// will receive it again on next startup. This might happen in edge cases when the user shuts down after we
|
||||
// received the msg but before the init is called.
|
||||
void addDecryptedMessageWithPubKey(DecryptedMessageWithPubKey decryptedMessageWithPubKey) {
|
||||
if (!decryptedMessageWithPubKeySet.contains(decryptedMessageWithPubKey)) {
|
||||
decryptedMessageWithPubKeySet.add(decryptedMessageWithPubKey);
|
||||
|
|
|
@ -202,7 +202,7 @@ public class SellerAsMakerProtocol extends TradeProtocol implements SellerProtoc
|
|||
// Called from UI
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// User clicked the "bank transfer received" button, so we release the funds for pay out
|
||||
// User clicked the "bank transfer received" button, so we release the funds for payout
|
||||
@Override
|
||||
public void onFiatPaymentReceived(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||
if (trade.getPayoutTx() == null) {
|
||||
|
@ -229,7 +229,7 @@ public class SellerAsMakerProtocol extends TradeProtocol implements SellerProtoc
|
|||
} else {
|
||||
// we don't set the state as we have already a later phase reached
|
||||
log.info("onFiatPaymentReceived called twice. " +
|
||||
"That can happen if message did not arrive first time and we send msg again.\n" +
|
||||
"That can happen if message did not arrive the first time and we send msg again.\n" +
|
||||
"state=" + sellerAsMakerTrade.getState());
|
||||
|
||||
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsMakerTrade,
|
||||
|
|
|
@ -192,7 +192,7 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc
|
|||
// Called from UI
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// User clicked the "bank transfer received" button, so we release the funds for pay out
|
||||
// User clicked the "bank transfer received" button, so we release the funds for payout
|
||||
@Override
|
||||
public void onFiatPaymentReceived(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||
if (trade.getPayoutTx() == null) {
|
||||
|
@ -219,7 +219,7 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc
|
|||
} else {
|
||||
// we don't set the state as we have already a higher phase reached
|
||||
log.info("onFiatPaymentReceived called twice. " +
|
||||
"That can happen if message did not arrive first time and we send msg again.\n" +
|
||||
"That can happen if message did not arrive the first time and we send msg again.\n" +
|
||||
"state=" + sellerAsTakerTrade.getState());
|
||||
|
||||
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsTakerTrade,
|
||||
|
|
|
@ -66,7 +66,7 @@ public class PublishTradeStatistics extends TradeTask {
|
|||
|
||||
NodeAddress mediatorNodeAddress = trade.getMediatorNodeAddress();
|
||||
if (mediatorNodeAddress != null) {
|
||||
// The first 4 chars are sufficient to identify an mediator.
|
||||
// The first 4 chars are sufficient to identify a mediator.
|
||||
// For testing with regtest/localhost we use the full address as its localhost and would result in
|
||||
// same values for multiple mediators.
|
||||
NetworkNode networkNode = model.getProcessModel().getP2PService().getNetworkNode();
|
||||
|
|
|
@ -45,7 +45,7 @@ public class BuyerVerifiesDelayedPayoutTx extends TradeTask {
|
|||
if (processModel.getTradeWalletService().verifiesDepositTxAndDelayedPayoutTx(depositTx, delayedPayoutTx)) {
|
||||
complete();
|
||||
} else {
|
||||
failed("DelayedPayoutTx is not spending correctly depositTx");
|
||||
failed("DelayedPayoutTx is not spending depositTx correctly");
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
failed(t);
|
||||
|
|
|
@ -261,7 +261,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
|||
baseCurrencyNetwork.isDaoBetaNet() ? BSQ_BETA_NET_EXPLORER :
|
||||
BSQ_TEST_NET_EXPLORER);
|
||||
|
||||
// We don't want to pass Preferences to all popups where the dont show again checkbox is used, so we use
|
||||
// We don't want to pass Preferences to all popups where the don't show again checkbox is used, so we use
|
||||
// that static lookup class to avoid static access to the Preferences directly.
|
||||
DontShowAgainLookup.setPreferences(this);
|
||||
|
||||
|
@ -568,7 +568,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
|||
storage.queueUpForSave(prefPayload, 1);
|
||||
}
|
||||
|
||||
// Only used from PB but keep it explicit as maybe it get used from the client and then we want to persist
|
||||
// Only used from PB but keep it explicit as it may be used from the client and then we want to persist
|
||||
public void setPeerTagMap(Map<String, String> peerTagMap) {
|
||||
prefPayload.setPeerTagMap(peerTagMap);
|
||||
persist();
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ParsingUtils {
|
|||
}
|
||||
|
||||
public static String convertCharsForNumber(String input) {
|
||||
// Some languages like finnish use the long dash for the minus
|
||||
// Some languages like Finnish use the long dash for the minus
|
||||
input = input.replace("−", "-");
|
||||
input = StringUtils.deleteWhitespace(input);
|
||||
return input.replace(",", ".");
|
||||
|
|
|
@ -55,9 +55,9 @@ public class BsqFormatter implements CoinFormatter {
|
|||
private final ImmutableCoinFormatter immutableCoinFormatter;
|
||||
|
||||
// We don't support localized formatting. Format is always using "." as decimal mark and no grouping separator.
|
||||
// Input of "," as decimal mark (like in german locale) will be replaced with ".".
|
||||
// Input of a group separator (1,123,45) lead to an validation error.
|
||||
// Note: BtcFormat was intended to be used, but it lead to many problems (automatic format to mBit,
|
||||
// Input of "," as decimal mark (like in German locale) will be replaced with ".".
|
||||
// Input of a group separator (1,123,45) leads to a validation error.
|
||||
// Note: BtcFormat was intended to be used, but it leads to many problems (automatic format to mBit,
|
||||
// no way to remove grouping separator). It seems to be not optimal for user input formatting.
|
||||
@Getter
|
||||
private MonetaryFormat monetaryFormat;
|
||||
|
|
|
@ -49,7 +49,7 @@ public class OfferUtilTest {
|
|||
} catch (IllegalArgumentException iae) {
|
||||
Assert.assertEquals(
|
||||
"Unexpected exception message.",
|
||||
"amount needs to be above minimum of 10k satoshi",
|
||||
"amount needs to be above minimum of 10k satoshis",
|
||||
iae.getMessage()
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue