mirror of
https://github.com/ton-blockchain/ton
synced 2025-02-12 11:12:16 +00:00
Add InitState to raw.getTransactions [tonlib] (#485)
* Extract and return message init state * prefetch -> fetch
This commit is contained in:
parent
1d42c38122
commit
7fcfc63d06
1 changed files with 13 additions and 2 deletions
|
@ -2510,7 +2510,18 @@ struct ToRawTransactions {
|
|||
auto body_cell = vm::CellBuilder().append_cellslice(*body).finalize();
|
||||
auto body_hash = body_cell->get_hash().as_slice().str();
|
||||
|
||||
auto get_data = [body = std::move(body), body_cell, this](td::Slice salt) mutable {
|
||||
td::Ref<vm::Cell> init_state_cell;
|
||||
auto& init_state_cs = message.init.write();
|
||||
if (init_state_cs.fetch_ulong(1) == 1) {
|
||||
if (init_state_cs.fetch_long(1) == 0) {
|
||||
init_state_cell = vm::CellBuilder().append_cellslice(init_state_cs).finalize();
|
||||
} else {
|
||||
init_state_cell = init_state_cs.fetch_ref();
|
||||
}
|
||||
}
|
||||
|
||||
auto get_data = [body = std::move(body), body_cell = std::move(body_cell),
|
||||
init_state_cell = std::move(init_state_cell), this](td::Slice salt) mutable {
|
||||
tonlib_api::object_ptr<tonlib_api::msg_Data> data;
|
||||
if (try_decode_messages_ && body->size() >= 32 && static_cast<td::uint32>(body->prefetch_long(32)) <= 1) {
|
||||
auto type = body.write().fetch_long(32);
|
||||
|
@ -2540,7 +2551,7 @@ struct ToRawTransactions {
|
|||
}
|
||||
}
|
||||
if (!data) {
|
||||
data = tonlib_api::make_object<tonlib_api::msg_dataRaw>(to_bytes(std::move(body_cell)), "");
|
||||
data = tonlib_api::make_object<tonlib_api::msg_dataRaw>(to_bytes(std::move(body_cell)), to_bytes(std::move(init_state_cell)));
|
||||
}
|
||||
return data;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue