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