Network-specific thresholds for required confirmations (IS) (#1962)
This commit is contained in:
parent
6536003528
commit
7d5223b5e4
@ -126,6 +126,7 @@ public:
|
||||
consensus.nMasternodePaymentsStartBlock = 100000; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
|
||||
consensus.nMasternodePaymentsIncreaseBlock = 158000; // actual historical value
|
||||
consensus.nMasternodePaymentsIncreasePeriod = 576*30; // 17280 - actual historical value
|
||||
consensus.nInstantSendConfirmationsRequired = 6;
|
||||
consensus.nInstantSendKeepLock = 24;
|
||||
consensus.nBudgetPaymentsStartBlock = 328008; // actual historical value
|
||||
consensus.nBudgetPaymentsCycleBlocks = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725
|
||||
@ -278,6 +279,7 @@ public:
|
||||
consensus.nMasternodePaymentsStartBlock = 4010; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
|
||||
consensus.nMasternodePaymentsIncreaseBlock = 4030;
|
||||
consensus.nMasternodePaymentsIncreasePeriod = 10;
|
||||
consensus.nInstantSendConfirmationsRequired = 2;
|
||||
consensus.nInstantSendKeepLock = 6;
|
||||
consensus.nBudgetPaymentsStartBlock = 4100;
|
||||
consensus.nBudgetPaymentsCycleBlocks = 50;
|
||||
@ -408,6 +410,7 @@ public:
|
||||
consensus.nMasternodePaymentsStartBlock = 4010; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
|
||||
consensus.nMasternodePaymentsIncreaseBlock = 4030;
|
||||
consensus.nMasternodePaymentsIncreasePeriod = 10;
|
||||
consensus.nInstantSendConfirmationsRequired = 2;
|
||||
consensus.nInstantSendKeepLock = 6;
|
||||
consensus.nBudgetPaymentsStartBlock = 4100;
|
||||
consensus.nBudgetPaymentsCycleBlocks = 50;
|
||||
@ -534,6 +537,7 @@ public:
|
||||
consensus.nMasternodePaymentsStartBlock = 240;
|
||||
consensus.nMasternodePaymentsIncreaseBlock = 350;
|
||||
consensus.nMasternodePaymentsIncreasePeriod = 10;
|
||||
consensus.nInstantSendConfirmationsRequired = 2;
|
||||
consensus.nInstantSendKeepLock = 6;
|
||||
consensus.nBudgetPaymentsStartBlock = 1000;
|
||||
consensus.nBudgetPaymentsCycleBlocks = 50;
|
||||
|
@ -48,6 +48,7 @@ struct Params {
|
||||
int nMasternodePaymentsStartBlock;
|
||||
int nMasternodePaymentsIncreaseBlock;
|
||||
int nMasternodePaymentsIncreasePeriod; // in blocks
|
||||
int nInstantSendConfirmationsRequired; // in blocks
|
||||
int nInstantSendKeepLock; // in blocks
|
||||
int nBudgetPaymentsStartBlock;
|
||||
int nBudgetPaymentsCycleBlocks;
|
||||
|
@ -964,6 +964,8 @@ bool CTxLockRequest::IsValid() const
|
||||
|
||||
CAmount nValueIn = 0;
|
||||
|
||||
int nInstantSendConfirmationsRequired = Params().GetConsensus().nInstantSendConfirmationsRequired;
|
||||
|
||||
for (const auto& txin : tx->vin) {
|
||||
|
||||
Coin coin;
|
||||
@ -975,7 +977,7 @@ bool CTxLockRequest::IsValid() const
|
||||
|
||||
int nTxAge = chainActive.Height() - coin.nHeight + 1;
|
||||
// 1 less than the "send IX" gui requires, in case of a block propagating the network at the time
|
||||
int nConfirmationsRequired = INSTANTSEND_CONFIRMATIONS_REQUIRED - 1;
|
||||
int nConfirmationsRequired = nInstantSendConfirmationsRequired - 1;
|
||||
|
||||
if(nTxAge < nConfirmationsRequired) {
|
||||
LogPrint("instantsend", "CTxLockRequest::IsValid -- outpoint %s too new: nTxAge=%d, nConfirmationsRequired=%d, txid=%s\n",
|
||||
|
@ -25,7 +25,6 @@ extern CInstantSend instantsend;
|
||||
### getting 5 of 10 signatures w/ 1000 nodes of 2900
|
||||
(1000/2900.0)**5 = 0.004875397277841433
|
||||
*/
|
||||
static const int INSTANTSEND_CONFIRMATIONS_REQUIRED = 6;
|
||||
|
||||
static const int MIN_INSTANTSEND_DEPTH = 0;
|
||||
static const int MAX_INSTANTSEND_DEPTH = 60;
|
||||
|
@ -2569,6 +2569,8 @@ void CWallet::AvailableCoins(std::vector<COutput>& vCoins, bool fOnlyConfirmed,
|
||||
|
||||
{
|
||||
LOCK2(cs_main, cs_wallet);
|
||||
int nInstantSendConfirmationsRequired = Params().GetConsensus().nInstantSendConfirmationsRequired;
|
||||
|
||||
for (std::map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
|
||||
{
|
||||
const uint256& wtxid = it->first;
|
||||
@ -2584,8 +2586,8 @@ void CWallet::AvailableCoins(std::vector<COutput>& vCoins, bool fOnlyConfirmed,
|
||||
continue;
|
||||
|
||||
int nDepth = pcoin->GetDepthInMainChain(false);
|
||||
// do not use IX for inputs that have less then INSTANTSEND_CONFIRMATIONS_REQUIRED blockchain confirmations
|
||||
if (fUseInstantSend && nDepth < INSTANTSEND_CONFIRMATIONS_REQUIRED)
|
||||
// do not use IX for inputs that have less then nInstantSendConfirmationsRequired blockchain confirmations
|
||||
if (fUseInstantSend && nDepth < nInstantSendConfirmationsRequired)
|
||||
continue;
|
||||
|
||||
// We should not consider coins which aren't at least in our mempool
|
||||
@ -3464,6 +3466,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
|
||||
{
|
||||
std::vector<COutput> vAvailableCoins;
|
||||
AvailableCoins(vAvailableCoins, true, coinControl, false, nCoinType, fUseInstantSend);
|
||||
int nInstantSendConfirmationsRequired = Params().GetConsensus().nInstantSendConfirmationsRequired;
|
||||
|
||||
nFeeRet = 0;
|
||||
if(nFeePay > 0) nFeeRet = nFeePay;
|
||||
@ -3526,7 +3529,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
|
||||
strFailReason = _("Insufficient funds.");
|
||||
if (fUseInstantSend) {
|
||||
// could be not true but most likely that's the reason
|
||||
strFailReason += " " + strprintf(_("InstantSend requires inputs with at least %d confirmations, you might need to wait a few minutes and try again."), INSTANTSEND_CONFIRMATIONS_REQUIRED);
|
||||
strFailReason += " " + strprintf(_("InstantSend requires inputs with at least %d confirmations, you might need to wait a few minutes and try again."), nInstantSendConfirmationsRequired);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user