bitcoin-tx replaceable value should be optional, but isn’t #28638

issue dooglus openend this issue on October 11, 2023
  1. dooglus commented at 10:40 pm on October 11, 2023: contributor

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    The help text says:

    0  replaceable(=N)
    1       Set RBF opt-in sequence number for input N (if not provided, opt-in all
    2       available inputs)
    

    but when I don’t provide N, I get an error:

    0$ bitcoin-tx -create in=0000000000000000000000000000000000000000000000000000000000000000:0 replaceable
    1error: Invalid TX input index ''
    

    Expected behaviour

    I expect bitcoin-tx to act like its help string describes:

    0$ bitcoin-tx -create in=0000000000000000000000000000000000000000000000000000000000000000:0 replaceable
    1020000000100000000000000000000000000000000000000000000000000000000000000000000000000fdffffff0000000000
    

    The fix is simple:

     0diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
     1index a05443a2e5..b9348fcad0 100644
     2--- a/src/bitcoin-tx.cpp
     3+++ b/src/bitcoin-tx.cpp
     4@@ -222,7 +222,7 @@ static void MutateTxRBFOptIn(CMutableTransaction& tx, const std::string& strInId
     5 {
     6     // parse requested index
     7     int64_t inIdx;
     8-    if (!ParseInt64(strInIdx, &inIdx) || inIdx < 0 || inIdx >= static_cast<int64_t>(tx.vin.size())) {
     9+    if (strInIdx != "" && (!ParseInt64(strInIdx, &inIdx) || inIdx < 0 || inIdx >= static_cast<int64_t>(tx.vin.size()))) {
    10         throw std::runtime_error("Invalid TX input index '" + strInIdx + "'");
    11     }
    12 
    

    Steps to reproduce

    Run the command shown above.

    Relevant log output

    No response

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    master@e3eb3aae3

    Operating system and version

    Debian 12

    Machine specifications

    No response

  2. dooglus commented at 10:50 pm on October 11, 2023: contributor
    Aside: shouldn’t bitcoin-tx default to making replaceable transactions, to match what bitcoind and bitcoin-qt do?
  3. maflcko commented at 3:30 pm on December 14, 2023: member
  4. maflcko added the label Utils/log/libs on Dec 14, 2023
  5. achow101 closed this on Dec 14, 2023


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: 2024-11-21 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me