Skip to content

Commit 57ec1c9

Browse files
committed
[wallet] correctly limit output group size
1 parent 222e627 commit 57ec1c9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/wallet/wallet.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4423,7 +4423,10 @@ std::vector<OutputGroup> CWallet::GroupOutputs(const std::vector<COutput>& outpu
44234423
size_t ancestors, descendants;
44244424
mempool.GetTransactionAncestry(output.tx->GetHash(), ancestors, descendants);
44254425
if (!single_coin && ExtractDestination(output.tx->tx->vout[output.i].scriptPubKey, dst)) {
4426-
if (gmap.count(dst) == 10) {
4426+
// Limit output groups to no more than 10 entries, to protect
4427+
// against inadvertently creating a too-large transaction
4428+
// when using -avoidpartialspends
4429+
if (gmap[dst].m_outputs.size() >= 10) {
44274430
groups.push_back(gmap[dst]);
44284431
gmap.erase(dst);
44294432
}

0 commit comments

Comments
 (0)