Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletmodel.cpp
Show First 20 Lines • Show All 447 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void WalletModel::UnlockContext::CopyFrom(const UnlockContext &rhs) { | void WalletModel::UnlockContext::CopyFrom(const UnlockContext &rhs) { | ||||
// Transfer context; old object no longer relocks wallet | // Transfer context; old object no longer relocks wallet | ||||
*this = rhs; | *this = rhs; | ||||
rhs.relock = false; | rhs.relock = false; | ||||
} | } | ||||
// returns a list of COutputs from COutPoints | |||||
void WalletModel::getOutputs(const std::vector<COutPoint> &vOutpoints, | |||||
std::vector<COutput> &vOutputs) { | |||||
LOCK2(cs_main, cwallet->cs_wallet); | |||||
for (const COutPoint &outpoint : vOutpoints) { | |||||
auto it = cwallet->mapWallet.find(outpoint.GetTxId()); | |||||
if (it == cwallet->mapWallet.end()) { | |||||
continue; | |||||
} | |||||
int nDepth = it->second.GetDepthInMainChain(); | |||||
if (nDepth < 0) { | |||||
continue; | |||||
} | |||||
COutput out(&it->second, outpoint.GetN(), nDepth, true /* spendable */, | |||||
true /* solvable */, true /* safe */); | |||||
vOutputs.push_back(out); | |||||
} | |||||
} | |||||
bool WalletModel::isSpent(const COutPoint &outpoint) const { | |||||
LOCK2(cs_main, cwallet->cs_wallet); | |||||
return cwallet->IsSpent(outpoint.GetTxId(), outpoint.GetN()); | |||||
} | |||||
// 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 { | |||||
for (auto &group : cwallet->ListCoins()) { | |||||
auto &resultGroup = | |||||
mapCoins[QString::fromStdString(EncodeDestination(group.first))]; | |||||
for (auto &coin : group.second) { | |||||
resultGroup.emplace_back(std::move(coin)); | |||||
} | |||||
} | |||||
} | |||||
void WalletModel::loadReceiveRequests( | void WalletModel::loadReceiveRequests( | ||||
std::vector<std::string> &vReceiveRequests) { | std::vector<std::string> &vReceiveRequests) { | ||||
// receive request | // receive request | ||||
vReceiveRequests = m_wallet->getDestValues("rr"); | vReceiveRequests = m_wallet->getDestValues("rr"); | ||||
} | } | ||||
bool WalletModel::saveReceiveRequest(const std::string &sAddress, | bool WalletModel::saveReceiveRequest(const std::string &sAddress, | ||||
const int64_t nId, | const int64_t nId, | ||||
Show All 27 Lines |