Can we set the deferred transaction for the delay more than the maximum delay?

The name of the pictureThe name of the pictureThe name of the pictureClash 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?







share|improve this question
























    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?







    share|improve this question






















      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?







      share|improve this question












      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?









      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 14 at 6:34









      Rajat Chaudhary

      595116




      595116




















          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);







          share|improve this answer






















          • 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

















          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.






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "696"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            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






























            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);







            share|improve this answer






















            • 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














            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);







            share|improve this answer






















            • 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












            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);







            share|improve this answer














            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);








            share|improve this answer














            share|improve this answer



            share|improve this answer








            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
















            • 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










            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.






            share|improve this answer
























              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.






              share|improve this answer






















                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.






                share|improve this answer












                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 14 at 7:37









                Ami Heines

                814110




                814110



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    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













































































                    Comments

                    Popular posts from this blog

                    What does second last employer means? [closed]

                    Installing NextGIS Connect into QGIS 3?

                    One-line joke