Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions src/privatesend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,7 @@ void CPrivateSend::InitStandardDenominations()
vecStandardDenominations.push_back((1 * COIN) + 1000);
vecStandardDenominations.push_back((.1 * COIN) + 100);
vecStandardDenominations.push_back((.01 * COIN) + 10);
/* Disabled till we need them
vecStandardDenominations.push_back( (.001 * COIN)+1 );
*/
vecStandardDenominations.push_back((.001 * COIN) + 1);
}

// check to make sure the collateral provided by the client is valid
Expand All @@ -329,8 +327,7 @@ bool CPrivateSend::IsCollateralValid(const CTransaction& txCollateral)
for (const auto& txout : txCollateral.vout) {
nValueOut += txout.nValue;

bool fAllowData = mnpayments.GetMinMasternodePaymentsProto() > 70208;
if (!txout.scriptPubKey.IsPayToPublicKeyHash() && !(fAllowData && txout.scriptPubKey.IsUnspendable())) {
if (!txout.scriptPubKey.IsPayToPublicKeyHash() && !txout.scriptPubKey.IsUnspendable()) {
LogPrintf("CPrivateSend::IsCollateralValid -- Invalid Script, txCollateral=%s", txCollateral.ToString());
return false;
}
Expand Down Expand Up @@ -367,13 +364,8 @@ bool CPrivateSend::IsCollateralValid(const CTransaction& txCollateral)

bool CPrivateSend::IsCollateralAmount(CAmount nInputAmount)
{
if (mnpayments.GetMinMasternodePaymentsProto() > 70208) {
// collateral input can be anything between 1x and "max" (including both)
return (nInputAmount >= GetCollateralAmount() && nInputAmount <= GetMaxCollateralAmount());
} else { // <= 70208
// collateral input can be anything between 2x and "max" (including both)
return (nInputAmount >= GetCollateralAmount() * 2 && nInputAmount <= GetMaxCollateralAmount());
}
// collateral input can be anything between 1x and "max" (including both)
return (nInputAmount >= GetCollateralAmount() && nInputAmount <= GetMaxCollateralAmount());
}

/* Create a nice string to show the denominations
Expand Down
20 changes: 3 additions & 17 deletions src/privatesend.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static const int PRIVATESEND_QUEUE_TIMEOUT = 30;
static const int PRIVATESEND_SIGNING_TIMEOUT = 15;

//! minimum peer version accepted by mixing pool
static const int MIN_PRIVATESEND_PEER_PROTO_VERSION = 70210;
static const int MIN_PRIVATESEND_PEER_PROTO_VERSION = 70212;

static const size_t PRIVATESEND_ENTRY_MAX_SIZE = 9;

Expand Down Expand Up @@ -118,11 +118,6 @@ class CPrivateSendAccept
inline void SerializationOp(Stream& s, Operation ser_action)
{
READWRITE(nDenom);
int nVersion = s.GetVersion();
if (nVersion > 70208 && nVersion <= 70210) {
int nInputCount = 0;
READWRITE(nInputCount);
}
READWRITE(txCollateral);
}

Expand Down Expand Up @@ -179,7 +174,6 @@ class CPrivateSendQueue
{
public:
int nDenom;
int nInputCount; // not used for anything but to calculate correct hash, remove after migration to 70211
COutPoint masternodeOutpoint;
int64_t nTime;
bool fReady; //ready for submit
Expand All @@ -189,7 +183,6 @@ class CPrivateSendQueue

CPrivateSendQueue() :
nDenom(0),
nInputCount(0),
masternodeOutpoint(COutPoint()),
nTime(0),
fReady(false),
Expand All @@ -200,7 +193,6 @@ class CPrivateSendQueue

CPrivateSendQueue(int nDenom, COutPoint outpoint, int64_t nTime, bool fReady) :
nDenom(nDenom),
nInputCount(0),
masternodeOutpoint(outpoint),
nTime(nTime),
fReady(fReady),
Expand All @@ -215,10 +207,6 @@ class CPrivateSendQueue
inline void SerializationOp(Stream& s, Operation ser_action)
{
READWRITE(nDenom);
int nVersion = s.GetVersion();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@UdjinM6 Will this change the wire serialization of DSQ (and cause incompatibility between versions)? Or does that not matter since Spork 6 was never activated?

Copy link
Author

@UdjinM6 UdjinM6 Oct 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, serialization will change, but we are bumping MIN_PRIVATESEND_PEER_PROTO_VERSION too here (and we don't process PS messages from/to nodes below it), so it should be fine.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All 12.4 nodes will reject DSA and DSQ from any 12.3 node, and all 12.3 nodes will not be able to decode DSA and DSQ from any 12.4 node.

I see 2 issues here during the network upgrade:

  1. there may be problems with propagation of DSQ messages through the network,
  2. 12.3 nodes can mix only with another 12.3 nodes only through 12.3 MNs, the same for 12.4 nodes/MNs

The Second issue would not be so big if the First issue didn't make mixing unstable for quite long time. Thoughts?

Copy link
Author

@UdjinM6 UdjinM6 Oct 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small correction: 12.4 won't relay any PS message to 12.3 nodes. But yes, migration issues you highlighted are correct - mixing usability will be degraded for a week or so while network is upgrading, especially if you are not using the version which is used by the majority (MNs/mixing participants) atm.

if (nVersion > 70208 && nVersion <= 70210) {
READWRITE(nInputCount);
}
READWRITE(masternodeOutpoint);
READWRITE(nTime);
READWRITE(fReady);
Expand Down Expand Up @@ -390,8 +378,6 @@ class CPrivateSend
CPrivateSend(CPrivateSend const&) = delete;
CPrivateSend& operator=(CPrivateSend const&) = delete;

static const CAmount COLLATERAL = 0.001 * COIN;

// static members
static std::vector<CAmount> vecStandardDenominations;
static std::map<uint256, CPrivateSendBroadcastTx> mapDSTX;
Expand Down Expand Up @@ -424,8 +410,8 @@ class CPrivateSend

/// If the collateral is valid given by a client
static bool IsCollateralValid(const CTransaction& txCollateral);
static CAmount GetCollateralAmount() { return COLLATERAL; }
static CAmount GetMaxCollateralAmount() { return COLLATERAL * 4; }
static CAmount GetCollateralAmount() { return GetSmallestDenomination() / 10; }
static CAmount GetMaxCollateralAmount() { return GetCollateralAmount() * 4; }

static bool IsCollateralAmount(CAmount nInputAmount);

Expand Down