Transactions

比特幣核心的硬幣選擇如何防止變化成為灰塵輸出?

  • October 19, 2016

Bitcoin Core 的硬幣選擇優化了最小的零錢輸出。比特幣核心如何防止發生低於灰塵門檻值的更改輸出?

看到這些行

// We do not move dust-change to fees, because the sender would end up paying more than requested.
// This would be against the purpose of the all-inclusive feature.
// So instead we raise the change and deduct from the recipient.
if (nSubtractFeeFromAmount > 0 && newTxOut.IsDust(::minRelayTxFee))
{
   CAmount nDust = newTxOut.GetDustThreshold(::minRelayTxFee) - newTxOut.nValue;
   newTxOut.nValue += nDust; // raise change until no more dust
   for (unsigned int i = 0; i < vecSend.size(); i++) // subtract from first recipient
   {
       if (vecSend[i].fSubtractFeeFromAmount)
       {
           txNew.vout[i].nValue -= nDust;
           if (txNew.vout[i].IsDust(::minRelayTxFee))
           {
               strFailReason = _("The transaction amount is too small to send after the fee has been deducted");
               return false;
           }
           break;
       }
   }
}

因此,在粉塵變化輸出的情況下,比特幣核心將給予接受者略少,而不是花費比付款人最初要求的更多。

引用自:https://bitcoin.stackexchange.com/questions/39344