mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge bitcoin/bitcoin#22358: Remove unused wallet pointer from wallet signals
8888cf45f5e45b38cb830f9c94cafbf622e1fe5f Remove unused wallet pointer from NotifyAddressBookChanged (MarcoFalke)
faf36403038afb3df3ddd963bd6c352d3eff4da8 Remove unused wallet pointer from NotifyTransactionChanged signal (MarcoFalke)
Pull request description:
The signals are members of the wallet, so passing the pointer would be redundant even if it was used.
Also, fix `with` -> `without`, which was forgotten in commit ca4cf5cff6
.
ACKs for top commit:
jonatack:
Code review ACK 8888cf45f5e45b38cb830f9c94cafbf622e1fe5f also verified with/without lock cs_wallet status for each of the two functions and debian clang 11 debug build clean
promag:
Code review ACK 8888cf45f5e45b38cb830f9c94cafbf622e1fe5f.
theStack:
Code review ACK 8888cf45f5e45b38cb830f9c94cafbf622e1fe5f
Tree-SHA512: e3b80931ce9bcb05213619f5435ac7c21d3c7848643950a70db610902bd1803c92bb75e501d46b0e519bc576901f160e088e8882c4f1adce892a80df565f897b
This commit is contained in:
parent
9a1500ab47
commit
240d8efb82
@ -64,7 +64,7 @@ uint256 SendCoins(CWallet& wallet, SendCoinsDialog& sendCoinsDialog, const CTxDe
|
|||||||
entry->findChild<QValidatedLineEdit*>("payTo")->setText(QString::fromStdString(EncodeDestination(address)));
|
entry->findChild<QValidatedLineEdit*>("payTo")->setText(QString::fromStdString(EncodeDestination(address)));
|
||||||
entry->findChild<BitcoinAmountField*>("payAmount")->setValue(amount);
|
entry->findChild<BitcoinAmountField*>("payAmount")->setValue(amount);
|
||||||
uint256 txid;
|
uint256 txid;
|
||||||
boost::signals2::scoped_connection c(wallet.NotifyTransactionChanged.connect([&txid](CWallet*, const uint256& hash, ChangeType status) {
|
boost::signals2::scoped_connection c(wallet.NotifyTransactionChanged.connect([&txid](const uint256& hash, ChangeType status) {
|
||||||
if (status == CT_NEW) txid = hash;
|
if (status == CT_NEW) txid = hash;
|
||||||
}));
|
}));
|
||||||
ConfirmSend();
|
ConfirmSend();
|
||||||
|
@ -524,13 +524,13 @@ public:
|
|||||||
std::unique_ptr<Handler> handleAddressBookChanged(AddressBookChangedFn fn) override
|
std::unique_ptr<Handler> handleAddressBookChanged(AddressBookChangedFn fn) override
|
||||||
{
|
{
|
||||||
return MakeHandler(m_wallet->NotifyAddressBookChanged.connect(
|
return MakeHandler(m_wallet->NotifyAddressBookChanged.connect(
|
||||||
[fn](CWallet*, const CTxDestination& address, const std::string& label, bool is_mine,
|
[fn](const CTxDestination& address, const std::string& label, bool is_mine,
|
||||||
const std::string& purpose, ChangeType status) { fn(address, label, is_mine, purpose, status); }));
|
const std::string& purpose, ChangeType status) { fn(address, label, is_mine, purpose, status); }));
|
||||||
}
|
}
|
||||||
std::unique_ptr<Handler> handleTransactionChanged(TransactionChangedFn fn) override
|
std::unique_ptr<Handler> handleTransactionChanged(TransactionChangedFn fn) override
|
||||||
{
|
{
|
||||||
return MakeHandler(m_wallet->NotifyTransactionChanged.connect(
|
return MakeHandler(m_wallet->NotifyTransactionChanged.connect(
|
||||||
[fn](CWallet*, const uint256& txid, ChangeType status) { fn(txid, status); }));
|
[fn](const uint256& txid, ChangeType status) { fn(txid, status); }));
|
||||||
}
|
}
|
||||||
std::unique_ptr<Handler> handleInstantLockReceived(InstantLockReceivedFn fn) override
|
std::unique_ptr<Handler> handleInstantLockReceived(InstantLockReceivedFn fn) override
|
||||||
{
|
{
|
||||||
|
@ -918,7 +918,7 @@ CWalletTx* CWallet::AddToWallet(CTransactionRef tx, const CWalletTx::Confirmatio
|
|||||||
wtx.MarkDirty();
|
wtx.MarkDirty();
|
||||||
|
|
||||||
// Notify UI of new or updated transaction
|
// Notify UI of new or updated transaction
|
||||||
NotifyTransactionChanged(this, hash, fInsertedNew ? CT_NEW : CT_UPDATED);
|
NotifyTransactionChanged(hash, fInsertedNew ? CT_NEW : CT_UPDATED);
|
||||||
|
|
||||||
#if HAVE_SYSTEM
|
#if HAVE_SYSTEM
|
||||||
// notify an external script when a wallet transaction comes in or is updated
|
// notify an external script when a wallet transaction comes in or is updated
|
||||||
@ -1101,7 +1101,7 @@ bool CWallet::AbandonTransaction(const uint256& hashTx)
|
|||||||
wtx.setAbandoned();
|
wtx.setAbandoned();
|
||||||
wtx.MarkDirty();
|
wtx.MarkDirty();
|
||||||
batch.WriteTx(wtx);
|
batch.WriteTx(wtx);
|
||||||
NotifyTransactionChanged(this, wtx.GetHash(), CT_UPDATED);
|
NotifyTransactionChanged(wtx.GetHash(), CT_UPDATED);
|
||||||
// Iterate over all its outputs, and mark transactions in the wallet that spend them abandoned too
|
// Iterate over all its outputs, and mark transactions in the wallet that spend them abandoned too
|
||||||
TxSpends::const_iterator iter = mapTxSpends.lower_bound(COutPoint(now, 0));
|
TxSpends::const_iterator iter = mapTxSpends.lower_bound(COutPoint(now, 0));
|
||||||
while (iter != mapTxSpends.end() && iter->first.hash == now) {
|
while (iter != mapTxSpends.end() && iter->first.hash == now) {
|
||||||
@ -3804,7 +3804,7 @@ void CWallet::CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::ve
|
|||||||
|
|
||||||
CWalletTx &coin = mapWallet.at(txin.prevout.hash);
|
CWalletTx &coin = mapWallet.at(txin.prevout.hash);
|
||||||
coin.MarkDirty();
|
coin.MarkDirty();
|
||||||
NotifyTransactionChanged(this, txin.prevout.hash, CT_UPDATED);
|
NotifyTransactionChanged(txin.prevout.hash, CT_UPDATED);
|
||||||
updated_hahes.insert(txin.prevout.hash);
|
updated_hahes.insert(txin.prevout.hash);
|
||||||
}
|
}
|
||||||
// Get the inserted-CWalletTx from mapWallet so that the
|
// Get the inserted-CWalletTx from mapWallet so that the
|
||||||
@ -3901,7 +3901,7 @@ DBErrors CWallet::ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256
|
|||||||
for (const auto& txin : it->second.tx->vin)
|
for (const auto& txin : it->second.tx->vin)
|
||||||
mapTxSpends.erase(txin.prevout);
|
mapTxSpends.erase(txin.prevout);
|
||||||
mapWallet.erase(it);
|
mapWallet.erase(it);
|
||||||
NotifyTransactionChanged(this, hash, CT_DELETED);
|
NotifyTransactionChanged(hash, CT_DELETED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nZapSelectTxRet == DBErrors::NEED_REWRITE)
|
if (nZapSelectTxRet == DBErrors::NEED_REWRITE)
|
||||||
@ -3936,8 +3936,8 @@ bool CWallet::SetAddressBookWithDB(WalletBatch& batch, const CTxDestination& add
|
|||||||
m_address_book[address].purpose = strPurpose;
|
m_address_book[address].purpose = strPurpose;
|
||||||
is_mine = IsMine(address) != ISMINE_NO;
|
is_mine = IsMine(address) != ISMINE_NO;
|
||||||
}
|
}
|
||||||
NotifyAddressBookChanged(this, address, strName, is_mine,
|
NotifyAddressBookChanged(address, strName, is_mine,
|
||||||
strPurpose, (fUpdated ? CT_UPDATED : CT_NEW) );
|
strPurpose, (fUpdated ? CT_UPDATED : CT_NEW));
|
||||||
if (!strPurpose.empty() && !batch.WritePurpose(EncodeDestination(address), strPurpose))
|
if (!strPurpose.empty() && !batch.WritePurpose(EncodeDestination(address), strPurpose))
|
||||||
return false;
|
return false;
|
||||||
return batch.WriteName(EncodeDestination(address), strName);
|
return batch.WriteName(EncodeDestination(address), strName);
|
||||||
@ -3972,7 +3972,7 @@ bool CWallet::DelAddressBook(const CTxDestination& address)
|
|||||||
is_mine = IsMine(address) != ISMINE_NO;
|
is_mine = IsMine(address) != ISMINE_NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifyAddressBookChanged(this, address, "", is_mine, "", CT_DELETED);
|
NotifyAddressBookChanged(address, "", is_mine, "", CT_DELETED);
|
||||||
|
|
||||||
batch.ErasePurpose(EncodeDestination(address));
|
batch.ErasePurpose(EncodeDestination(address));
|
||||||
return batch.EraseName(EncodeDestination(address));
|
return batch.EraseName(EncodeDestination(address));
|
||||||
@ -5156,7 +5156,7 @@ void CWallet::notifyTransactionLock(const CTransactionRef &tx, const std::shared
|
|||||||
uint256 txHash = tx->GetHash();
|
uint256 txHash = tx->GetHash();
|
||||||
std::map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(txHash);
|
std::map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(txHash);
|
||||||
if (mi != mapWallet.end()){
|
if (mi != mapWallet.end()){
|
||||||
NotifyTransactionChanged(this, txHash, CT_UPDATED);
|
NotifyTransactionChanged(txHash, CT_UPDATED);
|
||||||
NotifyISLockReceived();
|
NotifyISLockReceived();
|
||||||
#if HAVE_SYSTEM
|
#if HAVE_SYSTEM
|
||||||
// notify an external script
|
// notify an external script
|
||||||
|
@ -1223,19 +1223,18 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Address book entry changed.
|
* Address book entry changed.
|
||||||
* @note called with lock cs_wallet held.
|
* @note called without lock cs_wallet held.
|
||||||
*/
|
*/
|
||||||
boost::signals2::signal<void (CWallet *wallet, const CTxDestination
|
boost::signals2::signal<void(const CTxDestination& address,
|
||||||
&address, const std::string &label, bool isMine,
|
const std::string& label, bool isMine,
|
||||||
const std::string &purpose,
|
const std::string& purpose, ChangeType status)>
|
||||||
ChangeType status)> NotifyAddressBookChanged;
|
NotifyAddressBookChanged;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wallet transaction added, removed or updated.
|
* Wallet transaction added, removed or updated.
|
||||||
* @note called with lock cs_wallet held.
|
* @note called with lock cs_wallet held.
|
||||||
*/
|
*/
|
||||||
boost::signals2::signal<void (CWallet *wallet, const uint256 &hashTx,
|
boost::signals2::signal<void(const uint256& hashTx, ChangeType status)> NotifyTransactionChanged;
|
||||||
ChangeType status)> NotifyTransactionChanged;
|
|
||||||
|
|
||||||
/** Show progress e.g. for rescan */
|
/** Show progress e.g. for rescan */
|
||||||
boost::signals2::signal<void (const std::string &title, int nProgress)> ShowProgress;
|
boost::signals2::signal<void (const std::string &title, int nProgress)> ShowProgress;
|
||||||
|
Loading…
Reference in New Issue
Block a user