Skip to content

Commit 74cacb3

Browse files
authored
Merge pull request #715 from evoskuil/master
Implement prevout table optionality.
2 parents 470a474 + ae9334e commit 74cacb3

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

include/bitcoin/node/chasers/chaser_confirm.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class BCN_API chaser_confirm
9191
// These are thread safe.
9292
network::asio::strand independent_strand_;
9393
const bool concurrent_;
94+
bool prevout_;
9495
};
9596

9697
} // namespace node

src/chasers/chaser_confirm.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ chaser_confirm::chaser_confirm(full_node& node) NOEXCEPT
4343
: chaser(node),
4444
threadpool_(one, node.config().node.priority_()),
4545
independent_strand_(threadpool_.service().get_executor()),
46-
concurrent_(node.config().node.concurrent_confirmation)
46+
concurrent_(node.config().node.concurrent_confirmation),
47+
prevout_(node.archive().prevout_enabled())
4748
{
4849
}
4950

@@ -204,6 +205,13 @@ void chaser_confirm::do_bump(height_t) NOEXCEPT
204205
}
205206
else if (ec == database::error::block_valid)
206207
{
208+
// Set before if not using prevout table.
209+
if (!prevout_ && !query.set_strong(link))
210+
{
211+
fault(error::confirm5);
212+
return;
213+
}
214+
207215
// Confirmation query.
208216
if ((ec = query.block_confirmable(link)))
209217
{
@@ -213,6 +221,13 @@ void chaser_confirm::do_bump(height_t) NOEXCEPT
213221
return;
214222
}
215223

224+
// Unset from set before if not using prevout table.
225+
if (!prevout_ && !query.set_unstrong(link))
226+
{
227+
fault(error::confirm5);
228+
return;
229+
}
230+
216231
if (!query.set_block_unconfirmable(link))
217232
{
218233
fault(error::confirm3);
@@ -231,14 +246,16 @@ void chaser_confirm::do_bump(height_t) NOEXCEPT
231246
return;
232247
}
233248

234-
if (!query.set_strong(link))
249+
// Set after if using prevout table.
250+
if (prevout_ && !query.set_strong(link))
235251
{
236252
fault(error::confirm5);
237253
return;
238254
}
239255
}
240256
else if (ec == database::error::block_confirmable)
241257
{
258+
// Set in either case.
242259
if (!query.set_strong(link))
243260
{
244261
fault(error::confirm6);

0 commit comments

Comments
 (0)