@@ -665,7 +665,7 @@ bool CommonMsgInfo::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const
665665 && t_MsgAddressInt.validate_skip (ops, cs, weak) // src
666666 && t_MsgAddressInt.validate_skip (ops, cs, weak) // dest
667667 && t_CurrencyCollection.validate_skip (ops, cs, weak) // value
668- && t_Grams.validate_skip (ops, cs, weak) // ihr_fee
668+ && t_Grams.validate_skip (ops, cs, weak) // extra_flags
669669 && t_Grams.validate_skip (ops, cs, weak) // fwd_fee
670670 && cs.advance (64 + 32 ); // created_lt:uint64 created_at:uint32
671671 case ext_in_msg_info:
@@ -684,7 +684,7 @@ bool CommonMsgInfo::unpack(vm::CellSlice& cs, CommonMsgInfo::Record_int_msg_info
684684 return get_tag (cs) == int_msg_info && cs.advance (1 ) && cs.fetch_bool_to (data.ihr_disabled ) &&
685685 cs.fetch_bool_to (data.bounce ) && cs.fetch_bool_to (data.bounced ) && t_MsgAddressInt.fetch_to (cs, data.src ) &&
686686 t_MsgAddressInt.fetch_to (cs, data.dest ) && t_CurrencyCollection.fetch_to (cs, data.value ) &&
687- t_Grams.fetch_to (cs, data.ihr_fee ) && t_Grams.fetch_to (cs, data.fwd_fee ) &&
687+ t_Grams.fetch_to (cs, data.extra_flags ) && t_Grams.fetch_to (cs, data.fwd_fee ) &&
688688 cs.fetch_uint_to (64 , data.created_lt ) && cs.fetch_uint_to (32 , data.created_at );
689689}
690690
@@ -696,7 +696,7 @@ bool CommonMsgInfo::skip(vm::CellSlice& cs) const {
696696 && t_MsgAddressInt.skip (cs) // src
697697 && t_MsgAddressInt.skip (cs) // dest
698698 && t_CurrencyCollection.skip (cs) // value
699- && t_Grams.skip (cs) // ihr_fee
699+ && t_Grams.skip (cs) // extra_flags
700700 && t_Grams.skip (cs) // fwd_fee
701701 && cs.advance (64 + 32 ); // created_lt:uint64 created_at:uint32
702702 case ext_in_msg_info:
@@ -718,7 +718,7 @@ bool CommonMsgInfo::get_created_lt(vm::CellSlice& cs, unsigned long long& create
718718 && t_MsgAddressInt.skip (cs) // src
719719 && t_MsgAddressInt.skip (cs) // dest
720720 && t_CurrencyCollection.skip (cs) // value
721- && t_Grams.skip (cs) // ihr_fee
721+ && t_Grams.skip (cs) // extra_flags
722722 && t_Grams.skip (cs) // fwd_fee
723723 && cs.fetch_ulong_bool (64 , created_lt) // created_lt:uint64
724724 && cs.advance (32 ); // created_at:uint32
@@ -1843,26 +1843,18 @@ bool InMsg::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
18431843 return false ;
18441844}
18451845
1846- bool InMsg::get_import_fees (vm::CellBuilder& cb, vm::CellSlice& cs) const {
1846+ static td::RefInt256 get_ihr_fee (const CommonMsgInfo::Record_int_msg_info &info, int global_version) {
1847+ // Legacy: extra_flags was previously ihr_fee
1848+ return global_version >= 12 ? td::zero_refint () : t_Grams.as_integer (std::move (info.extra_flags ));
1849+ }
1850+
1851+ bool InMsg::get_import_fees (vm::CellBuilder& cb, vm::CellSlice& cs, int global_version) const {
18471852 int tag = get_tag (cs);
18481853 switch (tag) {
18491854 case msg_import_ext: // inbound external message
18501855 return t_ImportFees.null_value (cb); // external messages have no value and no import fees
18511856 case msg_import_ihr: // IHR-forwarded internal message to its final destination
1852- if (cs.advance (3 ) && cs.size_refs () >= 3 ) {
1853- auto msg_cs = load_cell_slice (cs.fetch_ref ());
1854- CommonMsgInfo::Record_int_msg_info msg_info;
1855- td::RefInt256 ihr_fee;
1856- vm::CellBuilder aux;
1857- // sort of Prolog-style in C++
1858- return t_Message.extract_info (msg_cs) && t_CommonMsgInfo.unpack (msg_cs, msg_info) &&
1859- cs.fetch_ref ().not_null () && (ihr_fee = t_Grams.as_integer_skip (cs)).not_null () &&
1860- cs.fetch_ref ().not_null () && !cmp (ihr_fee, t_Grams.as_integer (*msg_info.ihr_fee )) &&
1861- cb.append_cellslice_bool (msg_info.ihr_fee ) // fees_collected := ihr_fee
1862- && aux.append_cellslice_bool (msg_info.ihr_fee ) && t_ExtraCurrencyCollection.null_value (aux) &&
1863- t_CurrencyCollection.add_values (cb, aux.as_cellslice_ref ().write (),
1864- msg_info.value .write ()); // value_imported := ihr_fee + value
1865- }
1857+ // IHR is not implemented
18661858 return false ;
18671859 case msg_import_imm: // internal message re-imported from this very block
18681860 if (cs.advance (3 ) && cs.size_refs () >= 2 ) {
@@ -1888,7 +1880,7 @@ bool InMsg::get_import_fees(vm::CellBuilder& cb, vm::CellSlice& cs) const {
18881880 return t_Message.extract_info (msg_cs) && t_CommonMsgInfo.unpack (msg_cs, msg_info) &&
18891881 cb.append_cellslice_bool (in_msg.fwd_fee_remaining ) // fees_collected := fwd_fee_remaining
18901882 && t_Grams.as_integer_skip_to (msg_info.value .write (), value_grams) &&
1891- (ihr_fee = t_Grams. as_integer ( std::move ( msg_info. ihr_fee ) )).not_null () &&
1883+ (ihr_fee = get_ihr_fee ( msg_info, global_version )).not_null () &&
18921884 t_Grams.store_integer_ref (cb, value_grams + ihr_fee + fwd_fee_remaining) &&
18931885 cb.append_cellslice_bool (
18941886 msg_info.value .write ()); // value_imported = msg.value + msg.ihr_fee + fwd_fee_remaining
@@ -1911,7 +1903,7 @@ bool InMsg::get_import_fees(vm::CellBuilder& cb, vm::CellSlice& cs) const {
19111903 return t_Message.extract_info (msg_cs) && t_CommonMsgInfo.unpack (msg_cs, msg_info) &&
19121904 t_Grams.store_integer_ref (cb, std::move (transit_fee)) // fees_collected := transit_fees
19131905 && t_Grams.as_integer_skip_to (msg_info.value .write (), value_grams) &&
1914- (ihr_fee = t_Grams. as_integer ( std::move ( msg_info. ihr_fee ) )).not_null () &&
1906+ (ihr_fee = get_ihr_fee ( msg_info, global_version )).not_null () &&
19151907 t_Grams.store_integer_ref (cb, value_grams + ihr_fee + fwd_fee_remaining) &&
19161908 cb.append_cellslice_bool (
19171909 msg_info.value .write ()); // value_imported = msg.value + msg.ihr_fee + fwd_fee_remaining
@@ -1941,8 +1933,8 @@ bool InMsg::get_import_fees(vm::CellBuilder& cb, vm::CellSlice& cs) const {
19411933
19421934const InMsg t_InMsg;
19431935
1944- const Aug_InMsgDescr aug_InMsgDescr ;
1945- const InMsgDescr t_InMsgDescr ;
1936+ const Aug_InMsgDescr aug_InMsgDescrDefault (ton::SUPPORTED_VERSION) ;
1937+ const InMsgDescr t_InMsgDescrDefault (ton::SUPPORTED_VERSION) ;
19461938
19471939bool OutMsg::skip (vm::CellSlice& cs) const {
19481940 switch (get_tag (cs)) {
@@ -2038,7 +2030,7 @@ bool OutMsg::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
20382030 return false ;
20392031}
20402032
2041- bool OutMsg::get_export_value (vm::CellBuilder& cb, vm::CellSlice& cs) const {
2033+ bool OutMsg::get_export_value (vm::CellBuilder& cb, vm::CellSlice& cs, int global_version ) const {
20422034 auto tag = get_tag (cs);
20432035 switch (tag) {
20442036 case msg_export_ext: // external outbound message carries no value
@@ -2071,7 +2063,7 @@ bool OutMsg::get_export_value(vm::CellBuilder& cb, vm::CellSlice& cs) const {
20712063 td::RefInt256 value_grams, ihr_fee, fwd_fee_remaining;
20722064 return t_Message.extract_info (msg_cs) && t_CommonMsgInfo.unpack (msg_cs, msg_info) &&
20732065 (value_grams = t_Grams.as_integer_skip (msg_info.value .write ())).not_null () &&
2074- (ihr_fee = t_Grams. as_integer ( std::move ( msg_info. ihr_fee ) )).not_null () &&
2066+ (ihr_fee = get_ihr_fee ( msg_info, global_version )).not_null () &&
20752067 (fwd_fee_remaining = t_Grams.as_integer (out_msg.fwd_fee_remaining )).not_null () &&
20762068 t_Grams.store_integer_ref (cb, value_grams + ihr_fee + fwd_fee_remaining) &&
20772069 cb.append_cellslice_bool (std::move (msg_info.value ));
@@ -2112,8 +2104,8 @@ bool OutMsg::get_emitted_lt(vm::CellSlice& cs, unsigned long long& emitted_lt) c
21122104
21132105const OutMsg t_OutMsg;
21142106
2115- const Aug_OutMsgDescr aug_OutMsgDescr ;
2116- const OutMsgDescr t_OutMsgDescr ;
2107+ const Aug_OutMsgDescr aug_OutMsgDescrDefault (ton::SUPPORTED_VERSION) ;
2108+ const OutMsgDescr t_OutMsgDescrDefault (ton::SUPPORTED_VERSION) ;
21172109
21182110bool EnqueuedMsg::validate_skip (int * ops, vm::CellSlice& cs, bool weak) const {
21192111 return cs.advance (64 ) && t_Ref_MsgEnvelope.validate_skip (ops, cs, weak);
0 commit comments