[RPC][Bitcoin-TX] Add support for sequence number #7957

pull jonasschnelli wants to merge 3 commits into bitcoin:master from jonasschnelli:2016/04/rbf_base changing 6 files +41 −8
  1. jonasschnelli commented at 1:42 PM on April 27, 2016: contributor

    No description provided.

  2. [RPC] createrawtransaction: add option to set the sequence number per input a946bb6b18
  3. [bitcoin-tx] allow to set nSequence number over the in= command e59336fbf9
  4. jonasschnelli added the label RPC/REST/ZMQ on Apr 27, 2016
  5. jonasschnelli added the label Utils and libraries on Apr 27, 2016
  6. jonasschnelli force-pushed on Apr 27, 2016
  7. jonasschnelli commented at 1:43 PM on April 27, 2016: contributor

    Subset PR as requested in #7865.

  8. in src/rpc/rawtransaction.cpp:None in e59336fbf9 outdated
     384 | @@ -384,6 +385,12 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
     385 |              throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive");
     386 |  
     387 |          uint32_t nSequence = (rawTx.nLockTime ? std::numeric_limits<uint32_t>::max() - 1 : std::numeric_limits<uint32_t>::max());
     388 | +
     389 | +        // set the sequence number if passed in the parameters object
     390 | +        const UniValue& sequenceObj = find_value(o, "sequence");
     391 | +        if (sequenceObj.isNum())
     392 | +            nSequence = sequenceObj.get_int();
     393 | +
    


    mruddy commented at 1:03 AM on April 28, 2016:

    Neat, this is useful. I was trying it out and think that being able to use hex is a little easier. Maybe something like this:

    if (sequenceObj.isNum())
    {
        nSequence = sequenceObj.get_int();
    } else if (sequenceObj.isStr() /*&& IsHex(sequenceObj.get_str())*/)
    {
        nSequence = strtoul(sequenceObj.get_str().c_str(), NULL, 16);
    }
    

    I commented out the IsHex check because I think it might be too restrictive (but left it there to see what you thought). With this little patch, these work too:

    createrawtransaction '[{"txid":"d5eb7e43a7cf85c5bee47a7a33c8351b8dcc013616a7c6bdc3af49538d986221","vout":0,"sequence":"0xfffffffe"}]' '{"mifzFw94bSGApmx2eWw1nzLCfEeq4cTwey":49.99}' 0
    createrawtransaction '[{"txid":"d5eb7e43a7cf85c5bee47a7a33c8351b8dcc013616a7c6bdc3af49538d986221","vout":0,"sequence":"fffffffd"}]' '{"mifzFw94bSGApmx2eWw1nzLCfEeq4cTwey":49.99}' 0
    createrawtransaction '[{"txid":"d5eb7e43a7cf85c5bee47a7a33c8351b8dcc013616a7c6bdc3af49538d986221","vout":0,"sequence":"f"}]' '{"mifzFw94bSGApmx2eWw1nzLCfEeq4cTwey":49.99}' 0
    

    jonasschnelli commented at 7:46 AM on April 28, 2016:

    Thanks for the review! Hmm... I'm not sure if we want utility function (hex->int) on machine-to-machine communication (RPC). But no strong opinion.


    mruddy commented at 11:40 AM on April 28, 2016:

    Good point, I was thinking of only the GUI RPC console use (that's where the hex conversion is useful to me). If your threat model includes hostile input on this interface, then the IsHex check could be used and the length of the string could be validated to be <= 8. That would likely be sufficient input validation. Adding back IsHex makes my first and third examples invalid. The sequence value of the third would need to change to "0f" instead of just "f".

  9. jonasschnelli cross-referenced this on Apr 28, 2016 from issue [RPC] Add bumpfee command. by jonasschnelli
  10. sipa commented at 3:00 PM on June 2, 2016: member

    utACK e59336fbf9b906bf05d50a732036613216898bd1

  11. [Bitcoin-Tx] Add tests for sequence number support ae357d5ab9
  12. jonasschnelli commented at 3:39 PM on June 7, 2016: contributor

    Added a commit with two bitcoin-tx tests to cover the sequence number feature.

  13. laanwj merged this on Jun 7, 2016
  14. laanwj closed this on Jun 7, 2016

  15. laanwj referenced this in commit 79004d4ae6 on Jun 7, 2016
  16. laanwj commented at 4:28 PM on June 7, 2016: member

    utACK ae357d5

  17. jonasschnelli cross-referenced this on Jun 7, 2016 from issue [Bitcoin-Tx] fix missing test fixtures, fix 32bit atoi issue by jonasschnelli
  18. jonasschnelli cross-referenced this on Jun 8, 2016 from issue [RPC] Fix createrawtx sequence number unsigned int parsing by jonasschnelli
  19. codablock referenced this in commit b1ad52ad4a on Sep 16, 2017
  20. codablock referenced this in commit 8d2df32ba6 on Sep 19, 2017
  21. codablock referenced this in commit 9af87c8269 on Dec 22, 2017
  22. str4d cross-referenced this on Mar 14, 2018 from issue CLI binary improvements by str4d
  23. MarcoFalke cross-referenced this on Mar 23, 2018 from issue Create a generalized rpc command for creating a transaction by RHavar
  24. zkbot referenced this in commit 3b0a5bcd24 on Apr 13, 2018
  25. zkbot referenced this in commit 65a8f9f201 on Apr 13, 2018
  26. dagurval cross-referenced this on Apr 27, 2018 from issue [RPC][Bitcoin-TX] Add support for sequence number by dagurval
  27. sickpig referenced this in commit 6c5d05a107 on May 4, 2018
  28. sickpig cross-referenced this on May 4, 2018 from issue Port XT PR #403: [RPC][Bitcoin-TX] Add support for sequence number by sickpig
  29. sickpig referenced this in commit 638b66ecdb on May 9, 2018
  30. andvgal referenced this in commit 72bf4f61eb on Jan 6, 2019
  31. bitcoin locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:55 UTC