Skip to content

Commit 32eb6dc

Browse files
committed
[refactor] assign local variable for wtxid
1 parent 18820cc commit 32eb6dc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/node/txdownloadman_impl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,16 @@ bool TxDownloadManagerImpl::AddTxAnnouncement(NodeId peer, const GenTxid& gtxid,
179179
// - exists in orphanage
180180
// - peer can be an orphan resolution candidate
181181
if (gtxid.IsWtxid()) {
182-
if (auto orphan_tx{m_orphanage.GetTx(Wtxid::FromUint256(gtxid.GetHash()))}) {
182+
const auto wtxid{Wtxid::FromUint256(gtxid.GetHash())};
183+
if (auto orphan_tx{m_orphanage.GetTx(wtxid)}) {
183184
auto unique_parents{GetUniqueParents(*orphan_tx)};
184185
std::erase_if(unique_parents, [&](const auto& txid){
185186
return AlreadyHaveTx(GenTxid::Txid(txid), /*include_reconsiderable=*/false);
186187
});
187188

188189
if (unique_parents.empty()) return true;
189190

190-
if (MaybeAddOrphanResolutionCandidate(unique_parents, orphan_tx->GetWitnessHash(), peer, now)) {
191+
if (MaybeAddOrphanResolutionCandidate(unique_parents, wtxid, peer, now)) {
191192
m_orphanage.AddAnnouncer(orphan_tx->GetWitnessHash(), peer);
192193
}
193194

0 commit comments

Comments
 (0)