Skip to content

Commit a907826

Browse files
authored
Merge pull request #365 from evoskuil/version3
Patch tx and header fetch handlers, no serialize in failure condition.
2 parents e224e93 + b71c100 commit a907826

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/interface/blockchain.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,17 @@ void blockchain::fetch_block_header_by_height(server_node& node,
156156
void blockchain::block_header_fetched(const code& ec, header_const_ptr header,
157157
const message& request, send_handler handler)
158158
{
159+
if (ec)
160+
{
161+
handler(message(request, ec));
162+
return;
163+
}
164+
159165
// [ code:4 ]
160166
// [ block... ]
161167
const auto result = build_chunk(
162168
{
163-
message::to_bytes(ec),
169+
message::to_bytes(error::success),
164170
header->to_data(canonical_version)
165171
});
166172

src/utility/fetch_helpers.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,15 @@ bool unwrap_fetch_transaction_args(hash_digest& hash, const message& request)
109109
void transaction_fetched(const code& ec, transaction_ptr tx, size_t, size_t,
110110
const message& request, send_handler handler)
111111
{
112+
if (ec)
113+
{
114+
handler(message(request, ec));
115+
return;
116+
}
117+
112118
const auto result = build_chunk(
113119
{
114-
message::to_bytes(ec),
120+
message::to_bytes(error::success),
115121
tx->to_data(version::level::canonical)
116122
});
117123

0 commit comments

Comments
 (0)