aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2018-07-30 10:43:16 -0400
committerSuhas Daftuar <sdaftuar@gmail.com>2018-07-30 10:43:16 -0400
commit57ec1c97b2d0c0ba6056a43fa4177efc39567ae2 (patch)
tree137303f466d826baa20969b08589510204a23b9a /src/wallet
parent222e627322ce4de3292259a4868d23983f2a5394 (diff)
downloadbitcoin-57ec1c97b2d0c0ba6056a43fa4177efc39567ae2.tar.xz
[wallet] correctly limit output group size
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 4918100b30..ebf09a951a 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -4423,7 +4423,10 @@ std::vector<OutputGroup> CWallet::GroupOutputs(const std::vector<COutput>& 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);
}