src/qt/walletmodel.cpp
void WalletModel::listCoins(std::map<QString, std::vector<COutput> >& mapCoins) const
{
    std::vector<COutput> vCoins;
    wallet->AvailableCoins(vCoins);
    std::vector<COutPoint> vLockedCoins;

    // add locked coins
    BOOST_FOREACH(const COutPoint& outpoint, vLockedCoins)
    {
        if (!wallet->mapWallet.count(outpoint.hash)) continue;
        int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain();
        if (nDepth < 0) continue;
        COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth);
        vCoins.push_back(out);
    }

    BOOST_FOREACH(const COutput& out, vCoins)
    {
        COutput cout = out;

        while (wallet->IsChange(cout.tx->vout[cout.i]) && cout.tx->vin.size() > 0 && wallet->IsMine(cout.tx->vin[0]))
        {
            if (!wallet->mapWallet.count(cout.tx->vin[0].prevout.hash)) break;
            cout = COutput(&wallet->mapWallet[cout.tx->vin[0].prevout.hash], cout.tx->vin[0].prevout.n, 0);
        }

        CTxDestination address;
        if(!ExtractDestination(cout.tx->vout[cout.i].scriptPubKey, address)) continue;
        mapCoins[CTrianglesAddress(address).ToString().c_str()].push_back(out);
    }
}
// AvailableCoins + LockedCoins grouped by wallet address (put change in one group with wallet address) 
AvailableCoins + LockedCoins grouped by wallet address (put change in one group with wallet address)
AvailableCoins + LockedCoins grouped by wallet address ( put change in one group with wallet address )
void WalletModel::listCoins(std::map<QString, std::vector<COutput> >& mapCoins) const
{
    std::vector<COutput> vCoins;
    wallet->AvailableCoins(vCoins);
    std::vector<COutPoint> vLockedCoins;
    BOOST_FOREACH(const COutPoint& outpoint, vLockedCoins)
    {
        if (!wallet->mapWallet.count(outpoint.hash)) continue;
        int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain();
        if (nDepth < 0) continue;
        COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth);
        vCoins.push_back(out);
    }
    BOOST_FOREACH(const COutput& out, vCoins)
    {
        COutput cout = out;
        while (wallet->IsChange(cout.tx->vout[cout.i]) && cout.tx->vin.size() > 0 && wallet->IsMine(cout.tx->vin[0]))
        {
            if (!wallet->mapWallet.count(cout.tx->vin[0].prevout.hash)) break;
            cout = COutput(&wallet->mapWallet[cout.tx->vin[0].prevout.hash], cout.tx->vin[0].prevout.n, 0);
        }
        CTxDestination address;
        if(!ExtractDestination(cout.tx->vout[cout.i].scriptPubKey, address)) continue;
        mapCoins[CTrianglesAddress(address).ToString().c_str()].push_back(out);
    }
}
void WalletModel :: listCoins ( std :: map < QString , std :: vector < COutput > > & mapCoins ) const { std :: vector < COutput > vCoins ; wallet -> AvailableCoins ( vCoins ) ; std :: vector < COutPoint > vLockedCoins ; BOOST_FOREACH ( const COutPoint & outpoint , vLockedCoins ) { if ( ! wallet -> mapWallet . count ( outpoint . hash ) ) continue ; int nDepth = wallet -> mapWallet [ outpoint . hash ] . GetDepthInMainChain ( ) ; if ( nDepth < 0 ) continue ; COutput out ( & wallet -> mapWallet [ outpoint . hash ] , outpoint . n , nDepth ) ; vCoins . push_back ( out ) ; } BOOST_FOREACH ( const COutput & out , vCoins ) { COutput cout = out ; while ( wallet -> IsChange ( cout . tx -> vout [ cout . i ] ) && cout . tx -> vin . size ( ) > 0 && wallet -> IsMine ( cout . tx -> vin [ 0 ] ) ) { if ( ! wallet -> mapWallet . count ( cout . tx -> vin [ 0 ] . prevout . hash ) ) break ; cout = COutput ( & wallet -> mapWallet [ cout . tx -> vin [ 0 ] . prevout . hash ] , cout . tx -> vin [ 0 ] . prevout . n , 0 ) ; } CTxDestination address ; if ( ! ExtractDestination ( cout . tx -> vout [ cout . i ] . scriptPubKey , address ) ) continue ; mapCoins [ CTrianglesAddress ( address ) . ToString ( ) . c_str ( ) ] . push_back ( out ) ; } }
AvailableCoins + LockedCoins grouped by wallet address (put change in one group with wallet address)
AvailableCoins + LockedCoins grouped by wallet address ( put change in one group with wallet address )
// add locked coins