Skip to content

Commit

Permalink
Check all sizes with zero
Browse files Browse the repository at this point in the history
  • Loading branch information
XuJiandong committed Feb 8, 2024
1 parent 357e397 commit 02f1010
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions c/cobuild.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,18 @@ int ckb_cobuild_entry(ScriptEntryType callback, bool *cobuild_enabled) {
mol2_union_t uni = mol2_union_unpack(&cursor);
OtxType otx = make_Otx(&uni.cursor);
MessageType message = otx.t->message(&otx);
Otx size = {
.input_cells = otx.t->input_cells(&otx),
.output_cells = otx.t->output_cells(&otx),
.cell_deps = otx.t->cell_deps(&otx),
.header_deps = otx.t->header_deps(&otx),
};
// 6.b
if (size.input_cells == 0 && size.output_cells == 0 &&
size.cell_deps == 0 && size.header_deps == 0) {
// TODO
CHECK2(false, ERROR_WRONG_OTX);
}
// step 6.c
err = check_type_script_existing(message.cur);
CHECK(err);
Expand Down Expand Up @@ -928,18 +940,6 @@ int ckb_cobuild_entry(ScriptEntryType callback, bool *cobuild_enabled) {
.start_cell_deps = ce,
.start_header_deps = he,
};
Otx size = {
.input_cells = otx.t->input_cells(&otx),
.output_cells = otx.t->output_cells(&otx),
.cell_deps = otx.t->cell_deps(&otx),
.header_deps = otx.t->header_deps(&otx),
};
// 6.b
if (size.input_cells == 0 && size.output_cells == 0 &&
size.cell_deps == 0 && size.header_deps == 0) {
// TODO
CHECK2(false, ERROR_WRONG_OTX);
}
err = ckb_generate_otx_smh(message.cur, smh, &start, &size);
CHECK(err);
print_raw_data("smh", smh, BLAKE2B_BLOCK_SIZE);
Expand Down

0 comments on commit 02f1010

Please sign in to comment.