txgraph: drop move assignment operator
This commit is contained in:
1 parent
5336bcd578
commit
ade0397f59
3 files changed
+5
-22
No files matched your search
@@ -138,19 +138,18 @@ struct SimTxGraph
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Add a new transaction to the simulation. */
|
/** Add a new transaction to the simulation. */
|
||||||
TxGraph::Ref* AddTransaction(const FeePerWeight& feerate)
|
void AddTransaction(TxGraph::Ref&& ref, const FeePerWeight& feerate)
|
||||||
{
|
{
|
||||||
assert(graph.TxCount() < MAX_TRANSACTIONS);
|
assert(graph.TxCount() < MAX_TRANSACTIONS);
|
||||||
auto simpos = graph.AddTransaction(feerate);
|
auto simpos = graph.AddTransaction(feerate);
|
||||||
real_is_optimal = false;
|
real_is_optimal = false;
|
||||||
MakeModified(simpos);
|
MakeModified(simpos);
|
||||||
assert(graph.Positions()[simpos]);
|
assert(graph.Positions()[simpos]);
|
||||||
simmap[simpos] = std::make_shared<TxGraph::Ref>();
|
simmap[simpos] = std::make_shared<TxGraph::Ref>(std::move(ref));
|
||||||
auto ptr = simmap[simpos].get();
|
auto ptr = simmap[simpos].get();
|
||||||
simrevmap[ptr] = simpos;
|
simrevmap[ptr] = simpos;
|
||||||
// This may invalidate our cached oversized value.
|
// This may invalidate our cached oversized value.
|
||||||
if (oversized.has_value() && !*oversized) oversized = std::nullopt;
|
if (oversized.has_value() && !*oversized) oversized = std::nullopt;
|
||||||
return ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add a dependency between two positions in this graph. */
|
/** Add a dependency between two positions in this graph. */
|
||||||
@@ -459,9 +458,7 @@ FUZZ_TARGET(txgraph)
|
|||||||
// Create a real TxGraph::Ref.
|
// Create a real TxGraph::Ref.
|
||||||
auto ref = real->AddTransaction(feerate);
|
auto ref = real->AddTransaction(feerate);
|
||||||
// Create a shared_ptr place in the simulation to put the Ref in.
|
// Create a shared_ptr place in the simulation to put the Ref in.
|
||||||
auto ref_loc = top_sim.AddTransaction(feerate);
|
top_sim.AddTransaction(std::move(ref), feerate);
|
||||||
// Move it in place.
|
|
||||||
*ref_loc = std::move(ref);
|
|
||||||
break;
|
break;
|
||||||
} else if ((block_builders.empty() || sims.size() > 1) && top_sim.GetTransactionCount() + top_sim.removed.size() > 1 && command-- == 0) {
|
} else if ((block_builders.empty() || sims.size() > 1) && top_sim.GetTransactionCount() + top_sim.removed.size() > 1 && command-- == 0) {
|
||||||
// AddDependency.
|
// AddDependency.
|
||||||
|
|||||||
@@ -3451,20 +3451,6 @@ TxGraph::Ref::~Ref()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TxGraph::Ref& TxGraph::Ref::operator=(Ref&& other) noexcept
|
|
||||||
{
|
|
||||||
// Unlink the current graph, if any.
|
|
||||||
if (m_graph) m_graph->UnlinkRef(m_index);
|
|
||||||
// Inform the other's graph about the move, if any.
|
|
||||||
if (other.m_graph) other.m_graph->UpdateRef(other.m_index, *this);
|
|
||||||
// Actually update the contents.
|
|
||||||
m_graph = other.m_graph;
|
|
||||||
m_index = other.m_index;
|
|
||||||
other.m_graph = nullptr;
|
|
||||||
other.m_index = GraphIndex(-1);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
TxGraph::Ref::Ref(Ref&& other) noexcept
|
TxGraph::Ref::Ref(Ref&& other) noexcept
|
||||||
{
|
{
|
||||||
// Inform the TxGraph of other that its Ref is being moved.
|
// Inform the TxGraph of other that its Ref is being moved.
|
||||||
|
|||||||
+2
-2
@@ -241,8 +241,8 @@ public:
|
|||||||
/** Destroy this Ref. If it is not empty, the corresponding transaction is removed (in both
|
/** Destroy this Ref. If it is not empty, the corresponding transaction is removed (in both
|
||||||
* main and staging, if it exists). */
|
* main and staging, if it exists). */
|
||||||
virtual ~Ref();
|
virtual ~Ref();
|
||||||
// Support moving a Ref.
|
// Support move-constructing a Ref.
|
||||||
Ref& operator=(Ref&& other) noexcept;
|
Ref& operator=(Ref&& other) noexcept = delete;
|
||||||
Ref(Ref&& other) noexcept;
|
Ref(Ref&& other) noexcept;
|
||||||
// Do not permit copy constructing or copy assignment. A TxGraph entry can have at most one
|
// Do not permit copy constructing or copy assignment. A TxGraph entry can have at most one
|
||||||
// Ref pointing to it.
|
// Ref pointing to it.
|
||||||
|
|||||||
Reference in new issue
Block a user