mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Tonlib fix (#743)
* Fix building messages with long body (#709) * Fix returning slice in tonlib (#734) --------- Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
08cfc4c6ee
commit
9b34217bf0
3 changed files with 9 additions and 4 deletions
|
@ -55,18 +55,21 @@ td::Ref<vm::Cell> WalletInterface::create_int_message(const Gift &gift) {
|
|||
} else {
|
||||
cbi.store_zeroes(1);
|
||||
}
|
||||
cbi.store_zeroes(1);
|
||||
store_gift_message(cbi, gift);
|
||||
return cbi.finalize();
|
||||
}
|
||||
void WalletInterface::store_gift_message(vm::CellBuilder &cb, const Gift &gift) {
|
||||
if (gift.body.not_null()) {
|
||||
auto body = vm::load_cell_slice(gift.body);
|
||||
//TODO: handle error
|
||||
CHECK(cb.append_cellslice_bool(body));
|
||||
if (cb.can_extend_by(1 + body.size(), body.size_refs())) {
|
||||
CHECK(cb.store_zeroes_bool(1) && cb.append_cellslice_bool(body));
|
||||
} else {
|
||||
CHECK(cb.store_ones_bool(1) && cb.store_ref_bool(gift.body));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
cb.store_zeroes(1);
|
||||
if (gift.is_encrypted) {
|
||||
cb.store_long(0x2167da4b, 32);
|
||||
} else {
|
||||
|
|
|
@ -73,6 +73,8 @@ class WalletInterface : public SmartContract {
|
|||
td::uint32 valid_until = std::numeric_limits<td::uint32>::max()) const;
|
||||
|
||||
static td::Ref<vm::Cell> create_int_message(const Gift &gift);
|
||||
|
||||
private:
|
||||
static void store_gift_message(vm::CellBuilder &cb, const Gift &gift);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue