diff options
author | Gregory Maxwell <greg@xiph.org> | 2013-01-21 16:30:34 -0800 |
---|---|---|
committer | Gregory Maxwell <greg@xiph.org> | 2013-01-21 16:30:34 -0800 |
commit | d40c164369ef4df7c37e8c25a0fa6955a4dbcbb1 (patch) | |
tree | 6d4037d6980930e976061e199cd23c5f3b706dcf /src | |
parent | ea0a2b18f2ef03ea91b52b0fec58c5e24b840d91 (diff) | |
parent | a3fad2119bcf4638ed137fc5cddc2f34a3bd1dc2 (diff) |
Merge pull request #1872 from gmaxwell/listaddrnotmine
In listaddressgroupings push down the IsMine check to run on each input.
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet.cpp | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp index f49bfb5f8f..8b2f03212a 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1636,29 +1636,38 @@ set< set<CTxDestination> > CWallet::GetAddressGroupings() { CWalletTx *pcoin = &walletEntry.second; - if (pcoin->vin.size() > 0 && IsMine(pcoin->vin[0])) + if (pcoin->vin.size() > 0) { + bool any_mine = false; // group all input addresses with each other BOOST_FOREACH(CTxIn txin, pcoin->vin) { CTxDestination address; + if(!IsMine(txin)) /* If this input isn't mine, ignore it */ + continue; if(!ExtractDestination(mapWallet[txin.prevout.hash].vout[txin.prevout.n].scriptPubKey, address)) continue; grouping.insert(address); + any_mine = true; } // group change with input addresses - BOOST_FOREACH(CTxOut txout, pcoin->vout) - if (IsChange(txout)) - { - CWalletTx tx = mapWallet[pcoin->vin[0].prevout.hash]; - CTxDestination txoutAddr; - if(!ExtractDestination(txout.scriptPubKey, txoutAddr)) - continue; - grouping.insert(txoutAddr); - } - groupings.insert(grouping); - grouping.clear(); + if (any_mine) + { + BOOST_FOREACH(CTxOut txout, pcoin->vout) + if (IsChange(txout)) + { + CTxDestination txoutAddr; + if(!ExtractDestination(txout.scriptPubKey, txoutAddr)) + continue; + grouping.insert(txoutAddr); + } + } + if (grouping.size() > 0) + { + groupings.insert(grouping); + grouping.clear(); + } } // group lone addrs by themselves |