Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletmodel.cpp
Show First 20 Lines • Show All 548 Lines • ▼ Show 20 Lines | bool WalletModel::getPrivKey(const CKeyID &address, CKey &vchPrivKeyOut) const { | ||||
return wallet->GetKey(address, vchPrivKeyOut); | return wallet->GetKey(address, vchPrivKeyOut); | ||||
} | } | ||||
// returns a list of COutputs from COutPoints | // returns a list of COutputs from COutPoints | ||||
void WalletModel::getOutputs(const std::vector<COutPoint> &vOutpoints, | void WalletModel::getOutputs(const std::vector<COutPoint> &vOutpoints, | ||||
std::vector<COutput> &vOutputs) { | std::vector<COutput> &vOutputs) { | ||||
LOCK2(cs_main, wallet->cs_wallet); | LOCK2(cs_main, wallet->cs_wallet); | ||||
for (const COutPoint &outpoint : vOutpoints) { | for (const COutPoint &outpoint : vOutpoints) { | ||||
if (!wallet->mapWallet.count(outpoint.GetTxId())) { | auto it = wallet->mapWallet.find(outpoint.GetTxId()); | ||||
if (it == wallet->mapWallet.end()) { | |||||
continue; | continue; | ||||
} | } | ||||
int nDepth = | int nDepth = it->second.GetDepthInMainChain(); | ||||
wallet->mapWallet.at(outpoint.GetTxId()).GetDepthInMainChain(); | |||||
if (nDepth < 0) { | if (nDepth < 0) { | ||||
continue; | continue; | ||||
} | } | ||||
COutput out(&wallet->mapWallet.at(outpoint.GetTxId()), outpoint.GetN(), | COutput out(&it->second, outpoint.GetN(), nDepth, true /* spendable */, | ||||
nDepth, true /* spendable */, true /* solvable */, | true /* solvable */, true /* safe */); | ||||
true /* safe */); | |||||
vOutputs.push_back(out); | vOutputs.push_back(out); | ||||
} | } | ||||
} | } | ||||
bool WalletModel::isSpent(const COutPoint &outpoint) const { | bool WalletModel::isSpent(const COutPoint &outpoint) const { | ||||
LOCK2(cs_main, wallet->cs_wallet); | LOCK2(cs_main, wallet->cs_wallet); | ||||
return wallet->IsSpent(outpoint.GetTxId(), outpoint.GetN()); | return wallet->IsSpent(outpoint.GetTxId(), outpoint.GetN()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |