Skip to content

Commit 4e422e1

Browse files
authored
Merge pull request #580 from evoskuil/master
Disable troubleshooting code, comments, auto.
2 parents 2acda39 + 8f9ca2a commit 4e422e1

3 files changed

Lines changed: 27 additions & 25 deletions

File tree

include/bitcoin/database/impl/primitives/hashhead.ipp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ inline bool CLASS::push(const Link& current, bytes& next,
172172
// xcode clang++16 does not support C++20 std::atomic_ref.
173173
////const std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
174174
auto& head = *pointer_cast<std::atomic<integer>>(raw);
175-
176-
integer top = head.load(std::memory_order_acquire);
175+
auto top = head.load(std::memory_order_acquire);
177176
do
178177
{
179178
// Compiler could order this after head.store, which would expose key

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,22 @@ code CLASS::set_code(tx_link& tx_fk, const transaction& tx) NOEXCEPT
105105
if (tx_fk.is_terminal())
106106
return error::tx_tx_allocate;
107107

108-
// Allocate contiguously and store inputs (script & witness).
108+
// Allocate contiguously and store inputs.
109109
input_link in_fk{};
110110
if (!store_.input.put_link(in_fk, table::input::put_ref{ {}, tx }))
111111
return error::tx_input_put;
112112

113-
// Allocate contiguously and store outputs (script, w/parent).
113+
// Allocate contiguously and store outputs.
114114
output_link out_fk{};
115115
if (!store_.output.put_link(out_fk, table::output::put_ref{ {}, tx_fk, tx }))
116116
return error::tx_output_put;
117117

118-
// Allocate and contiguously store input links (first + tx.input sizes, w/parent & seq).
118+
// Allocate and contiguously store input links.
119119
point_link ins_fk{};
120120
if (!store_.ins.put_link(ins_fk, table::ins::put_ref{ {}, in_fk, tx_fk, tx }))
121121
return error::tx_ins_put;
122122

123-
// Allocate and contiguously store output links (first + tx.output sizes).
123+
// Allocate and contiguously store output links.
124124
point_link outs_fk{};
125125
if (!store_.outs.put_link(outs_fk, table::outs::put_ref{ {}, out_fk, tx }))
126126
return error::tx_outs_put;

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

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -205,25 +205,28 @@ code CLASS::push_spenders(tx_links& out, const point& point,
205205
auto it = store_.point.it(table::point::compose(point));
206206
if (!it)
207207
{
208-
const auto key1 = it.key();
209-
const auto link1 = it.self();
210-
const auto get1 = it.get();
211-
it.reset();
212-
213-
if (key1 != table::point::compose(point))
214-
return error::integrity12;
215-
if (!link1.is_terminal())
216-
return error::integrity13;
217-
if (is_null(get1))
218-
return error::integrity14;
219-
220-
table::point::record get{};
221-
if (!store_.point.get(self, get))
222-
return error::integrity15;
223-
if (get.hash != point.hash())
224-
return error::integrity16;
225-
if (get.index != point.index())
226-
return error::integrity17;
208+
// This verified that there was a race condition in the intial hashmap
209+
// memory fence implementation, manifesting above as not found, where
210+
// immediately after (below) the same object was found. Now fixed.
211+
////const auto key1 = it.key();
212+
////const auto link1 = it.self();
213+
////const auto get1 = it.get();
214+
////it.reset();
215+
////
216+
////if (key1 != table::point::compose(point))
217+
//// return error::integrity12;
218+
////if (!link1.is_terminal())
219+
//// return error::integrity13;
220+
////if (is_null(get1))
221+
//// return error::integrity14;
222+
////
223+
////table::point::record get{};
224+
////if (!store_.point.get(self, get))
225+
//// return error::integrity15;
226+
////if (get.hash != point.hash())
227+
//// return error::integrity16;
228+
////if (get.index != point.index())
229+
//// return error::integrity17;
227230

228231
return error::integrity4;
229232
}

0 commit comments

Comments
 (0)