send* RPCs in the wallet returns the "fee reason" #19501

pull stackman27 wants to merge 2 commits into bitcoin:master from stackman27:send_rpc_feereason changing 8 files +71 −20
  1. stackman27 commented at 8:04 PM on July 12, 2020: contributor

    Whenever a wallet funds a transaction, the fee reason is reported to the user only if the verbose is set to true. I added an extra parameter to CreateTransaction function in wallet.cpp. Then I implemented the fee reason return logic in SendMoney in rpcwallet.cpp, followed by verbose parameter in sendtoaddress and sendmany functions. I also added a fee reason test case in walletbasic.py.

    link to the issue: https://github.com/MarcoFalke/bitcoin-core/issues/22#issue-616251578

  2. stackman27 renamed this:
    "Send rpc feereason"
    send* RPCs in the wallet returns the "fee reason"
    on Jul 12, 2020
  3. glozow commented at 8:38 PM on July 12, 2020: member

    Concept ACK!

  4. DrahtBot added the label RPC/REST/ZMQ on Jul 12, 2020
  5. DrahtBot added the label Tests on Jul 12, 2020
  6. DrahtBot added the label Wallet on Jul 12, 2020
  7. in src/wallet/feebumper.cpp:222 in 421a5a4bc4 outdated
     218 | @@ -219,7 +219,8 @@ Result CreateRateBumpTransaction(CWallet& wallet, const uint256& txid, const CCo
     219 |      CAmount fee_ret;
     220 |      int change_pos_in_out = -1; // No requested location for change
     221 |      bilingual_str fail_reason;
     222 | -    if (!wallet.CreateTransaction(recipients, tx_new, fee_ret, change_pos_in_out, fail_reason, new_coin_control, false)) {
     223 | +    std::string feeReason;
    


    achow101 commented at 11:09 PM on July 12, 2020:

    nit: Our naming convention is to use snake_case rather than camelCase.

  8. in src/wallet/rpcwallet.cpp:414 in 421a5a4bc4 outdated
     410 |      }
     411 |      pwallet->CommitTransaction(tx, std::move(map_value), {} /* orderForm */);
     412 | +
     413 | +    if(verbose){
     414 | +        entry.pushKV("hex", tx->GetHash().GetHex());
     415 | +        entry.pushKV("Fee Reason", feeReason);  
    


    achow101 commented at 11:12 PM on July 12, 2020:

    I don't think we put spaces as the key in a json object as spaces tend to break things. Typically we do lowercase snake_case.

  9. in src/wallet/rpcwallet.cpp:443 in 421a5a4bc4 outdated
     438 | @@ -430,6 +439,8 @@ static UniValue sendtoaddress(const JSONRPCRequest& request)
     439 |              "       \"" + FeeModes("\"\n\"") + "\""},
     440 |                      {"avoid_reuse", RPCArg::Type::BOOL, /* default */ "true", "(only available if avoid_reuse wallet flag is set) Avoid spending from dirty addresses; addresses are considered\n"
     441 |              "                             dirty if they have previously been used in a transaction."},
     442 | +                    {"verbose", RPCArg::Type::BOOL, /* default */ "false",
     443 | +                            "Whether to display the fee reason or not."},
    


    achow101 commented at 11:12 PM on July 12, 2020:

    It would be preferable to have this text be generic instead of specific for the fee reason. Same for the other RPCs you've changed.

  10. achow101 commented at 11:14 PM on July 12, 2020: member

    In order for cli to work, you will need to also add the new arguments to src/rpc/client.cpp.

  11. DrahtBot commented at 11:18 PM on July 12, 2020: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #20012 (rpc: Remove duplicate name and argNames from CRPCCommand by MarcoFalke)
    • #18418 (wallet: Increase OUTPUT_GROUP_MAX_ENTRIES to 100 by fjahr)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  12. MarcoFalke removed the label Tests on Jul 13, 2020
  13. in src/wallet/rpcwallet.cpp:404 in 2b15e12985 outdated
     400 | @@ -401,11 +401,20 @@ UniValue SendMoney(CWallet* const pwallet, const CCoinControl &coin_control, std
     401 |      int nChangePosRet = -1;
     402 |      bilingual_str error;
     403 |      CTransactionRef tx;
     404 | -    bool fCreated = pwallet->CreateTransaction(recipients, tx, nFeeRequired, nChangePosRet, error, coin_control, !pwallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS));
     405 | +    UniValue entry(UniValue::VOBJ);
    


    MarcoFalke commented at 5:10 AM on July 13, 2020:

    nit: I think this can be put in the (smaller) if (verbose) scope

  14. MarcoFalke approved
  15. MarcoFalke commented at 5:11 AM on July 13, 2020: member

    Concept ACK

  16. stackman27 commented at 4:03 AM on July 15, 2020: contributor

    Added a new commit: added new arguments to src/rpc/client.cpp , changed the case to snake_case, generalized the verbose description and added entry object inside verbose if.

  17. in test/functional/wallet_basic.py:656 in 9adba702eb outdated
     652 | @@ -653,6 +653,16 @@ def run_test(self):
     653 |          assert_array_result(tx["details"], {"category": "receive"}, expected_receive_vout)
     654 |          assert_equal(tx[verbose_field], self.nodes[0].decoderawtransaction(tx["hex"]))
     655 |  
     656 | +        self.log.info("Testing Fee Reason")
    


    glozow commented at 2:18 AM on July 16, 2020:

    nit: log message can be more informative, like "Test send* RPCs with verbose=True"


    glozow commented at 2:18 AM on July 16, 2020:

    Also then comments are not that necessary since it's pretty self-explanatory what you're doing


    glozow commented at 2:30 AM on July 16, 2020:

    Style-wise, if you keep comments, it's best for them to be complete sentences

  18. in src/wallet/rpcwallet.cpp:443 in 9adba702eb outdated
     438 | @@ -430,6 +439,8 @@ static UniValue sendtoaddress(const JSONRPCRequest& request)
     439 |              "       \"" + FeeModes("\"\n\"") + "\""},
     440 |                      {"avoid_reuse", RPCArg::Type::BOOL, /* default */ "true", "(only available if avoid_reuse wallet flag is set) Avoid spending from dirty addresses; addresses are considered\n"
     441 |              "                             dirty if they have previously been used in a transaction."},
     442 | +                    {"verbose", RPCArg::Type::BOOL, /* default */ "false",
     443 | +                            "Optional, the fee reason (only present when `verbose` is passed)"},
    


    glozow commented at 2:26 AM on July 16, 2020:

    This is just a tad bit confusing, I'd recommend something like "If true, return the fee reason"


    glozow commented at 2:32 AM on July 16, 2020:

    Er, something more generic would be "If true, return extra information about the transaction."

  19. glozow commented at 2:28 AM on July 16, 2020: member

    utACK

    Travis is failing on the linter though, most likely whitespace. You can run it yourself with test/lint/lint-all.sh (you might need to install a few packages). I left a bunch of nits that you can include with your changes, and then please rebase and squash.

  20. fjahr commented at 11:10 PM on July 17, 2020: member

    Concept ACK

    Please squash the fixup commits.

  21. stackman27 force-pushed on Jul 18, 2020
  22. stackman27 commented at 4:07 AM on July 18, 2020: contributor

    Update: Fixed verbose information and also the log info in wallet_basic.py, also squashed all the nit commits.

  23. stackman27 requested review from achow101 on Jul 18, 2020
  24. fjahr commented at 9:57 AM on July 18, 2020: member

    Update: Fixed verbose information and also the log info in wallet_basic.py, also squashed all the nit commits.

    Thank you! But I meant to squash the fix-ups into the original commits. Otherwise, it's harder to review because reviewers can not just go through the commits in order but need to jump back and forth to check if what they see in the first commit is not already changed in a later commit. So, for example fee_reason should be already used in the first commit.

  25. in test/functional/wallet_basic.py:660 in 2b15e12985 outdated
     658 | +        address = self.nodes[0].getnewaddress("test") 
     659 | +        txid_feeReason_one = self.nodes[2].sendtoaddress(address = address, amount = 10, verbose = True)
     660 | +        assert_equal(str(txid_feeReason_one["Fee Reason"]), "Fallback fee")
     661 | +
     662 | +        #testing send_rpc_verbose sendtoaddress
     663 | +        txid_feeReason_two = self.nodes[2].sendmany(dummy = '', amounts = {address: 10}, verbose = True) 
    


    fjahr commented at 10:01 AM on July 18, 2020:

    Linter fails here on the trailing whitespace.

  26. in test/functional/wallet_basic.py:657 in 2b15e12985 outdated
     652 | @@ -653,6 +653,16 @@ def run_test(self):
     653 |          assert_array_result(tx["details"], {"category": "receive"}, expected_receive_vout)
     654 |          assert_equal(tx[verbose_field], self.nodes[0].decoderawtransaction(tx["hex"]))
     655 |  
     656 | +        self.log.info("Testing Fee Reason")
     657 | +        #testing send_rpc_verbose sendtoaddress
     658 | +        address = self.nodes[0].getnewaddress("test") 
    


    fjahr commented at 10:01 AM on July 18, 2020:

    Also here trailing whitespace.

  27. stackman27 force-pushed on Jul 18, 2020
  28. stackman27 commented at 8:02 PM on July 18, 2020: contributor

    Squashed nit commits to [test] send rpcs returns fee reason!

  29. stackman27 requested review from fjahr on Jul 18, 2020
  30. stackman27 force-pushed on Jul 20, 2020
  31. stackman27 force-pushed on Jul 20, 2020
  32. stackman27 force-pushed on Jul 22, 2020
  33. in src/wallet/rpcwallet.cpp:411 in dbaf2e950b outdated
     408 |      if (!fCreated) {
     409 |          throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, error.original);
     410 |      }
     411 |      pwallet->CommitTransaction(tx, std::move(map_value), {} /* orderForm */);
     412 | +
     413 | +    if(verbose){
    


    laanwj commented at 8:19 PM on July 22, 2020:

    please follow the style: if (verbose) {

  34. laanwj commented at 8:21 PM on July 22, 2020: member

    Small comment on the commit messages

    * dbaf… [test] send rpcs returns fee reason (Sishir Giri) (pull/19501/head)
    * 7298… [send] send rpcs returns fee reason (Sishir Giri)
    

    I think, instead of using the same message with a different prefix, it would be clearer to make it:

    • [test] Check that send RPCs return fee reason
    • [rpc] Make send RPCs return fee reason

    Also we don't have a category [send] so make it [rpc] :smile:

  35. in src/wallet/rpcwallet.cpp:413 in 729845d1e5 outdated
     410 |      }
     411 |      pwallet->CommitTransaction(tx, std::move(map_value), {} /* orderForm */);
     412 | +
     413 | +    if(verbose){
     414 | +        UniValue entry(UniValue::VOBJ);
     415 | +        entry.pushKV("hex", tx->GetHash().GetHex());
    


    achow101 commented at 8:31 PM on July 22, 2020:

    hex usually implies the full raw transaction. This is just a txid, so this should instead be named txid.

  36. in src/wallet/rpcwallet.cpp:445 in 729845d1e5 outdated
     438 | @@ -430,6 +439,8 @@ static UniValue sendtoaddress(const JSONRPCRequest& request)
     439 |              "       \"" + FeeModes("\"\n\"") + "\""},
     440 |                      {"avoid_reuse", RPCArg::Type::BOOL, /* default */ "true", "(only available if avoid_reuse wallet flag is set) Avoid spending from dirty addresses; addresses are considered\n"
     441 |              "                             dirty if they have previously been used in a transaction."},
     442 | +                    {"verbose", RPCArg::Type::BOOL, /* default */ "false",
     443 | +                            "Optional, If true, return extra information about the transaction."},
     444 |                  },
     445 |                  RPCResult{
    


    achow101 commented at 8:32 PM on July 22, 2020:

    The RPCResult will need to be updated to include the verbose result too.


    achow101 commented at 12:09 AM on July 27, 2020:

    This isn't quite what I was looking for.

    There are 2 possible results, so we need to have different RPC results for them. getrawtransaction has a similar verbose result. I would suggest looking at that to see how this should be done.

  37. in test/functional/wallet_basic.py:667 in dbaf2e950b outdated
     652 | @@ -653,5 +653,12 @@ def run_test(self):
     653 |          assert_array_result(tx["details"], {"category": "receive"}, expected_receive_vout)
     654 |          assert_equal(tx[verbose_field], self.nodes[0].decoderawtransaction(tx["hex"]))
     655 |  
     656 | +        self.log.info("Test send* RPCs with verbose=True")
     657 | +        address = self.nodes[0].getnewaddress("test")
     658 | +        txid_feeReason_one = self.nodes[2].sendtoaddress(address = address, amount = 10, verbose = True)
     659 | +        assert_equal(str(txid_feeReason_one["fee_reason"]), "Fallback fee")
    


    achow101 commented at 8:34 PM on July 22, 2020:

    The result should already be a str so there's no need for str(...) here.

  38. stackman27 force-pushed on Jul 23, 2020
  39. stackman27 force-pushed on Jul 23, 2020
  40. stackman27 force-pushed on Jul 23, 2020
  41. stackman27 force-pushed on Jul 23, 2020
  42. stackman27 force-pushed on Jul 23, 2020
  43. stackman27 force-pushed on Jul 24, 2020
  44. stackman27 requested review from achow101 on Jul 26, 2020
  45. stackman27 requested review from laanwj on Jul 26, 2020
  46. stackman27 commented at 12:00 AM on July 27, 2020: contributor

    Resolved all the comments! Fixed travis and squash the nit commits!

  47. in src/wallet/rpcwallet.cpp:415 in 203529e6c5 outdated
     412 | -    if(verbose){
     413 | +    if (verbose) {
     414 |          UniValue entry(UniValue::VOBJ);
     415 | -        entry.pushKV("hex", tx->GetHash().GetHex());
     416 | -        entry.pushKV("fee_reason", fee_reason);  
     417 | -        return entry;    
    


    achow101 commented at 12:07 AM on July 27, 2020:

    seems like these changes should be in the previous commit

  48. luke-jr commented at 11:33 PM on July 29, 2020: member

    Thoughts on turning sendmany param 1/dummy into an options object? (And not including this functionality in sendtoaddress)

  49. in src/wallet/wallet.cpp:2705 in 203529e6c5 outdated
    2701 | @@ -2701,7 +2702,7 @@ OutputType CWallet::TransactionChangeType(const Optional<OutputType>& change_typ
    2702 |      return m_default_address_type;
    2703 |  }
    2704 |  
    2705 | -bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CTransactionRef& tx, CAmount& nFeeRet, int& nChangePosInOut, bilingual_str& error, const CCoinControl& coin_control, bool sign)
    2706 | +bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CTransactionRef& tx, CAmount& nFeeRet, int& nChangePosInOut, bilingual_str& error, const CCoinControl& coin_control, std::string& fee_reason, bool sign)
    


    luke-jr commented at 11:38 PM on July 29, 2020:

    Seems like it would work better to use FeeReason* here (or perhaps FeeCalculation*)


    stackman27 commented at 5:42 AM on July 31, 2020:

    Are you recommending changing the pointer name from fee_reason to FeeReason?


    fjahr commented at 1:16 PM on July 31, 2020:

    He is referring to the enum FeeReason or the struct FeeCalculation to be used here instead of a string.


    stackman27 commented at 1:00 AM on August 13, 2020:

    How would i go about that because i'd have to change everything that calls createTransaction and also the UniValue entry string type? I'm just a bit confused because when I change its type to FeeReason* , I get bombarded with errors


    fjahr commented at 8:38 PM on August 13, 2020:

    Yes, it's not just a change in this line. The other places where you pass in a string now you will need to use the FeeReason* type as well (as you have already noticed). You also won't convert the reason to a string in this function but where you actually need it as a string. But most importantly: take your time to and try to understand these errors. Once you understand them they can guide you to the right solution.


    stackman27 commented at 6:10 AM on September 9, 2020:

    I changed the str fee reason to struct FeeCalculation

  50. stackman27 force-pushed on Jul 31, 2020
  51. stackman27 force-pushed on Jul 31, 2020
  52. stackman27 force-pushed on Jul 31, 2020
  53. stackman27 force-pushed on Jul 31, 2020
  54. stackman27 force-pushed on Jul 31, 2020
  55. DrahtBot added the label Needs rebase on Jul 31, 2020
  56. stackman27 force-pushed on Aug 3, 2020
  57. DrahtBot removed the label Needs rebase on Aug 3, 2020
  58. in ~:1 in 31a2acaf72 outdated
       0 | @@ -0,0 +1,29 @@
       1 | +pick c321fe670 [send] Make send RPCs return fee reason
    


    instagibbs commented at 3:18 PM on August 5, 2020:

    uhhh, this looks like an accidental file addition? :)


    stackman27 commented at 8:20 PM on September 18, 2020:

    Fixed it

  59. in src/wallet/rpcwallet.cpp:851 in 31a2acaf72 outdated
     844 | @@ -831,10 +845,16 @@ static UniValue sendmany(const JSONRPCRequest& request)
     845 |                      {"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks), or fee rate (for " + CURRENCY_UNIT + "/kB or " + CURRENCY_ATOM + "/B estimate modes)"},
     846 |                      {"estimate_mode", RPCArg::Type::STR, /* default */ "unset", std::string() + "The fee estimate mode, must be one of (case insensitive):\n"
     847 |              "       \"" + FeeModes("\"\n\"") + "\""},
     848 | +                    {"verbose", RPCArg::Type::BOOL, /* default */ "false",
     849 | +                            "Optional, If true, return extra information about the transaction."},
    


    instagibbs commented at 3:20 PM on August 5, 2020:

    s/Optional, // no need to say optional.

  60. in src/wallet/rpcwallet.cpp:446 in 31a2acaf72 outdated
     436 | @@ -430,9 +437,15 @@ static UniValue sendtoaddress(const JSONRPCRequest& request)
     437 |              "       \"" + FeeModes("\"\n\"") + "\""},
     438 |                      {"avoid_reuse", RPCArg::Type::BOOL, /* default */ "true", "(only available if avoid_reuse wallet flag is set) Avoid spending from dirty addresses; addresses are considered\n"
     439 |              "                             dirty if they have previously been used in a transaction."},
     440 | +                    {"verbose", RPCArg::Type::BOOL, /* default */ "false",
     441 | +                            "Optional, If true, return extra information about the transaction."},
     442 |                  },
     443 |                  RPCResult{
     444 | -                    RPCResult::Type::STR_HEX, "txid", "The transaction id."
     445 | +                    RPCResult::Type::OBJ, "", "",
    


    instagibbs commented at 3:21 PM on August 5, 2020:

    yay for object instead of string result, can add more things going forward.


    MarcoFalke commented at 6:21 PM on September 23, 2020:

    This will need to be two RPCResults (one for verbose=False and one for verbose=True). Refer to other places in the code base on how to do that.

  61. in src/wallet/rpcwallet.cpp:443 in 31a2acaf72 outdated
     436 | @@ -430,9 +437,15 @@ static UniValue sendtoaddress(const JSONRPCRequest& request)
     437 |              "       \"" + FeeModes("\"\n\"") + "\""},
     438 |                      {"avoid_reuse", RPCArg::Type::BOOL, /* default */ "true", "(only available if avoid_reuse wallet flag is set) Avoid spending from dirty addresses; addresses are considered\n"
     439 |              "                             dirty if they have previously been used in a transaction."},
     440 | +                    {"verbose", RPCArg::Type::BOOL, /* default */ "false",
     441 | +                            "Optional, If true, return extra information about the transaction."},
    


    instagibbs commented at 3:21 PM on August 5, 2020:

    s/Optional, // no need to say optional.

  62. instagibbs commented at 3:24 PM on August 5, 2020: member

    concept ACK @luke-jr Previously I was told due to named args we don't have to stick everything in an object argument.

  63. laanwj commented at 6:21 PM on August 6, 2020: member

    Travis:

    * Checking consistency between dispatch tables and vRPCConvertParams
    
    The subject line of commit hash c8992e89594a54edf283e4916f794475070b5114 is followed by a non-empty line. Subject lines should always be followed by a blank line.
    

    (you need an empty line between the commit title and the body)

  64. fjahr commented at 11:20 PM on August 7, 2020: member

    Travis:

    * Checking consistency between dispatch tables and vRPCConvertParams
    
    The subject line of commit hash c8992e89594a54edf283e4916f794475070b5114 is followed by a non-empty line. Subject lines should always be followed by a blank line.
    

    (you need an empty line between the commit title and the body)

    It's not his fault, the new linter was buggy. The offending commit https://github.com/bitcoin/bitcoin/commit/c8992e89594a54edf283e4916f794475070b5114 is not part of this PR. Should be fixed with #19654. I restarted the job and it should pass that linter.

  65. stackman27 force-pushed on Aug 13, 2020
  66. stackman27 force-pushed on Aug 13, 2020
  67. stackman27 force-pushed on Aug 13, 2020
  68. stackman27 force-pushed on Aug 13, 2020
  69. DrahtBot added the label Needs rebase on Aug 17, 2020
  70. stackman27 force-pushed on Sep 7, 2020
  71. DrahtBot removed the label Needs rebase on Sep 7, 2020
  72. stackman27 force-pushed on Sep 7, 2020
  73. stackman27 force-pushed on Sep 7, 2020
  74. stackman27 requested review from luke-jr on Sep 7, 2020
  75. stackman27 requested review from achow101 on Sep 7, 2020
  76. stackman27 requested review from instagibbs on Sep 7, 2020
  77. stackman27 force-pushed on Sep 7, 2020
  78. stackman27 force-pushed on Sep 8, 2020
  79. stackman27 commented at 1:02 AM on September 9, 2020: contributor

    Rebased and Changed str feereason to FeeCalculation*

  80. DrahtBot added the label Needs rebase on Sep 15, 2020
  81. stackman27 force-pushed on Sep 15, 2020
  82. stackman27 force-pushed on Sep 15, 2020
  83. DrahtBot removed the label Needs rebase on Sep 15, 2020
  84. stackman27 commented at 6:12 AM on September 17, 2020: contributor

    Rebased and fixed all the changes

  85. stackman27 requested review from MarcoFalke on Sep 20, 2020
  86. DrahtBot added the label Needs rebase on Sep 23, 2020
  87. in src/wallet/wallet.h:977 in 82c878455b outdated
     973 | @@ -974,7 +974,7 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
     974 |       * selected by SelectCoins(); Also create the change output, when needed
     975 |       * @note passing nChangePosInOut as -1 will result in setting a random position
     976 |       */
     977 | -    bool CreateTransaction(const std::vector<CRecipient>& vecSend, CTransactionRef& tx, CAmount& nFeeRet, int& nChangePosInOut, bilingual_str& error, const CCoinControl& coin_control, bool sign = true);
     978 | +    bool CreateTransaction(const std::vector<CRecipient>& vecSend, CTransactionRef& tx, CAmount& nFeeRet, int& nChangePosInOut, bilingual_str& error, const CCoinControl& coin_control, FeeCalculation& feecalc_feereason, bool sign = true);
    


    MarcoFalke commented at 6:25 PM on September 23, 2020:
        bool CreateTransaction(const std::vector<CRecipient>& vecSend, CTransactionRef& tx, CAmount& nFeeRet, int& nChangePosInOut, bilingual_str& error, const CCoinControl& coin_control, FeeCalculation& fee_calc_out, bool sign = true);
    

    Could rename to fee_calc_out to clarify that this is an out param?


    stackman27 commented at 7:30 PM on September 25, 2020:

    Changed the variable name from feecalc_feereason to `fee_calc_out'


    stackman27 commented at 7:30 PM on September 25, 2020:

    Also added two RPCResult in sendtoaddress and sendmany

  88. MarcoFalke approved
  89. MarcoFalke commented at 6:25 PM on September 23, 2020: member

    Looks good, but the feedback about the rpc documentation should be fixed

  90. stackman27 force-pushed on Sep 24, 2020
  91. DrahtBot removed the label Needs rebase on Sep 24, 2020
  92. stackman27 force-pushed on Sep 25, 2020
  93. stackman27 force-pushed on Sep 25, 2020
  94. stackman27 requested review from MarcoFalke on Sep 25, 2020
  95. in src/wallet/rpcwallet.cpp:886 in 086f402fee outdated
     881 | +                    RPCResult{"if verbose is set to true",
     882 | +                        RPCResult::Type::OBJ, "", "",
     883 | +                        {
     884 | +                            {RPCResult::Type::STR_HEX, "txid", "The transaction id for the send. Only 1 transaction is created regardless of\n"
     885 | +                "the number of addresses."},
     886 | +                            {RPCResult::Type::BOOL, "fee reason", "The transaction fee reason."}
    


    MarcoFalke commented at 10:23 AM on September 26, 2020:
                                {RPCResult::Type::STR, "fee reason", "The transaction fee reason."}
    

    stackman27 commented at 1:03 AM on September 27, 2020:

    code adjusted based on the feedback. Removed str from [test] and changed rpc result return to str

  96. MarcoFalke approved
  97. MarcoFalke commented at 10:24 AM on September 26, 2020: member
  98. [send] Make send RPCs return fee reason d5863c0b3e
  99. stackman27 force-pushed on Sep 27, 2020
  100. stackman27 force-pushed on Sep 27, 2020
  101. MarcoFalke commented at 9:26 AM on September 27, 2020: member

    ACK a3fe42c140008b7dbbef55b3d75c56d2c6343c43

  102. stackman27 commented at 8:24 PM on September 28, 2020: contributor

    @luke-jr @instagibbs @laanwj @fjahr could you please verify whether I've resolved all the problems that you've highlighted? Thank you

  103. in test/functional/wallet_basic.py:669 in a3fe42c140 outdated
     660 | @@ -661,5 +661,13 @@ def run_test(self):
     661 |          assert_array_result(tx["details"], {"category": "receive"}, expected_receive_vout)
     662 |          assert_equal(tx[verbose_field], self.nodes[0].decoderawtransaction(tx["hex"]))
     663 |  
     664 | +        self.log.info("Test send* RPCs with verbose=True")
     665 | +        address = self.nodes[0].getnewaddress("test")
     666 | +        txid_feeReason_one = self.nodes[2].sendtoaddress(address = address, amount = 10, verbose = True)
     667 | +        assert_equal(txid_feeReason_one["fee_reason"], "Fallback fee")
     668 | +        txid_feeReason_two = self.nodes[2].sendmany(dummy = '', amounts = {address: 10}, verbose = True)
     669 | +        assert_equal(txid_feeReason_two["fee_reason"], "Fallback fee")
    


    instagibbs commented at 8:46 PM on September 28, 2020:

    maybe add a case where you explicitly pass in verbose = False to cover that case too :+1:


    stackman27 commented at 10:00 PM on September 28, 2020:

    Added verbose = False case in test file

  104. instagibbs commented at 8:46 PM on September 28, 2020: member

    ACK a3fe42c140008b7dbbef55b3d75c56d2c6343c43

  105. stackman27 force-pushed on Sep 28, 2020
  106. stackman27 force-pushed on Sep 28, 2020
  107. stackman27 force-pushed on Sep 28, 2020
  108. stackman27 force-pushed on Sep 28, 2020
  109. [test] Make sure send rpc returns fee reason 69cf5d4eeb
  110. stackman27 force-pushed on Sep 28, 2020
  111. in src/wallet/rpcwallet.cpp:517 in d5863c0b3e outdated
     513 | @@ -497,8 +514,9 @@ static RPCHelpMan sendtoaddress()
     514 |  
     515 |      std::vector<CRecipient> recipients;
     516 |      ParseRecipients(address_amounts, subtractFeeFromAmount, recipients);
     517 | +    bool verbose = request.params[9].isNull() ? false: request.params[9].get_bool();
    


    meshcollider commented at 11:43 AM on September 29, 2020:

    micro-nit: spacing between false:


    stackman27 commented at 7:27 PM on September 29, 2020:

    for some reason git is ignoring my whitespace changes. Any suggestions on how to fix that?

  112. in src/wallet/rpcwallet.cpp:878 in d5863c0b3e outdated
     870 | @@ -853,11 +871,22 @@ static RPCHelpMan sendmany()
     871 |                      {"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks), or fee rate (for " + CURRENCY_UNIT + "/kB or " + CURRENCY_ATOM + "/B estimate modes)"},
     872 |                      {"estimate_mode", RPCArg::Type::STR, /* default */ "unset", std::string() + "The fee estimate mode, must be one of (case insensitive):\n"
     873 |              "       \"" + FeeModes("\"\n\"") + "\""},
     874 | +                    {"verbose", RPCArg::Type::BOOL, /* default */ "false", "If true, return extra infomration about the transaction."},
     875 | +                },
     876 | +                {
     877 | +                    RPCResult{"if verbose is not set or set to false",
     878 | +                        RPCResult::Type::STR_HEX, "txid", "The transaction id for the send. Only  1 transaction is created regardless of\n"
    


    meshcollider commented at 11:45 AM on September 29, 2020:

    micro-nit: double space between Only 1

  113. meshcollider commented at 11:53 AM on September 29, 2020: contributor

    utACK 69cf5d4eeb73f7d685e915fc17af64634d88a4a2

  114. stackman27 force-pushed on Sep 29, 2020
  115. meshcollider commented at 8:15 PM on September 29, 2020: contributor

    @stackman27 if there are a couple of ACKs then it's better not to fix small nits and leave them in case there's a bigger change that needs to be done. Small spacing nits, etc. won't stop a merge :smile:

  116. stackman27 commented at 8:17 PM on September 29, 2020: contributor

    @stackman27 if there are a couple of ACKs then it's better not to fix small nits and leave them in case there's a bigger change that needs to be done. Small spacing nits, etc. won't stop a merge 😄

    Okay for sure! Thank you

  117. MarcoFalke commented at 5:59 AM on September 30, 2020: member

    Mind force pushing the previous reviewed version?

    git push your_remote 69cf5d4:send_rpc_feereason -f
    

    ?

  118. stackman27 force-pushed on Sep 30, 2020
  119. stackman27 commented at 6:04 AM on September 30, 2020: contributor

    Mind force pushing the previous reviewed version?

    git push your_remote 69cf5d4:send_rpc_feereason -f
    

    ?

    Yes just pushed!

  120. MarcoFalke merged this on Sep 30, 2020
  121. MarcoFalke closed this on Sep 30, 2020

  122. sidhujag referenced this in commit 948d3d36cd on Sep 30, 2020
  123. DrahtBot locked this on Feb 15, 2022

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-02 15:14 UTC

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