Skip to content

Commit

Permalink
Make sure mixing masternode follows bip69 before signing final mixing…
Browse files Browse the repository at this point in the history
… tx (#1510)

* Make sure mixing tx follows bip69 before signing it

* bump MIN_PRIVATESEND_PEER_PROTO_VERSION to 70208
  • Loading branch information
UdjinM6 authored Sep 22, 2017
1 parent 5027484 commit ea793a7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/privatesend-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,18 @@ bool CPrivateSendClient::SignFinalTransaction(const CTransaction& finalTransacti
finalMutableTransaction = finalTransactionNew;
LogPrintf("CPrivateSendClient::SignFinalTransaction -- finalMutableTransaction=%s", finalMutableTransaction.ToString());

// Make sure it's BIP69 compliant
sort(finalMutableTransaction.vin.begin(), finalMutableTransaction.vin.end(), CompareInputBIP69());
sort(finalMutableTransaction.vout.begin(), finalMutableTransaction.vout.end(), CompareOutputBIP69());

if(finalMutableTransaction.GetHash() != finalTransactionNew.GetHash()) {
LogPrintf("CPrivateSendClient::SignFinalTransaction -- WARNING! Masternode %s is not BIP69 compliant!\n", infoMixingMasternode.vin.prevout.ToStringShort());
UnlockCoins();
keyHolderStorage.ReturnAll();
SetNull();
return false;
}

std::vector<CTxIn> sigs;

//make sure my inputs/outputs are present, otherwise refuse to sign
Expand Down
2 changes: 1 addition & 1 deletion src/privatesend.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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 = 70206;
static const int MIN_PRIVATESEND_PEER_PROTO_VERSION = 70208;

static const CAmount PRIVATESEND_ENTRY_MAX_SIZE = 9;

Expand Down

0 comments on commit ea793a7

Please sign in to comment.