Skip to content

Commit 4568b1d

Browse files
committed
Enable point table insert duplicate searching with find abort.
1 parent 1d20724 commit 4568b1d

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

include/bitcoin/database/impl/query/archive_write.ipp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,24 +148,22 @@ code CLASS::set_code(const tx_link& tx_fk, const transaction& tx) NOEXCEPT
148148
return error::tx_point_allocate;
149149

150150
// Collect duplicates to store in duplicate table.
151-
std::vector<chain::cref_point> twins{};
151+
////std::vector<chain::cref_point> twins{};
152152
const auto ptr = store_.point.get_memory();
153+
bool duplicate{};
153154

154155
// This must be set after tx.set and before tx.commit, since searchable and
155156
// produces an association to tx.link, and is also an integral part of tx.
156157
for (const auto& in: *ins)
157158
{
158-
///////////////////////////////////////////////////////////////////
159-
// TODO: add filter to hashmap and use method here to detect and
160-
// TODO: return prior existence (dup) here (insert succeeds).
161-
///////////////////////////////////////////////////////////////////
162-
bool twin{};
163-
if (!store_.point.put(/*twin,*/ ptr, ins_fk++, in->point(),
159+
if (!store_.point.put(duplicate, ptr, ins_fk++, in->point(),
164160
table::point::record{}))
165161
return error::tx_point_put;
166162

167-
if (twin)
168-
twins.emplace_back(in->point().hash(), in->point().index());
163+
if (duplicate)
164+
return error::confirmed_double_spend;
165+
166+
////twins.emplace_back(in->point().hash(), in->point().index());
169167
}
170168

171169
///////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)