Skip to content

Commit 84c7dda

Browse files
committed
Add extra reporting to push_spenders.
1 parent 672362a commit 84c7dda

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

include/bitcoin/database/error.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ enum error_t : uint8_t
5151
integrity12,
5252
integrity13,
5353
integrity14,
54+
integrity15,
55+
integrity16,
56+
integrity17,
5457

5558
/// memory map
5659
open_open,

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,25 @@ 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();
208211
it.reset();
209212

210-
table::point::record get{};
211-
if (!store_.point.get(self, get))
213+
if (key1 != table::point::compose(point))
212214
return error::integrity12;
213-
214-
if (get.hash != point.hash())
215+
if (!link1.is_terminal())
215216
return error::integrity13;
217+
if (is_null(get1))
218+
return error::integrity14;
216219

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;
217225
if (get.index != point.index())
218-
return error::integrity14;
226+
return error::integrity17;
219227

220228
return error::integrity4;
221229
}

src/error.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ DEFINE_ERROR_T_MESSAGE_MAP(error)
4444
{ integrity12, "store corrupted12" },
4545
{ integrity13, "store corrupted13" },
4646
{ integrity14, "store corrupted14" },
47+
{ integrity15, "store corrupted15" },
48+
{ integrity16, "store corrupted16" },
49+
{ integrity17, "store corrupted17" },
4750

4851
// memory map
4952
{ open_open, "opening open file" },

0 commit comments

Comments
 (0)