From 57ec1c97b2d0c0ba6056a43fa4177efc39567ae2 Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Mon, 30 Jul 2018 10:43:16 -0400 Subject: [PATCH] [wallet] correctly limit output group size --- src/wallet/wallet.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 4918100b300..ebf09a951ab 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4423,7 +4423,10 @@ std::vector CWallet::GroupOutputs(const std::vector& outpu size_t ancestors, descendants; mempool.GetTransactionAncestry(output.tx->GetHash(), ancestors, descendants); if (!single_coin && ExtractDestination(output.tx->tx->vout[output.i].scriptPubKey, dst)) { - if (gmap.count(dst) == 10) { + // Limit output groups to no more than 10 entries, to protect + // against inadvertently creating a too-large transaction + // when using -avoidpartialspends + if (gmap[dst].m_outputs.size() >= 10) { groups.push_back(gmap[dst]); gmap.erase(dst); }