mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Merge #16128: Delete error-prone CScript constructor only used with FindAndDelete
e1a55690e6Delete error-prone CScript constructor (Gregory Sanders) Pull request description: The behavior of this constructor is not the expected behavior compared to the other constructors which directly interpret the vector as a CScript, rather than serialize it into a new CScript. It has only four uses in the entire codebase. Delete this constructor and replace its four uses with the more clear serialization construction. ACKs for top commit: Empact: ACKe1a55690e6sipa: Concept and code review ACKe1a55690e6, but I'd like to make sure we have tests covering the FindAndDelete usage. Tree-SHA512: b6721e343c867ca401a80ec87c25939d7f1fc798f3bf7e5feb0ea6f8280eecb6bd65afc8286912c76ff8119ccea50ad7726b1a4137cae70c9d4fed7d960e10d3
This commit is contained in:
@@ -418,7 +418,8 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
||||
|
||||
if (amount > 0)
|
||||
{
|
||||
CTxOut txout(amount, static_cast<CScript>(std::vector<unsigned char>(24, 0)));
|
||||
// Assumes a p2pkh script size
|
||||
CTxOut txout(amount, CScript() << std::vector<unsigned char>(24, 0));
|
||||
txDummy.vout.push_back(txout);
|
||||
fDust |= IsDust(txout, model->node().getDustRelayFee());
|
||||
}
|
||||
@@ -509,7 +510,8 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
||||
// Never create dust outputs; if we would, just add the dust to the fee.
|
||||
if (nChange > 0 && nChange < MIN_CHANGE)
|
||||
{
|
||||
CTxOut txout(nChange, static_cast<CScript>(std::vector<unsigned char>(24, 0)));
|
||||
// Assumes a p2pkh script size
|
||||
CTxOut txout(nChange, CScript() << std::vector<unsigned char>(24, 0));
|
||||
if (IsDust(txout, model->node().getDustRelayFee()))
|
||||
{
|
||||
nPayFee += nChange;
|
||||
|
||||
Reference in New Issue
Block a user