inline action recursion
Hi all! I'm trying to make a function to sell an nft item in my game. Item belongs to user, who transferred it to my contract Another user should buy it. So buyer sends some money to contract -> contract should transfer Item to buyer AND transfer money to the seller. And everything works fine but: if i do all the logic in one method i'm getting error Error 3040000 inline action recursion depth reached
Here is the piece of my method:
void mygame::transfer(from, to, price, memo)
{
...
// send nft to buyer
action(permission_level{ _self, N(active) },
N(mygameeos), N(nfttransfer),
std::make_tuple(_self, from, id, memo)
).send();
// send money to seller
action(permission_level{_self, N(active) },
N(eosio.token), N(transfer),
std::make_tuple(_self, from, sendprice, memo)
).send();
}
What i do wrong?
What is the value in your genesis.json file for "max_inline_action_depth"? Are these the only inline actions (either regular inline actions or context free inline actions) you have in this entire transaction? (The error wording is wrong, it should be "inline action depth reached", "recursive" is wrong.)
(@vtornik23 Note that I updated the text in my original response. I am not certain if github sends a subsequent email with the correction.)
Does your code mygameeos::nfttransfer also use inline actions? or mygame::transfer is triggered by some inline action?
Closed because of no reply. If you still have the problem and wish to discuss further, please post it in https://eosio.stackexchange.com.
What was the solution? I am getting this same error: https://eosio.stackexchange.com/questions/3801/max-inline-action-depth-per-transaction-reached-on-simple-eos-transfer-action-ca
Both the sender and receiver of a token transfer are notified of that transfer. The code in that handler isn't checking to see if your contract is the sender or receiver of the tokens, so, I suspect when you send the inline action you are getting notified of it as the sender of tokens which then triggers another inline transfer and creates an infinite loop.
On Sat, Jan 26, 2019, 7:41 PM johnworthley <[email protected] wrote:
What was the solution? I am getting this same error: https://eosio.stackexchange.com/questions/3801/max-inline-action-depth-per-transaction-reached-on-simple-eos-transfer-action-ca
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/EOSIO/eos/issues/5632#issuecomment-457878852, or mute the thread https://github.com/notifications/unsubscribe-auth/ACYR4ihzqaZvWuNBZFJQEPixWckI63TSks5vHPXQgaJpZM4WmNql .
Using if (latestRecord.account.name != _self)) before the inline transfer did the trick!
also got this error occasionally, how to calculate the inline actions depth, how many actions depth as case below? 3 or 4?
->A
->B
->C
->D
anyway to dump the actions before this error occurs?