Skip to content

Commit c9a7bf8

Browse files
committed
Use 2 * wire size for json serialization buffer.
1 parent fd017da commit c9a7bf8

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/protocols/protocol_explore.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ bool protocol_explore::handle_get_block(const code& ec, interface::block,
140140
return true;
141141
case json:
142142
send_json({}, value_from(ptr),
143-
ptr->serialized_size(witness));
143+
two * ptr->serialized_size(witness));
144144
return true;
145145
}
146146
}
@@ -166,7 +166,7 @@ bool protocol_explore::handle_get_header(const code& ec, interface::header,
166166
return true;
167167
case json:
168168
send_json({}, value_from(ptr),
169-
chain::header::serialized_size());
169+
two * chain::header::serialized_size());
170170
return true;
171171
}
172172
}
@@ -202,7 +202,7 @@ bool protocol_explore::handle_get_block_txs(const code& ec,
202202
array out(hashes.size());
203203
std::ranges::transform(hashes, out.begin(),
204204
[](const auto& hash) { return encode_base16(hash); });
205-
send_json({}, out, size);
205+
send_json({}, out, two * size);
206206
return true;
207207
}
208208
}
@@ -231,7 +231,7 @@ bool protocol_explore::handle_get_block_tx(const code& ec, interface::block_tx,
231231
return true;
232232
case json:
233233
send_json({}, value_from(ptr),
234-
ptr->serialized_size(witness));
234+
two * ptr->serialized_size(witness));
235235
return true;
236236
}
237237
}
@@ -258,7 +258,7 @@ bool protocol_explore::handle_get_transaction(const code& ec,
258258
return true;
259259
case json:
260260
send_json({}, value_from(ptr),
261-
ptr->serialized_size(witness));
261+
two * ptr->serialized_size(witness));
262262
return true;
263263
}
264264
}
@@ -334,7 +334,7 @@ bool protocol_explore::handle_get_inputs(const code& ec, interface::inputs,
334334
return true;
335335
case json:
336336
send_json({}, value_from(ptr->front()),
337-
ptr->front()->serialized_size(false));
337+
two * ptr->front()->serialized_size(false));
338338
return true;
339339
}
340340

@@ -360,7 +360,7 @@ bool protocol_explore::handle_get_input(const code& ec, interface::input,
360360
return true;
361361
case json:
362362
send_json({}, value_from(ptr),
363-
ptr->serialized_size(false));
363+
two * ptr->serialized_size(false));
364364
return true;
365365
}
366366
}
@@ -388,7 +388,7 @@ bool protocol_explore::handle_get_input_script(const code& ec,
388388
return true;
389389
case json:
390390
send_json({}, value_from(ptr),
391-
ptr->serialized_size(false));
391+
two * ptr->serialized_size(false));
392392
return true;
393393
}
394394
}
@@ -416,7 +416,7 @@ bool protocol_explore::handle_get_input_witness(const code& ec,
416416
return true;
417417
case json:
418418
send_json({}, value_from(ptr),
419-
ptr->serialized_size(false));
419+
two * ptr->serialized_size(false));
420420
return true;
421421
}
422422
}
@@ -444,7 +444,7 @@ bool protocol_explore::handle_get_outputs(const code& ec, interface::outputs,
444444
return true;
445445
case json:
446446
send_json({}, value_from(ptr->front()),
447-
ptr->front()->serialized_size());
447+
two * ptr->front()->serialized_size());
448448
return true;
449449
}
450450
}
@@ -471,7 +471,7 @@ bool protocol_explore::handle_get_output(const code& ec, interface::output,
471471
return true;
472472
case json:
473473
send_json({}, value_from(ptr),
474-
ptr->serialized_size());
474+
two * ptr->serialized_size());
475475
return true;
476476
}
477477
}
@@ -499,7 +499,7 @@ bool protocol_explore::handle_get_output_script(const code& ec,
499499
return true;
500500
case json:
501501
send_json({}, value_from(ptr),
502-
ptr->serialized_size(false));
502+
two * ptr->serialized_size(false));
503503
return true;
504504
}
505505
}
@@ -534,7 +534,8 @@ bool protocol_explore::handle_get_output_spender(const code& ec,
534534
send_wire(media, point.to_data());
535535
return true;
536536
case json:
537-
send_json({}, value_from(point), point.serialized_size());
537+
send_json({}, value_from(point),
538+
two * point.serialized_size());
538539
return true;
539540
}
540541
}
@@ -570,7 +571,8 @@ bool protocol_explore::handle_get_output_spenders(const code& ec,
570571
send_wire(media, point.to_data());
571572
return true;
572573
case json:
573-
send_json({}, value_from(point), point.serialized_size());
574+
send_json({}, value_from(point),
575+
two * point.serialized_size());
574576
return true;
575577
}
576578
}
@@ -617,7 +619,7 @@ bool protocol_explore::handle_get_address(const code& ec, interface::address,
617619
return true;
618620
case json:
619621
send_json({}, value_from(ptr),
620-
ptr->serialized_size());
622+
two * ptr->serialized_size());
621623
return true;
622624
}
623625
}

0 commit comments

Comments
 (0)