mirror of
https://github.com/retoaccess1/haveno-reto.git
synced 2024-11-10 13:13:36 +01:00
add trader id to SignedOffer
This commit is contained in:
parent
19d83749eb
commit
ead70751dc
@ -236,7 +236,7 @@ public class CoreDisputesService {
|
||||
.add(buyerSecurityDeposit));
|
||||
} else if (payout == DisputePayout.CUSTOM) {
|
||||
if (customWinnerAmount > trade.getWallet().getBalance().longValueExact()) {
|
||||
throw new RuntimeException("The custom winner payout amount is more than the trade wallet's balance");
|
||||
throw new RuntimeException("Winner payout is more than the trade wallet's balance");
|
||||
}
|
||||
long loserAmount = tradeAmount.add(buyerSecurityDeposit).add(sellerSecurityDeposit).subtract(BigInteger.valueOf(customWinnerAmount)).longValueExact();
|
||||
disputeResult.setBuyerPayoutAmount(BigInteger.valueOf(disputeResult.getWinner() == DisputeResult.Winner.BUYER ? customWinnerAmount : loserAmount));
|
||||
|
@ -1007,6 +1007,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||
// create record of signed offer
|
||||
SignedOffer signedOffer = new SignedOffer(
|
||||
System.currentTimeMillis(),
|
||||
signedOfferPayload.getPubKeyRing().hashCode(), // trader id
|
||||
signedOfferPayload.getId(),
|
||||
offer.getAmount().longValueExact(),
|
||||
txResult.second.longValueExact(),
|
||||
|
@ -18,6 +18,8 @@
|
||||
package haveno.core.offer;
|
||||
|
||||
import haveno.common.proto.persistable.PersistablePayload;
|
||||
import haveno.core.util.JsonUtil;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
@ -30,6 +32,8 @@ public final class SignedOffer implements PersistablePayload {
|
||||
@Getter
|
||||
private final long timeStamp;
|
||||
@Getter
|
||||
private int traderId;
|
||||
@Getter
|
||||
private final String offerId;
|
||||
@Getter
|
||||
private final long tradeAmount;
|
||||
@ -47,6 +51,7 @@ public final class SignedOffer implements PersistablePayload {
|
||||
private final String arbitratorSignature;
|
||||
|
||||
public SignedOffer(long timeStamp,
|
||||
int traderId,
|
||||
String offerId,
|
||||
long tradeAmount,
|
||||
long penaltyAmount,
|
||||
@ -56,6 +61,7 @@ public final class SignedOffer implements PersistablePayload {
|
||||
long reserveTxMinerFee,
|
||||
String arbitratorSignature) {
|
||||
this.timeStamp = timeStamp;
|
||||
this.traderId = traderId;
|
||||
this.offerId = offerId;
|
||||
this.tradeAmount = tradeAmount;
|
||||
this.penaltyAmount = penaltyAmount;
|
||||
@ -74,6 +80,7 @@ public final class SignedOffer implements PersistablePayload {
|
||||
public protobuf.SignedOffer toProtoMessage() {
|
||||
protobuf.SignedOffer.Builder builder = protobuf.SignedOffer.newBuilder()
|
||||
.setTimeStamp(timeStamp)
|
||||
.setTraderId(traderId)
|
||||
.setOfferId(offerId)
|
||||
.setTradeAmount(tradeAmount)
|
||||
.setPenaltyAmount(penaltyAmount)
|
||||
@ -87,6 +94,7 @@ public final class SignedOffer implements PersistablePayload {
|
||||
|
||||
public static SignedOffer fromProto(protobuf.SignedOffer proto) {
|
||||
return new SignedOffer(proto.getTimeStamp(),
|
||||
proto.getTraderId(),
|
||||
proto.getOfferId(),
|
||||
proto.getTradeAmount(),
|
||||
proto.getPenaltyAmount(),
|
||||
@ -102,10 +110,15 @@ public final class SignedOffer implements PersistablePayload {
|
||||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public String toJson() {
|
||||
return JsonUtil.objectToJson(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SignedOffer{" +
|
||||
",\n timeStamp=" + timeStamp +
|
||||
",\n traderId=" + traderId +
|
||||
",\n offerId=" + offerId +
|
||||
",\n tradeAmount=" + tradeAmount +
|
||||
",\n penaltyAmount=" + penaltyAmount +
|
||||
|
@ -1348,14 +1348,15 @@ message SignedOfferList {
|
||||
|
||||
message SignedOffer {
|
||||
int64 time_stamp = 1;
|
||||
string offer_id = 2;
|
||||
uint64 trade_amount = 3;
|
||||
uint64 penalty_amount = 4;
|
||||
string reserve_tx_hash = 5;
|
||||
string reserve_tx_hex = 6;
|
||||
repeated string reserve_tx_key_images = 7;
|
||||
uint64 reserve_tx_miner_fee = 8;
|
||||
string arbitrator_signature = 9;
|
||||
int32 trader_id = 2;
|
||||
string offer_id = 3;
|
||||
uint64 trade_amount = 4;
|
||||
uint64 penalty_amount = 5;
|
||||
string reserve_tx_hash = 6;
|
||||
string reserve_tx_hex = 7;
|
||||
repeated string reserve_tx_key_images = 8;
|
||||
uint64 reserve_tx_miner_fee = 9;
|
||||
string arbitrator_signature = 10;
|
||||
}
|
||||
|
||||
message OpenOffer {
|
||||
|
Loading…
Reference in New Issue
Block a user