Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
collat update
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jul 16, 2018
1 parent ab426e0 commit fe2cda6
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 20 deletions.
16 changes: 11 additions & 5 deletions src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,22 +213,28 @@ void CActiveMasternode::ManageStateInitial()
CTransaction wtx2;
uint256 hashBlock2;
CAmount collat_required;
//if(chainActive.Height() <= 24804){
if(GetTransaction(vin.prevout.hash, wtx2, Params().GetConsensus(), hashBlock2, true)) {
BlockMap::iterator iter = mapBlockIndex.find(hashBlock2);
if (iter != mapBlockIndex.end()) {
int txnheight = iter->second->nHeight;
//block height of txn
if (txnheight <= 80){
collat_required = 100 * COIN;
} else {
} else if (chainActive.Height() <= 24804) {
collat_required = 1000000000 * COIN;
}
// }
} else {
collat_required = 1000000000 * COIN;
}
// collat_required = 1000000000 * COIN;
//}
//}
//} else {
collat_required = 2500000 * COIN;
}
}
}
if(pwalletMain->GetBalance() < collat_required) {
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: Wallet balance is < 100 HTH\n", GetStateString());
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: Wallet balance is < 2500000 HTH\n", GetStateString());
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/darksend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2268,7 +2268,7 @@ bool CDarkSendSigner::IsVinAssociatedWithPubkey(const CTxIn& txin, const CPubKey
uint256 hash;
if(GetTransaction(txin.prevout.hash, tx, Params().GetConsensus(), hash, true)) {
BOOST_FOREACH(CTxOut out, tx.vout)
if(out.nValue == 100*COIN && out.scriptPubKey == payee) return true;
if((out.nValue == 100*COIN || out.nValue == 2500000 * COIN) && out.scriptPubKey == payee) return true;
}

return false;
Expand Down
18 changes: 10 additions & 8 deletions src/masternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ bool CMasternodeBroadcast::CheckOutpoint(int& nDos)
return false;
}
CAmount collat_required;
if (chainActive.Height() <= 24804) {
// if (chainActive.Height() <= 24804) {
//CAmount collat_required;
CTransaction wtx2;
uint256 hashBlock2;
Expand All @@ -638,18 +638,20 @@ bool CMasternodeBroadcast::CheckOutpoint(int& nDos)
//block height of txn
if (txnheight <= 80){
collat_required = 100 * COIN;
} else {
} else if (chainActive.Height() <= 24804) {
collat_required = 1000000000 * COIN;
}

} else {
collat_required = 1000000000 * COIN;
collat_required = 2500000 * COIN;
}
}
} else {
collat_required = 2500000 * COIN;
}
}
//} else {
// collat_required = 2500000 * COIN;
// }
if(coins.vout[vin.prevout.n].nValue != collat_required) {
LogPrint("masternode", "CMasternodeBroadcast::CheckOutpoint -- Masternode UTXO should have 100 HTH, masternode=%s\n", vin.prevout.ToStringShort());
if (
LogPrint("masternode", "CMasternodeBroadcast::CheckOutpoint -- Masternode UTXO should have 2500000 HTH, masternode=%s\n", vin.prevout.ToStringShort()));
return false;
}

Expand Down
32 changes: 26 additions & 6 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2115,13 +2115,27 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
if(nCoinType == ONLY_DENOMINATED) {
found = IsDenominatedAmount(pcoin->vout[i].nValue);
} else if(nCoinType == ONLY_NOT5000IFMN) {
found = !(fMasterNode && pcoin->vout[i].nValue == 100*COIN);
//if (chainActive.Height() > 24804){
found = !(fMasterNode && (pcoin->vout[i].nValue == 100*COIN || pcoin->vout[i].nValue == 2500000*COIN));
//} else {
// found = !(fMasterNode && pcoin->vout[i].nValue == 100*COIN);
// }
} else if(nCoinType == ONLY_NONDENOMINATED_NOT5000IFMN) {
if (IsCollateralAmount(pcoin->vout[i].nValue)) continue; // do not use collateral amounts
found = !IsDenominatedAmount(pcoin->vout[i].nValue);
if(found && fMasterNode) found = pcoin->vout[i].nValue != 100*COIN; // do not use Hot MN funds
// CAmount hi;
// if (chainActive.Height() > 24804) {
// hi = 2500000 * COIN;
// } else {
// hi = 100 * COIN;
// }
if(found && fMasterNode) found = ((pcoin->vout[i].nValue != 100 * COIN || pcoin->vout[i].nValue != 2500000*COIN)); // do not use Hot MN funds
} else if(nCoinType == ONLY_5000) {
found = pcoin->vout[i].nValue == 100*COIN;
//if (chainActive.Height() > 24804) {
found = (pcoin->vout[i].nValue == 2500000*COIN || pcoin->vout[i].nValue == 100*COIN);
//} else {
//found = pcoin->vout[i].nValue == 100*COIN;
// }
} else if(nCoinType == ONLY_PRIVATESEND_COLLATERAL) {
found = IsCollateralAmount(pcoin->vout[i].nValue);
} else {
Expand Down Expand Up @@ -2512,7 +2526,7 @@ bool CWallet::SelectCoinsByDenominations(int nDenom, CAmount nValueMin, CAmount
BOOST_FOREACH(const COutput& out, vCoins)
{
// masternode-like input should not be selected by AvailableCoins now anyway
//if(out.tx->vout[out.i].nValue == 100*COIN) continue;
//if(out.tx->vout[out.i].nValue == 2500000*COIN) continue;
if(nValueRet + out.tx->vout[out.i].nValue <= nValueMax){

CTxIn txin = CTxIn(out.tx->GetHash(), out.i);
Expand Down Expand Up @@ -2594,7 +2608,13 @@ bool CWallet::SelectCoinsGrouppedByAddresses(std::vector<CompactTallyItem>& vecT
if(fAnonymizable) {
// ignore collaterals
if(IsCollateralAmount(wtx.vout[i].nValue)) continue;
if(fMasterNode && wtx.vout[i].nValue == 100*COIN) continue;
// CAmount hi2;
// if (chainActive.Height() > 24804) {
// hi2 = 2500000 * COIN;
// } else {
// hi2 = 100 * COIN;
// }
if(fMasterNode && (wtx.vout[i].nValue == 100 * COIN || wtx.vout[i].nValue == 2500000 * COIN )) continue;
// ignore outputs that are 10 times smaller then the smallest denomination
// otherwise they will just lead to higher fee / lower priority
if(wtx.vout[i].nValue <= vecPrivateSendDenominations.back()/10) continue;
Expand Down Expand Up @@ -2658,7 +2678,7 @@ bool CWallet::SelectCoinsDark(CAmount nValueMin, CAmount nValueMax, std::vector<
if(out.tx->vout[out.i].nValue < nValueMin/10) continue;
//do not allow collaterals to be selected
if(IsCollateralAmount(out.tx->vout[out.i].nValue)) continue;
if(fMasterNode && out.tx->vout[out.i].nValue == 100*COIN) continue; //masternode input
if(fMasterNode && (out.tx->vout[out.i].nValue == 2500000*COIN || out.tx->vout[out.i].nValue == 100*COIN)) continue; //masternode input

if(nValueRet + out.tx->vout[out.i].nValue <= nValueMax){
CTxIn txin = CTxIn(out.tx->GetHash(),out.i);
Expand Down

0 comments on commit fe2cda6

Please sign in to comment.