Merge #17553: wallet: Remove out of date comments for CalculateMaximumSignedTxSize

6a2e6b0600 Remove out of date comments for CalculateMaximumSignedTxSize (Gregory Sanders)

Pull request description:

  These paths can be hit for probably a number of reasons, and ISMINE spendability is not a requirement to call it.

  For example: During watch-only transaction creation, previous transaction in wallet, pubkey imported, but not the witnessscript associated with the prevout.

  In this case I think no/minimal comment is better than specific and soon to be out of date.

ACKs for top commit:
  achow101:
    ACK 6a2e6b0600
  darosior:
    ACK 6a2e6b0600

Tree-SHA512: ad4c26fd2409eb5aed19d67c19cb5479d226bd11e9298630309c4344f6562ace2e10c2850ebe22770331d71e91320a606e79619b9fe52dd478ce1f589a740122
This commit is contained in:
Samuel Dobson 2019-11-23 09:33:31 +13:00
commit 2a97d2b1a5
No known key found for this signature in database
GPG key ID: D300116E1C875A3D

View file

@ -1448,11 +1448,9 @@ bool CWallet::ImportScriptPubKeys(const std::string& label, const std::set<CScri
int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, bool use_max_sig)
{
std::vector<CTxOut> txouts;
// Look up the inputs. We should have already checked that this transaction
// IsAllFromMe(ISMINE_SPENDABLE), so every input should already be in our
// wallet, with a valid index into the vout array, and the ability to sign.
for (const CTxIn& input : tx.vin) {
const auto mi = wallet->mapWallet.find(input.prevout.hash);
// Can not estimate size without knowing the input details
if (mi == wallet->mapWallet.end()) {
return -1;
}
@ -1467,8 +1465,6 @@ int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wall
{
CMutableTransaction txNew(tx);
if (!wallet->DummySignTx(txNew, txouts, use_max_sig)) {
// This should never happen, because IsAllFromMe(ISMINE_SPENDABLE)
// implies that we can sign for every input.
return -1;
}
return GetVirtualTransactionSize(CTransaction(txNew));