Bounced messages
When a contract sends a message with a flag bounce
set to true
, then if the message wasn't processed properly, it would bounce back to the sender. This is useful when you want to make sure that the message was processed properly and if not — revert the changes.
Caveats
Currently, bounced messages in TON have only 224 usable data bits in the message body and don't have any references. This means that you can't recover much of the data from the bounced message. This is a limitation of the TON blockchain and will be fixed in the future. Tact helps you to check if your message fits the limit and in case it doesn't — suggests using a special type constructor bounced<T>
for the bounced message receiver, that would construct a partial representation of the message that fits into the required limits.
Bounced message receiver
Bounced text messages are not supported yet.
To receive a bounced message, define a bounced()
receiver function in your contract or a trait:
contract MyContract {
bounced(msg: bounced<MyMessage>) {
// ...
}
}
To process bounced messages manually, you can use a fallback definition that handles a raw Slice
directly. Note, that such receiver will get all the bounced messages produced by your contract:
contract MyContract {
bounced(rawMsg: Slice) {
// ...
}
}