MCPcopy Create free account
hub / github.com/ElementsProject/elements / CalculateMaximumSignedTxSize

Function CalculateMaximumSignedTxSize

src/wallet/spend.cpp:168–183  ·  view source on GitHub ↗

txouts needs to be in the order of tx.vin

Source from the content-addressed store, hash-verified

166
167// txouts needs to be in the order of tx.vin
168TxSize CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, const std::vector<CTxOut>& txouts, const CCoinControl* coin_control)
169{
170 CMutableTransaction txNew(tx);
171 if (!wallet->DummySignTx(txNew, txouts, coin_control)) {
172 return TxSize{-1, -1};
173 }
174 CTransaction ctx(txNew);
175 int64_t vsize = GetVirtualTransactionSize(ctx);
176 int64_t weight = GetTransactionWeight(ctx);
177 // ELEMENTS: use discounted vsize for CTs if enabled
178 if (Params().GetCreateDiscountCT()) {
179 vsize = GetDiscountVirtualTransactionSize(ctx);
180 }
181
182 return TxSize{vsize, weight};
183}
184
185void AvailableCoins(const CWallet& wallet, std::vector<COutput> &vCoins, const CCoinControl *coinControl, const CAmount &nMinimumAmount, const CAmount &nMaximumAmount, const CAmount &nMinimumSumAmount, const uint64_t nMaximumCount, const CAsset* asset_filter) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
186{

Callers 2

spend.cppFile · 0.85

Calls 6

GetTransactionWeightFunction · 0.85
GetCreateDiscountCTMethod · 0.80
ParamsClass · 0.50
DummySignTxMethod · 0.45

Tested by

no test coverage detected