Skip to content

Commit

Permalink
increase max frozen blind spend
Browse files Browse the repository at this point in the history
  • Loading branch information
bleach86 committed Feb 19, 2024
1 parent 3b1e8a9 commit 3791c1a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/consensus/tx_verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,10 @@ bool Consensus::CheckTxInputs(const CTransaction& tx, TxValidationState& state,
if (nRingCTOutputs > 0 || nCTOutputs > 0) {
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-frozen-blinded-out");
}
if (spends_tainted_blinded && nPlainValueOut + txfee > state.m_consensus_params->m_max_tainted_value_out) {

CAmount max_tainted_value_out = nSpendHeight >= state.m_consensus_params->nBlockRewardCorrectionHeight ? 150000LL * 100000000LL : state.m_consensus_params->m_max_tainted_value_out;

if (spends_tainted_blinded && nPlainValueOut + txfee > max_tainted_value_out) {
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-frozen-blinded-too-large");
}
/* TODO? Limit to spending one frozen output at a time
Expand Down
6 changes: 4 additions & 2 deletions src/wallet/hdwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11829,7 +11829,8 @@ void CHDWallet::AvailableBlindedCoins(std::vector<COutputR>& vCoins, bool fOnlyS
}

if (spend_frozen && !include_tainted_frozen) {
if (r.nValue > consensusParams.m_max_tainted_value_out) {
CAmount max_tainted_value_out = rtx.block_height >= consensusParams.nBlockRewardCorrectionHeight ? 150000LL * 100000000LL : consensusParams.m_max_tainted_value_out;
if (r.nValue > max_tainted_value_out) {
if (IsFrozenBlindOutput(txid)) {
continue;
}
Expand Down Expand Up @@ -12081,11 +12082,12 @@ void CHDWallet::AvailableAnonCoins(std::vector<COutputR> &vCoins, bool fOnlySafe
// TODO: Store pubkey on COutputRecord - in scriptPubKey
CStoredTransaction stx;
int64_t index;
CAmount max_tainted_value_out = rtx.block_height >= consensusParams.nBlockRewardCorrectionHeight ? 150000LL * 100000000LL : consensusParams.m_max_tainted_value_out;
if (!wdb.ReadStoredTx(txid, stx) ||
!stx.tx->vpout[r.n]->IsType(OUTPUT_RINGCT) ||
!pblocktree->ReadRCTOutputLink(((CTxOutRingCT*)stx.tx->vpout[r.n].get())->pk, index) ||
!::Params().IsBlacklistedAnonOutput(index) ||
(!IsWhitelistedAnonOutput(index, time_now, consensusParams) && r.nValue > consensusParams.m_max_tainted_value_out)) {
(!IsWhitelistedAnonOutput(index, time_now, consensusParams) && r.nValue > max_tainted_value_out)) {
continue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/rpchdwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6726,7 +6726,7 @@ static UniValue debugwallet(const JSONRPCRequest &request)
bool clear_stakes_seen = false;
bool downgrade_wallets = false;
bool exit_ibd = false;
CAmount max_frozen_output_spendable = Params().GetConsensus().m_max_tainted_value_out;
CAmount max_frozen_output_spendable = pwallet->GetLastBlockHeight() >= Params().GetConsensus().nBlockRewardCorrectionHeight ? 150000LL * 100000000LL : Params().GetConsensus().m_max_tainted_value_out;
int64_t time_now = GetAdjustedTime();

if (!request.params[0].isNull()) {
Expand Down

0 comments on commit 3791c1a

Please sign in to comment.