Can we set the deferred transaction for the delay more than the maximum delay?
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
According to the genesis block file. The maximum delay for a deferred transaction is 3888000.
"max_transaction_delay": 3888000,
Can we have a way around to deferred a transaction more than this delay?
deferred-transactions
add a comment |Â
up vote
4
down vote
favorite
According to the genesis block file. The maximum delay for a deferred transaction is 3888000.
"max_transaction_delay": 3888000,
Can we have a way around to deferred a transaction more than this delay?
deferred-transactions
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
According to the genesis block file. The maximum delay for a deferred transaction is 3888000.
"max_transaction_delay": 3888000,
Can we have a way around to deferred a transaction more than this delay?
deferred-transactions
According to the genesis block file. The maximum delay for a deferred transaction is 3888000.
"max_transaction_delay": 3888000,
Can we have a way around to deferred a transaction more than this delay?
deferred-transactions
asked Aug 14 at 6:34
Rajat Chaudhary
595116
595116
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
5
down vote
accepted
You may modify your deferred transaction to call it recursively until remaining_delay is less than max_transaction_delay.
The code snippet looks like this.
void deferred_txn(uint64_t delay,string sender_id,...)
eosio::transaction txn;
uint64_t max_delay = 3888000; //max delay supported by EOS
if (delay <= max_delay)
//perform your transaction here
else
uint64_t remaining_delay = delay - max_delay;
sender_id = updateSenderId(sender_id); //sender id should be updated for every recursive call
// transaction to update the delay
txn.actions.emplace_back(
eosio::permission_level(from, N(active)),
N(contract_name),
N(deferred_txn),
std::make_tuple(remaining_delay,sender_id,...));
txn.delay_sec = max_delay; // here we set the new delay which is maximum until remaining_delay is less the max_delay
txn.send(eosio::string_to_name(sender_id.c_str()), from);
But updating the sender_id would have to handled carefully as at the time of cancelling we should have the latest sender_id, right?
â Rajat Chaudhary
Aug 14 at 10:04
1
@RajatChaudhary You can frame the logic for generating sender_id based on counter which increments on every recursive call. This way, you can generate it on your end by approximating the counter based on start_time of transaction and max_delay.
â Umesh Maheswari
Aug 14 at 10:24
add a comment |Â
up vote
3
down vote
You can add an intermediate deferred transaction that will have a counter and manage the extended time you want to defer to.
Say for example that you want to delay for
365*24*60*60*2 = 63072000 blocks
which is about a year, create an action that will save this number in your multi_index and call a deferred transaction for the max delay possible 3888000. Then once the delayed transaction is called, decrement the value by 3888000 and check if it is still more than 3888000. If it is, defer it again with the max of 3888000.
If it is less, call the final action which is the one you actually wanted and delay it by the remaining number.
This will have an effect of breaking past the limit, it is sort of a while loop that extends the delay.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
You may modify your deferred transaction to call it recursively until remaining_delay is less than max_transaction_delay.
The code snippet looks like this.
void deferred_txn(uint64_t delay,string sender_id,...)
eosio::transaction txn;
uint64_t max_delay = 3888000; //max delay supported by EOS
if (delay <= max_delay)
//perform your transaction here
else
uint64_t remaining_delay = delay - max_delay;
sender_id = updateSenderId(sender_id); //sender id should be updated for every recursive call
// transaction to update the delay
txn.actions.emplace_back(
eosio::permission_level(from, N(active)),
N(contract_name),
N(deferred_txn),
std::make_tuple(remaining_delay,sender_id,...));
txn.delay_sec = max_delay; // here we set the new delay which is maximum until remaining_delay is less the max_delay
txn.send(eosio::string_to_name(sender_id.c_str()), from);
But updating the sender_id would have to handled carefully as at the time of cancelling we should have the latest sender_id, right?
â Rajat Chaudhary
Aug 14 at 10:04
1
@RajatChaudhary You can frame the logic for generating sender_id based on counter which increments on every recursive call. This way, you can generate it on your end by approximating the counter based on start_time of transaction and max_delay.
â Umesh Maheswari
Aug 14 at 10:24
add a comment |Â
up vote
5
down vote
accepted
You may modify your deferred transaction to call it recursively until remaining_delay is less than max_transaction_delay.
The code snippet looks like this.
void deferred_txn(uint64_t delay,string sender_id,...)
eosio::transaction txn;
uint64_t max_delay = 3888000; //max delay supported by EOS
if (delay <= max_delay)
//perform your transaction here
else
uint64_t remaining_delay = delay - max_delay;
sender_id = updateSenderId(sender_id); //sender id should be updated for every recursive call
// transaction to update the delay
txn.actions.emplace_back(
eosio::permission_level(from, N(active)),
N(contract_name),
N(deferred_txn),
std::make_tuple(remaining_delay,sender_id,...));
txn.delay_sec = max_delay; // here we set the new delay which is maximum until remaining_delay is less the max_delay
txn.send(eosio::string_to_name(sender_id.c_str()), from);
But updating the sender_id would have to handled carefully as at the time of cancelling we should have the latest sender_id, right?
â Rajat Chaudhary
Aug 14 at 10:04
1
@RajatChaudhary You can frame the logic for generating sender_id based on counter which increments on every recursive call. This way, you can generate it on your end by approximating the counter based on start_time of transaction and max_delay.
â Umesh Maheswari
Aug 14 at 10:24
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
You may modify your deferred transaction to call it recursively until remaining_delay is less than max_transaction_delay.
The code snippet looks like this.
void deferred_txn(uint64_t delay,string sender_id,...)
eosio::transaction txn;
uint64_t max_delay = 3888000; //max delay supported by EOS
if (delay <= max_delay)
//perform your transaction here
else
uint64_t remaining_delay = delay - max_delay;
sender_id = updateSenderId(sender_id); //sender id should be updated for every recursive call
// transaction to update the delay
txn.actions.emplace_back(
eosio::permission_level(from, N(active)),
N(contract_name),
N(deferred_txn),
std::make_tuple(remaining_delay,sender_id,...));
txn.delay_sec = max_delay; // here we set the new delay which is maximum until remaining_delay is less the max_delay
txn.send(eosio::string_to_name(sender_id.c_str()), from);
You may modify your deferred transaction to call it recursively until remaining_delay is less than max_transaction_delay.
The code snippet looks like this.
void deferred_txn(uint64_t delay,string sender_id,...)
eosio::transaction txn;
uint64_t max_delay = 3888000; //max delay supported by EOS
if (delay <= max_delay)
//perform your transaction here
else
uint64_t remaining_delay = delay - max_delay;
sender_id = updateSenderId(sender_id); //sender id should be updated for every recursive call
// transaction to update the delay
txn.actions.emplace_back(
eosio::permission_level(from, N(active)),
N(contract_name),
N(deferred_txn),
std::make_tuple(remaining_delay,sender_id,...));
txn.delay_sec = max_delay; // here we set the new delay which is maximum until remaining_delay is less the max_delay
txn.send(eosio::string_to_name(sender_id.c_str()), from);
edited Aug 14 at 9:52
answered Aug 14 at 9:43
Umesh Maheswari
1413
1413
But updating the sender_id would have to handled carefully as at the time of cancelling we should have the latest sender_id, right?
â Rajat Chaudhary
Aug 14 at 10:04
1
@RajatChaudhary You can frame the logic for generating sender_id based on counter which increments on every recursive call. This way, you can generate it on your end by approximating the counter based on start_time of transaction and max_delay.
â Umesh Maheswari
Aug 14 at 10:24
add a comment |Â
But updating the sender_id would have to handled carefully as at the time of cancelling we should have the latest sender_id, right?
â Rajat Chaudhary
Aug 14 at 10:04
1
@RajatChaudhary You can frame the logic for generating sender_id based on counter which increments on every recursive call. This way, you can generate it on your end by approximating the counter based on start_time of transaction and max_delay.
â Umesh Maheswari
Aug 14 at 10:24
But updating the sender_id would have to handled carefully as at the time of cancelling we should have the latest sender_id, right?
â Rajat Chaudhary
Aug 14 at 10:04
But updating the sender_id would have to handled carefully as at the time of cancelling we should have the latest sender_id, right?
â Rajat Chaudhary
Aug 14 at 10:04
1
1
@RajatChaudhary You can frame the logic for generating sender_id based on counter which increments on every recursive call. This way, you can generate it on your end by approximating the counter based on start_time of transaction and max_delay.
â Umesh Maheswari
Aug 14 at 10:24
@RajatChaudhary You can frame the logic for generating sender_id based on counter which increments on every recursive call. This way, you can generate it on your end by approximating the counter based on start_time of transaction and max_delay.
â Umesh Maheswari
Aug 14 at 10:24
add a comment |Â
up vote
3
down vote
You can add an intermediate deferred transaction that will have a counter and manage the extended time you want to defer to.
Say for example that you want to delay for
365*24*60*60*2 = 63072000 blocks
which is about a year, create an action that will save this number in your multi_index and call a deferred transaction for the max delay possible 3888000. Then once the delayed transaction is called, decrement the value by 3888000 and check if it is still more than 3888000. If it is, defer it again with the max of 3888000.
If it is less, call the final action which is the one you actually wanted and delay it by the remaining number.
This will have an effect of breaking past the limit, it is sort of a while loop that extends the delay.
add a comment |Â
up vote
3
down vote
You can add an intermediate deferred transaction that will have a counter and manage the extended time you want to defer to.
Say for example that you want to delay for
365*24*60*60*2 = 63072000 blocks
which is about a year, create an action that will save this number in your multi_index and call a deferred transaction for the max delay possible 3888000. Then once the delayed transaction is called, decrement the value by 3888000 and check if it is still more than 3888000. If it is, defer it again with the max of 3888000.
If it is less, call the final action which is the one you actually wanted and delay it by the remaining number.
This will have an effect of breaking past the limit, it is sort of a while loop that extends the delay.
add a comment |Â
up vote
3
down vote
up vote
3
down vote
You can add an intermediate deferred transaction that will have a counter and manage the extended time you want to defer to.
Say for example that you want to delay for
365*24*60*60*2 = 63072000 blocks
which is about a year, create an action that will save this number in your multi_index and call a deferred transaction for the max delay possible 3888000. Then once the delayed transaction is called, decrement the value by 3888000 and check if it is still more than 3888000. If it is, defer it again with the max of 3888000.
If it is less, call the final action which is the one you actually wanted and delay it by the remaining number.
This will have an effect of breaking past the limit, it is sort of a while loop that extends the delay.
You can add an intermediate deferred transaction that will have a counter and manage the extended time you want to defer to.
Say for example that you want to delay for
365*24*60*60*2 = 63072000 blocks
which is about a year, create an action that will save this number in your multi_index and call a deferred transaction for the max delay possible 3888000. Then once the delayed transaction is called, decrement the value by 3888000 and check if it is still more than 3888000. If it is, defer it again with the max of 3888000.
If it is less, call the final action which is the one you actually wanted and delay it by the remaining number.
This will have an effect of breaking past the limit, it is sort of a while loop that extends the delay.
answered Aug 14 at 7:37
Ami Heines
814110
814110
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2feosio.stackexchange.com%2fquestions%2f1979%2fcan-we-set-the-deferred-transaction-for-the-delay-more-than-the-maximum-delay%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password