|
25 | 25 | namespace libbitcoin { |
26 | 26 | namespace node { |
27 | 27 |
|
28 | | -////using boost::format; |
| 28 | +using boost::format; |
29 | 29 | using namespace network; |
30 | 30 | using namespace system; |
31 | 31 |
|
| 32 | +#if defined(UNDEFINED) |
| 33 | + |
32 | 34 | // arbitrary testing (non-const). |
33 | 35 | void executor::write_test(const hash_digest&) |
34 | 36 | { |
35 | 37 | logger("No write test implemented."); |
36 | 38 | } |
37 | 39 |
|
38 | | -#if defined(UNDEFINED) |
39 | | - |
40 | 40 | void executor::write_test(const system::hash_digest&) |
41 | 41 | { |
42 | 42 | for (database::header_link link{ 793'008_u32 }; link < 885'000_u32; ++link) |
@@ -201,40 +201,25 @@ void executor::write_test(const system::hash_digest&) |
201 | 201 | logger(format("block" BN_WRITE_ROW) % height % span.count()); |
202 | 202 | } |
203 | 203 |
|
204 | | -void executor::write_test(const system::hash_digest&) |
205 | | -{ |
206 | | - constexpr auto hash251684 = base16_hash( |
207 | | - "00000000000000720e4c59ad28a8b61f38015808e92465e53111e3463aed80de"); |
208 | | - const auto link = query_.to_header(hash251684); |
| 204 | +#endif // UNDEFINED |
209 | 205 |
|
| 206 | +void executor::write_test(const system::hash_digest& hash) |
| 207 | +{ |
| 208 | + const auto id = encode_hash(hash); |
| 209 | + const auto link = query_.to_header(hash); |
210 | 210 | if (link.is_terminal()) |
211 | 211 | { |
212 | | - logger("link.is_terminal()"); |
213 | | - return; |
| 212 | + logger(format("Block [%1%] not found.") % id); |
214 | 213 | } |
215 | | - |
216 | | - if (query_.confirmed_records() != 251684u) |
217 | | - { |
218 | | - logger("!query_.confirmed_records() != 251684u"); |
219 | | - return; |
220 | | - } |
221 | | - |
222 | | - if (!query_.push_confirmed(link, true)) |
| 214 | + else if (query_.set_block_unknown(link)) |
223 | 215 | { |
224 | | - logger("!query_.push_confirmed(link)"); |
225 | | - return; |
| 216 | + logger(format("Successfully reset block [%1%].") % id); |
226 | 217 | } |
227 | | - |
228 | | - if (query_.confirmed_records() != 251685u) |
| 218 | + else |
229 | 219 | { |
230 | | - logger("!query_.confirmed_records() != 251685u"); |
231 | | - return; |
| 220 | + logger(format("Failed to reset block [%1%].") % id); |
232 | 221 | } |
233 | | - |
234 | | - logger("Successfully confirmed block 251684."); |
235 | 222 | } |
236 | 223 |
|
237 | | -#endif // UNDEFINED |
238 | | - |
239 | 224 | } // namespace node |
240 | 225 | } // namespace libbitcoin |
0 commit comments