mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-31 02:39:08 -04:00
Bugfixes, refactorings,...
This commit is contained in:
parent
d933110a8d
commit
9dd9decb96
22 changed files with 124 additions and 82 deletions
|
@ -121,7 +121,7 @@ public class AddressEntry implements Serializable {
|
|||
// For display we usually only display the first 8 characters.
|
||||
@Nullable
|
||||
public String getShortOfferId() {
|
||||
return offerId != null ? offerId.substring(0, 8) : null;
|
||||
return offerId != null ? offerId.substring(0, Math.min(8, offerId.length())) : null;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
|
|
|
@ -968,7 +968,7 @@ public class TradeWalletService {
|
|||
checkNotNull(input.getConnectedOutput(), "input.getConnectedOutput() must not be null");
|
||||
Script scriptPubKey = input.getConnectedOutput().getScriptPubKey();
|
||||
ECKey sigKey = input.getOutpoint().getConnectedKey(wallet);
|
||||
checkNotNull(sigKey, "sigKey must not be null");
|
||||
checkNotNull(sigKey, "signInput: sigKey must not be null. input.getOutpoint()=" + input.getOutpoint().toString());
|
||||
Sha256Hash hash = transaction.hashForSignature(inputIndex, scriptPubKey, Transaction.SigHash.ALL, false);
|
||||
ECKey.ECDSASignature signature = sigKey.sign(hash, aesKey);
|
||||
TransactionSignature txSig = new TransactionSignature(signature, Transaction.SigHash.ALL, false);
|
||||
|
|
|
@ -26,6 +26,7 @@ public class BlockChainAccountContractData extends PaymentAccountContractData im
|
|||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
|
||||
private String address;
|
||||
// used in crypto note coins. not supported now but hopefully in future, so leave it for now.
|
||||
private String paymentId;
|
||||
|
||||
public BlockChainAccountContractData(String paymentMethod, String id, int maxTradePeriod) {
|
||||
|
|
|
@ -198,7 +198,7 @@ public final class Offer implements PubKeyProtectedExpirablePayload {
|
|||
}
|
||||
|
||||
public String getReferenceText() {
|
||||
return id.substring(0, 8);
|
||||
return id.substring(0, Math.min(8, id.length()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -263,7 +263,7 @@ public final class Offer implements PubKeyProtectedExpirablePayload {
|
|||
}
|
||||
|
||||
public String getShortId() {
|
||||
return id.substring(0, 8);
|
||||
return id.substring(0, Math.min(8, id.length()));
|
||||
}
|
||||
|
||||
public NodeAddress getOffererNodeAddress() {
|
||||
|
|
|
@ -66,7 +66,7 @@ public class ProcessPayDepositRequest extends TradeTask {
|
|||
// We apply the payment ID in case its a cryptoNote coin. It is created form the hash of the trade ID
|
||||
if (paymentAccountContractData instanceof BlockChainAccountContractData &&
|
||||
CurrencyUtil.isCryptoNoteCoin(processModel.getOffer().getCurrencyCode())) {
|
||||
String paymentId = Hash.getHashAsHex(trade.getId()).substring(0, 32);
|
||||
String paymentId = Hash.getHashAsHex(trade.getId()).substring(0, Math.min(32, trade.getId().length()));
|
||||
((BlockChainAccountContractData) paymentAccountContractData).setPaymentId(paymentId);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ProcessPublishDepositTxRequest extends TradeTask {
|
|||
// We apply the payment ID in case its a cryptoNote coin. It is created form the hash of the trade ID
|
||||
if (paymentAccountContractData instanceof BlockChainAccountContractData &&
|
||||
CurrencyUtil.isCryptoNoteCoin(processModel.getOffer().getCurrencyCode())) {
|
||||
String paymentId = Hash.getHashAsHex(trade.getId()).substring(0, 32);
|
||||
String paymentId = Hash.getHashAsHex(trade.getId()).substring(0, Math.min(32, trade.getId().length()));
|
||||
((BlockChainAccountContractData) paymentAccountContractData).setPaymentId(paymentId);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue