Skip to content

Commit 513e6dc

Browse files
author
limxdev
committed
Improve the Collateralcheck & Fix masternode outputs
1 parent 6b5e1e6 commit 513e6dc

3 files changed

Lines changed: 6 additions & 14 deletions

File tree

src/masternode.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ CMasternode::CollateralStatus CMasternode::CheckCollateral(const COutPoint& outp
111111
return CheckCollateral(outpoint, nHeight);
112112
}
113113

114-
CMasternode::CollateralStatus CMasternode::CheckCollateral(const COutPoint& outpoint, int& nHeightRet)
114+
CMasternode::CollateralStatus CMasternode::CheckCollateral(const COutPoint& outpoint)
115115
{
116116
AssertLockHeld(cs_main);
117117

@@ -120,17 +120,12 @@ CMasternode::CollateralStatus CMasternode::CheckCollateral(const COutPoint& outp
120120
return COLLATERAL_UTXO_NOT_FOUND;
121121
}
122122

123-
// FXTC BEGIN
124-
nHeightRet = coin.nHeight;
125-
126123
CMasternode cm;
127-
//if(coin.out.nValue != 1000 * COIN) {
128-
if(!cm.CollateralValueCheck(coin.nHeight,coin.out.nValue)) {
129-
// FXTC END
124+
if(coin.out.nValue != Params().GetConsensus().nMasternodeCollateralMinimum * COIN)
125+
{
130126
return COLLATERAL_INVALID_AMOUNT;
131127
}
132-
133-
nHeightRet = coin.nHeight;
128+
134129
return COLLATERAL_OK;
135130
}
136131

src/masternode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class CMasternode : public masternode_info_t
205205
bool UpdateFromNewBroadcast(CMasternodeBroadcast& mnb, CConnman& connman);
206206

207207
static CollateralStatus CheckCollateral(const COutPoint& outpoint);
208-
static CollateralStatus CheckCollateral(const COutPoint& outpoint, int& nHeightRet);
208+
static CollateralStatus CheckCollateral(const COutPoint& outpoint);
209209

210210
// FXTC BEGIN
211211
bool CollateralValueCheck(int nHeight, CAmount TxValue);

src/wallet/wallet.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2825,10 +2825,7 @@ void CWallet::AvailableCoins(std::vector<COutput> &vCoins, bool fOnlySafe, const
28252825
if (CPrivateSend::IsCollateralAmount(pcoin->tx->vout[i].nValue)) continue; // do not use collateral amounts
28262826
found = !CPrivateSend::IsDenominatedAmount(pcoin->tx->vout[i].nValue);
28272827
} else if(nCoinType == ONLY_MASTERNODE_COLLATERAL) {
2828-
// FXTC BEGIN
2829-
//found = pcoin->tx->vout[i].nValue == 1000*COIN;
2830-
found = CMasternode::CheckCollateral(COutPoint(pcoin->GetHash(),i)) == CMasternode::COLLATERAL_OK;
2831-
// FXTC END
2828+
found = pcoin->tx->vout[i].nValue == Params().GetConsensus().nMasternodeCollateralMinimum * COIN;
28322829
} else if(nCoinType == ONLY_PRIVATESEND_COLLATERAL) {
28332830
found = CPrivateSend::IsCollateralAmount(pcoin->tx->vout[i].nValue);
28342831
} else {

0 commit comments

Comments
 (0)