Skip to content

Commit 2a97d2b

Browse files
committed
Merge #17553: wallet: Remove out of date comments for CalculateMaximumSignedTxSize
6a2e6b0 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 6a2e6b0 darosior: ACK 6a2e6b0 Tree-SHA512: ad4c26fd2409eb5aed19d67c19cb5479d226bd11e9298630309c4344f6562ace2e10c2850ebe22770331d71e91320a606e79619b9fe52dd478ce1f589a740122
2 parents 7127c31 + 6a2e6b0 commit 2a97d2b

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/wallet/wallet.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,11 +1448,9 @@ bool CWallet::ImportScriptPubKeys(const std::string& label, const std::set<CScri
14481448
int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, bool use_max_sig)
14491449
{
14501450
std::vector<CTxOut> txouts;
1451-
// Look up the inputs. We should have already checked that this transaction
1452-
// IsAllFromMe(ISMINE_SPENDABLE), so every input should already be in our
1453-
// wallet, with a valid index into the vout array, and the ability to sign.
14541451
for (const CTxIn& input : tx.vin) {
14551452
const auto mi = wallet->mapWallet.find(input.prevout.hash);
1453+
// Can not estimate size without knowing the input details
14561454
if (mi == wallet->mapWallet.end()) {
14571455
return -1;
14581456
}
@@ -1467,8 +1465,6 @@ int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wall
14671465
{
14681466
CMutableTransaction txNew(tx);
14691467
if (!wallet->DummySignTx(txNew, txouts, use_max_sig)) {
1470-
// This should never happen, because IsAllFromMe(ISMINE_SPENDABLE)
1471-
// implies that we can sign for every input.
14721468
return -1;
14731469
}
14741470
return GetVirtualTransactionSize(CTransaction(txNew));

0 commit comments

Comments
 (0)