@@ -52,9 +52,7 @@ int CalculateMaximumSignedInputSize(const CTxOut& txout, const CWallet* wallet,
52
52
TxSize CalculateMaximumSignedTxSize (const CTransaction &tx, const CWallet *wallet, const std::vector<CTxOut>& txouts, const CCoinControl* coin_control)
53
53
{
54
54
CMutableTransaction txNew (tx);
55
- if (!wallet->DummySignTx (txNew, txouts, coin_control)) {
56
- return TxSize{-1 , -1 };
57
- }
55
+ if (!wallet->DummySignTx (txNew, txouts, coin_control)) return TxSize{-1 , -1 };
58
56
CTransaction ctx (txNew);
59
57
int64_t vsize = GetVirtualTransactionSize (ctx);
60
58
int64_t weight = GetTransactionWeight (ctx);
@@ -72,11 +70,9 @@ TxSize CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *walle
72
70
assert (input.prevout .n < mi->second .tx ->vout .size ());
73
71
txouts.emplace_back (mi->second .tx ->vout .at (input.prevout .n ));
74
72
} else if (coin_control) {
75
- CTxOut txout;
76
- if (!coin_control->GetExternalOutput (input.prevout , txout)) {
77
- return TxSize{-1 , -1 };
78
- }
79
- txouts.emplace_back (txout);
73
+ const auto & txout{coin_control->GetExternalOutput (input.prevout )};
74
+ if (!txout) return TxSize{-1 , -1 };
75
+ txouts.emplace_back (*txout);
80
76
} else {
81
77
return TxSize{-1 , -1 };
82
78
}
@@ -178,9 +174,12 @@ util::Result<PreSelectedInputs> FetchSelectedInputs(const CWallet& wallet, const
178
174
input_bytes = CalculateMaximumSignedInputSize (txout, &wallet, &coin_control);
179
175
} else {
180
176
// The input is external. We did not find the tx in mapWallet.
181
- if (!coin_control.GetExternalOutput (outpoint, txout)) {
177
+ const auto out{coin_control.GetExternalOutput (outpoint)};
178
+ if (!out) {
182
179
return util::Error{strprintf (_ (" Not found pre-selected input %s" ), outpoint.ToString ())};
183
180
}
181
+
182
+ txout = *out;
184
183
}
185
184
186
185
if (input_bytes == -1 ) {
0 commit comments