Skip to content

Commit 95c58f9

Browse files
committed
Add extra reporting to push_spenders.
1 parent c08c6c5 commit 95c58f9

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

include/bitcoin/database/error.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ enum error_t : uint8_t
4848
integrity9,
4949
integrity10,
5050
integrity11,
51+
integrity12,
52+
integrity13,
53+
integrity14,
5154

5255
/// memory map
5356
open_open,

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,21 @@ code CLASS::push_spenders(tx_links& out, const point& point,
204204
{
205205
auto it = store_.point.it(table::point::compose(point));
206206
if (!it)
207+
{
208+
it.reset();
209+
210+
table::point::record get{};
211+
if (!store_.point.get(self, get))
212+
return error::integrity12;
213+
214+
if (get.hash != point.hash())
215+
return error::integrity13;
216+
217+
if (get.index != point.index())
218+
return error::integrity14;
219+
207220
return error::integrity4;
221+
}
208222

209223
point_links points{};
210224
do

src/error.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ DEFINE_ERROR_T_MESSAGE_MAP(error)
4141
{ integrity9, "store corrupted9" },
4242
{ integrity10, "store corrupted10" },
4343
{ integrity11, "store corrupted11" },
44+
{ integrity12, "store corrupted12" },
45+
{ integrity13, "store corrupted13" },
46+
{ integrity14, "store corrupted14" },
4447

4548
// memory map
4649
{ open_open, "opening open file" },

0 commit comments

Comments
 (0)