wallet/rpc: sendrawtransaction maxfeerate #13541

pull kallewoof wants to merge 3 commits into bitcoin:master from kallewoof:sendrawtransaction-maxfeerate changing 15 files +157 −88
  1. kallewoof commented at 8:24 am on June 27, 2018: member

    This adds a new maxfeerate parameter to sendrawtransaction which forces the node to reject a transaction whose feerate is above the given fee rate.

    This is a safety harness from shooting yourself in the foot and accidentally overpaying fees.

    See also #12911.

  2. fanquake added the label RPC/REST/ZMQ on Jun 27, 2018
  3. fanquake added the label Wallet on Jun 27, 2018
  4. kallewoof force-pushed on Jun 27, 2018
  5. NicolasDorier commented at 8:49 am on June 27, 2018: contributor

    Your PR show me actually that maxtxfee exists, which is uncorrelated with absurd fee we were talking about.

    One could say that changing maxtxfee or having maxtxfeerate at config level would solve the issue without touching RPC. But, when you do a transaction manually, you know the maxfeerate to expect when you call sendrawtransaction, not when you modify the config file of bitcoind.

    ACK.

    (That said, I think this would be better in signrawtransaction* than sendrawtransaction)

  6. kallewoof commented at 8:57 am on June 27, 2018: member

    Your PR show me actually that maxtxfee exists, which is uncorrelated with absurd fee we were talking about.

    Yes, absurdfee can actually be specified for each call to AcceptToMempool, so it can be used after all.

    One could say that changing maxtxfee or having maxtxfeerate at config level would solve the issue without touching RPC. But, when you do a transaction manually, you know the maxfeerate to expect when you call sendrawtransaction, not when you modify the config file of bitcoind.

    I think having a configurable default maxtxfee would be a good idea. Perhaps this function should then ignore the default if the user does allowhighfees=true.

    (That said, I think this would be better in signrawtransaction* than sendrawtransaction)

    It fits better here, because it already has the functionality needed in the AcceptToMemoryPool function via the absurd fee feature. In sign, you sometimes do not know the input amounts, which means the system sometimes can’t check. Here, the amounts are always known because the mempool either knows or the tx is invalid.

  7. in test/functional/rpc_rawtransaction.py:390 in 43d2cce4aa outdated
    385+        self.log.info('sendrawtransaction with maxfeerate')
    386+
    387+        addr = self.nodes[2].getnewaddress()
    388+        txId = self.nodes[0].sendtoaddress(addr, 1.0)
    389+        rawTx = self.nodes[0].getrawtransaction(txId, True)
    390+        vout = False
    


    promag commented at 1:36 pm on June 27, 2018:
    = None?

    promag commented at 2:12 pm on June 27, 2018:

    Alternative (not tested)

    0vout = next(o for o in rawTx['vout'] if o['value'] == Decimal('1.00000000'))
    

    kallewoof commented at 10:56 pm on June 27, 2018:
    Several copies of this in rpc_rawtransaction, so I made a dedicated commit to address the others.
  8. in src/rpc/rawtransaction.cpp:1087 in 43d2cce4aa outdated
    1086@@ -1087,14 +1087,15 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
    1087 
    1088 static UniValue sendrawtransaction(const JSONRPCRequest& request)
    1089 {
    1090-    if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
    1091+    if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
    1092         throw std::runtime_error(
    1093             "sendrawtransaction \"hexstring\" ( allowhighfees )\n"
    


    promag commented at 1:41 pm on June 27, 2018:
    Missing parameter.
  9. in src/rpc/rawtransaction.cpp:1124 in 43d2cce4aa outdated
    1121@@ -1123,6 +1122,13 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
    1122     if (!request.params[1].isNull() && request.params[1].get_bool())
    1123         nMaxRawTxFee = 0;
    1124 
    1125+    if (!request.params[2].isNull()) {
    1126+        size_t weight = GetTransactionWeight(*tx);
    1127+        CFeeRate fr(AmountFromValue(request.params[2]));
    1128+        CAmount max_fee = fr.GetFee((weight+3)/4);
    1129+        nMaxRawTxFee = nMaxRawTxFee > 0 ? std::min(nMaxRawTxFee, max_fee) : max_fee;
    


    promag commented at 1:41 pm on June 27, 2018:
    When specifying maxfeerate does it make sense to pass allowhighfees=true?

    kallewoof commented at 10:58 pm on June 27, 2018:
    I am sort of overriding allowhighfees right now. I could disallow it completely, i.e. require that it is null or false, if using maxfeerate, but not sure it’s worth it.

    kallewoof commented at 10:59 pm on June 27, 2018:
    To more directly answer your question, though, allowhighfees=true will simply remove the existing absurd fee cap (which is 0.1 btc I believe), so if maxfeerate was really high, it actually could result in a slightly higher cap.

    luke-jr commented at 6:53 pm on July 29, 2018:
    Just have a single parameter… if it’s a boolean, it’s the (deprecated?) allowhighfees; if a number, then a specific limit.

    promag commented at 11:09 pm on July 29, 2018:
    @luke-jr does that work with named parameters?

    kallewoof commented at 9:45 am on July 30, 2018:

    does that work with named parameters?

    Yes, it is already used by getbalance:

    https://github.com/bitcoin/bitcoin/blob/222e627322ce4de3292259a4868d23983f2a5394/src/wallet/rpcwallet.cpp#L4784

  10. kallewoof force-pushed on Jun 27, 2018
  11. kallewoof force-pushed on Jun 27, 2018
  12. kallewoof force-pushed on Jul 12, 2018
  13. kallewoof force-pushed on Jul 13, 2018
  14. kallewoof force-pushed on Jul 13, 2018
  15. kallewoof force-pushed on Jul 13, 2018
  16. kallewoof force-pushed on Jul 13, 2018
  17. kallewoof force-pushed on Jul 13, 2018
  18. kallewoof force-pushed on Jul 30, 2018
  19. kallewoof force-pushed on Jul 30, 2018
  20. kallewoof force-pushed on Jul 30, 2018
  21. kallewoof force-pushed on Jul 31, 2018
  22. kallewoof force-pushed on Jul 31, 2018
  23. kallewoof force-pushed on Jul 31, 2018
  24. kallewoof force-pushed on Jul 31, 2018
  25. DrahtBot commented at 2:13 am on August 12, 2018: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #15282 (test: Replace hard-coded hex tx with class in test framework by stevenroose)
    • #14691 (tests: Speedup feature_pruning test and refactor big transaction logic by conscott)
    • #14053 (Add address-based index (attempt 4?) by marcinja)

    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.

  26. in src/rpc/rawtransaction.cpp:1092 in dbd466c212 outdated
    1089             "\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n"
    1090             "\nAlso see createrawtransaction and signrawtransaction calls.\n"
    1091             "\nArguments:\n"
    1092             "1. \"hexstring\"    (string, required) The hex string of the raw transaction)\n"
    1093-            "2. allowhighfees    (boolean, optional, default=false) Allow high fees\n"
    1094+            "2. allowhighfees|maxfeerate (boolean/numeric, optional, default=false/∞) Allow high fees (boolean) or reject transactions whose fee rate is higher than the specified value (numeric), expressed in " + CURRENCY_UNIT + "/kB\n"
    


    meshcollider commented at 4:34 am on November 10, 2018:
    Shouldn’t this default be whatever maxTxFee is, not ?

    kallewoof commented at 7:00 am on November 12, 2018:

    Fixed - it now outputs

    02. allowhighfees|maxfeerate (boolean/numeric, optional, default=false/0.10) Allow 
    1high fees (boolean) or reject transactions whose fee rate is higher than the 
    2specified value (numeric), expressed in BTC/kB
    

    for the default settings.

  27. in src/rpc/rawtransaction.cpp:1059 in dbd466c212 outdated
    1118+    if (request.params[1].isBool()) {
    1119+        if (request.params[1].get_bool()) nMaxRawTxFee = 0;
    1120+    } else if (request.params[1].isNum()) {
    1121+        size_t weight = GetTransactionWeight(*tx);
    1122+        CFeeRate fr(AmountFromValue(request.params[1]));
    1123+        nMaxRawTxFee = fr.GetFee((weight+3)/4);
    


    meshcollider commented at 4:42 am on November 10, 2018:
    Might be good to add a quick comment here to clarify the +3/4 is for rounding

    kallewoof commented at 7:02 am on November 12, 2018:
    Added note.
  28. kallewoof force-pushed on Nov 12, 2018
  29. kallewoof force-pushed on Nov 12, 2018
  30. DrahtBot added the label Needs rebase on Nov 13, 2018
  31. kallewoof force-pushed on Nov 14, 2018
  32. DrahtBot removed the label Needs rebase on Nov 14, 2018
  33. DrahtBot added the label Needs rebase on Nov 23, 2018
  34. kallewoof force-pushed on Nov 26, 2018
  35. kallewoof force-pushed on Nov 26, 2018
  36. DrahtBot removed the label Needs rebase on Nov 26, 2018
  37. DrahtBot added the label Needs rebase on Dec 5, 2018
  38. kallewoof force-pushed on Dec 10, 2018
  39. DrahtBot removed the label Needs rebase on Dec 10, 2018
  40. DrahtBot added the label Needs rebase on Jan 29, 2019
  41. kallewoof force-pushed on Jan 30, 2019
  42. DrahtBot removed the label Needs rebase on Jan 30, 2019
  43. MarcoFalke added the label Needs rebase on Feb 12, 2019
  44. in src/rpc/rawtransaction.cpp:1025 in fe1db7ebf7 outdated
    1021@@ -1021,7 +1022,7 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
    1022                 "\nAlso see createrawtransaction and signrawtransactionwithkey calls.\n",
    1023                 {
    1024                     {"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex string of the raw transaction"},
    1025-                    {"allowhighfees", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Allow high fees"},
    1026+                    {"maxfeerate", RPCArg::Type::AMOUNT, /* opt */ true,  /* default_val */ FormatMoney(maxTxFee), "Allow high fees (boolean) or reject transactions whose fee rate is higher than the specified value (numeric), expressed in " + CURRENCY_UNIT + "/kB\n"},
    


    MarcoFalke commented at 11:55 pm on February 12, 2019:
    0                    {"maxfeerate", RPCArg::Type::AMOUNT, /* default */ FormatMoney(maxTxFee), "Allow high fees (boolean) or reject transactions whose fee rate is higher than the specified value (numeric), expressed in " + CURRENCY_UNIT + "/kB\n"},
    
  45. kallewoof force-pushed on Feb 13, 2019
  46. DrahtBot removed the label Needs rebase on Feb 13, 2019
  47. MarcoFalke commented at 5:28 pm on February 13, 2019: member
    Could do the same for testmempoolaccept (since that is just a mirror of sendraw)
  48. kallewoof commented at 8:20 am on February 14, 2019: member
    @MarcoFalke Done!
  49. kallewoof commented at 8:41 am on February 14, 2019: member
    I also tentatively moved maxTxFee from validation into wallet in fc29a5a – I don’t know if this should be a separate PR or not, but it seems this move is desired? Unexpected complications; dropping commit.
  50. DrahtBot added the label Needs rebase on Feb 14, 2019
  51. kallewoof force-pushed on Feb 14, 2019
  52. DrahtBot removed the label Needs rebase on Feb 14, 2019
  53. kallewoof force-pushed on Feb 14, 2019
  54. DrahtBot added the label Needs rebase on Feb 15, 2019
  55. kallewoof force-pushed on Feb 15, 2019
  56. kallewoof force-pushed on Feb 15, 2019
  57. DrahtBot removed the label Needs rebase on Feb 15, 2019
  58. in src/rpc/rawtransaction.cpp:1042 in 0d40ad42af outdated
    1035@@ -1035,7 +1036,7 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
    1036                 "\nAlso see createrawtransaction and signrawtransactionwithkey calls.\n",
    1037                 {
    1038                     {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex string of the raw transaction"},
    1039-                    {"allowhighfees", RPCArg::Type::BOOL, /* default */ "false", "Allow high fees"},
    1040+                    {"maxfeerate", RPCArg::Type::AMOUNT, /* default */ FormatMoney(maxTxFee), "Allow high fees (boolean) or reject transactions whose fee rate is higher than the specified value (numeric), expressed in " + CURRENCY_UNIT + "/kB\n"},
    


    jnewbery commented at 8:01 pm on February 19, 2019:

    My personal preference would be to not overload a parameter with two possible types and just remove the boolean option here. I think it’s ok to leave the boolean accepting logic below as a courtesy to existing users, but that should eventually be removed and it shouldn’t be advertised in the help text.

    Same for testmempoolaccept below.


    MarcoFalke commented at 2:58 pm on February 20, 2019:
    If bool is no longer mentioned here, the transition should be mentioned in the release notes, though

    kallewoof commented at 9:14 am on February 21, 2019:

    I’m hesitant to allow some hidden underlying default max fee when using a boolean. If we are removing the option, we should remove it completely, not just from the documentation.

    I do realize that the way things are currently, someone who uses ‘1’ as boolean true will accept any fees up to 1 BTC/kB, which is rather high. Maybe removing the boolean style completely is actually the way to go.


    MarcoFalke commented at 4:27 pm on February 22, 2019:

    Maybe removing the boolean style completely is actually the way to go.

    I tend to agree with your idea. An option could be to have a -deprecatedrpc=sendrawtransaction -deprecatedrpc=testmempoolaccept to toggle back to the bool behavior.


    jnewbery commented at 4:51 pm on February 22, 2019:

    An option could be to have a -deprecatedrpc=sendrawtransaction

    That’s one way, although I think it may be overkill. How about catching if a bool is passed, and then returning an error message telling the user to set ‘maxreerate’ to 0, which maintains exactly the same behaviour. Code:

    0    // TODO: temporary migration code for old clients. Remove in v0.21
    1    if (request.params[1].isBool()) {
    2        throw JSONRPCError(RPC_INVALID_PARAMETER, "Second argument must be numeric (maxfeerate) and no longer supports a boolean. To allow a transaction with high fees, set maxfeerate to 0.");
    3    } else if (request.params[1].isNum()) {
    4        [...]
    

    Or similar.


    kallewoof commented at 5:00 am on February 25, 2019:
    I think the throw behavior makes sense, unless we hear complaints. I’ll put that in. Thanks for code example.
  59. in test/functional/rpc_rawtransaction.py:288 in 0d40ad42af outdated
    285@@ -286,11 +286,7 @@ def run_test(self):
    286 
    287         txDetails = self.nodes[0].gettransaction(txId, True)
    288         rawTx = self.nodes[0].decoderawtransaction(txDetails['hex'])
    289-        vout = False
    290-        for outpoint in rawTx['vout']:
    291-            if outpoint['value'] == Decimal('2.20000000'):
    292-                vout = outpoint
    293-                break
    294+        vout = next(o for o in rawTx['vout'] if o['value'] == Decimal('2.20000000'))
    


    jnewbery commented at 8:21 pm on February 19, 2019:
    Very nice :+1: . As well as being more compact, this will fail here with a StopIteration exception if there is no matching output, rather than fail later because vout is False.

    kallewoof commented at 9:16 am on February 21, 2019:
    Props to @promag! :)

    promag commented at 4:32 pm on February 22, 2019:
    Thanks, now I have to understand what I’ve suggested :trollface:
  60. in test/functional/rpc_rawtransaction.py:429 in 0d40ad42af outdated
    426@@ -435,5 +427,35 @@ def run_test(self):
    427         decrawtx = self.nodes[0].decoderawtransaction(rawtx)
    428         assert_equal(decrawtx['version'], 0x7fffffff)
    429 
    430+        #########################################################
    


    jnewbery commented at 8:25 pm on February 19, 2019:
    I think that the log.info() calls are more useful for documenting the test sections than these block comments. Consider removing this.

    kallewoof commented at 9:16 am on February 21, 2019:
    Sure thing.
  61. in test/functional/rpc_rawtransaction.py:435 in 0d40ad42af outdated
    436+        addr = self.nodes[2].getnewaddress()
    437+        txId = self.nodes[0].sendtoaddress(addr, 1.0)
    438+        rawTx = self.nodes[0].getrawtransaction(txId, True)
    439+        vout = next(o for o in rawTx['vout'] if o['value'] == Decimal('1.00000000'))
    440+
    441+        self.sync_all()
    


    jnewbery commented at 8:34 pm on February 19, 2019:
    Note that sending a raw transaction on one node and then calling sync_all() introduces a random delay (since transaction propagation is trickled). This is done in a bunch of test cases, so I’m not saying this is a blocker for this PR, but it’s something worth knowing about.
  62. in src/rpc/rawtransaction.cpp:1079 in 0d40ad42af outdated
    1068+        if (request.params[1].get_bool()) max_raw_tx_fee = 0;
    1069+    } else if (request.params[1].isNum()) {
    1070+        size_t weight = GetTransactionWeight(*tx);
    1071+        CFeeRate fr(AmountFromValue(request.params[1]));
    1072+        // the +3/4 part rounds the value up, and is the same formula used when
    1073+        // calculating the fee for a transaction
    


    jnewbery commented at 2:19 pm on February 20, 2019:
    Can you refer to GetVirtualTransactionSize() in this comment? (It took me some time to find and confirm this formula)

    kallewoof commented at 9:21 am on February 21, 2019:
    Makes sense - added comment to both places.
  63. jnewbery commented at 2:43 pm on February 20, 2019: member

    These changes seem reasonable, although I think the commits could be re-arranged and squashed. For example, the first two commits don’t cause any behaviour change and the third commit test: test maxfeerate parameter in sendrawtransaction tests behaviour that has not been implemented, meaning the test fails. I’d suggest the following:

    • One commit for refactoring BroadcastTransaction()
    • One commit for refactoring `rpc_rawtransaction.py (test: Refactor vout fetches in rpc_rawtransaction)
    • One commit for changing sendrawtransaction together with test updates.
    • One commit for changing testmempoolaccept together with test updates.
  64. MarcoFalke commented at 2:56 pm on February 20, 2019: member
    @jnewbery You might want to take a look at #15408, which is a fixup to #14978 (the pull request that moved ::maxtxfee from the rpc callers to the util method)
  65. jnewbery commented at 3:09 pm on February 20, 2019: member
    Thanks @MarcoFalke . I wasn’t aware of that PR. I’ve already re-arranged the commits in the order I suggested here: https://github.com/jnewbery/bitcoin/tree/PR13541.1 . I guess it would be possible to remove the first commit from https://github.com/jnewbery/bitcoin/tree/PR13541.1 and rebase on #15408.
  66. MarcoFalke added this to the milestone 0.19.0 on Feb 20, 2019
  67. kallewoof force-pushed on Feb 21, 2019
  68. kallewoof force-pushed on Feb 21, 2019
  69. kallewoof force-pushed on Feb 21, 2019
  70. kallewoof commented at 9:22 am on February 21, 2019: member
    I --hard reset over @jnewbery’s branch. I kind of prefer to have tests separate from code changes, but I’m just gonna leave things as they are. Thanks for the help!
  71. in src/rpc/rawtransaction.cpp:31 in 9c6a8b5239 outdated
    27@@ -28,6 +28,7 @@
    28 #include <script/standard.h>
    29 #include <uint256.h>
    30 #include <util/bip32.h>
    31+#include <util/moneystr.h>
    


    MarcoFalke commented at 4:30 pm on February 22, 2019:

    in commit 9c6a8b52394c9fdbb8c2296a77614b1c0114db49

    Why the include? I can’t see what it is for


    kallewoof commented at 4:56 am on February 25, 2019:
    It was in the wrong commit. It’s used for FormatMoney in RPC helps.
  72. jnewbery commented at 4:54 pm on February 22, 2019: member

    I kind of prefer to have tests separate from code changes

    I have no strong preference in the case of new tests, but obviously changes that need to be made to existing tests when behaviour changes should be atomic with the behaviour change commit to not break git bisects.

    Sorry I was a bit overzelous in squashing. Obviously it’s your choice and I won’t be at all offended if you split out the new tests as part of your next rebase :)

  73. DrahtBot added the label Needs rebase on Feb 22, 2019
  74. kallewoof force-pushed on Feb 25, 2019
  75. kallewoof force-pushed on Feb 25, 2019
  76. kallewoof commented at 5:06 am on February 25, 2019: member
    @jnewbery Good point, yeah I meant new tests, not fixes. I should probably be more careful and think about bisect.
  77. kallewoof force-pushed on Feb 25, 2019
  78. DrahtBot removed the label Needs rebase on Feb 25, 2019
  79. kallewoof force-pushed on Feb 25, 2019
  80. kallewoof force-pushed on Feb 25, 2019
  81. kallewoof commented at 1:33 pm on February 25, 2019: member
    It kind of came natural with the PR as I was debugging it, but I added fee related output to testmempoolaccept for the case where fee is related to the rejection (REJECT_HIGHFEE and REJECT_INSUFFICIENTFEE, specifically). This also included updating AcceptToMempool and friends to allow an outgoing fee.
  82. in src/rpc/rawtransaction.cpp:1059 in 9e6f7875f2 outdated
    1055@@ -1055,20 +1056,30 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
    1056                 },
    1057             }.ToString());
    1058 
    1059-    RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL});
    


    MarcoFalke commented at 6:47 pm on February 25, 2019:

    in commit 9e6f7875f27e632fe38518cff59ff61ce48dded6

    Why is this removed, it should stay here with the comment “checked later”. See also git grep 'checked later'


    kallewoof commented at 7:22 am on March 4, 2019:
    Got it!
  83. in src/rpc/rawtransaction.cpp:1077 in 9e6f7875f2 outdated
    1077+        // the +3/4 part rounds the value up, and is the same formula used when
    1078+        // calculating the fee for a transaction
    1079+        // (see GetVirtualTransactionSize)
    1080+        max_raw_tx_fee = fr.GetFee((weight+3)/4);
    1081+    } else if (!request.params[1].isNull()) {
    1082+        throw JSONRPCError(RPC_INVALID_PARAMETER, "second argument must be a bool (allowhighfees) or numeric (maxfeerate)");
    


    MarcoFalke commented at 6:49 pm on February 25, 2019:

    In commit 9e6f7875f27e632fe38518cff59ff61ce48dded6

    Wrong error message. Could remove the isBool check above and use that error message?


    MarcoFalke commented at 6:54 pm on February 25, 2019:
    Also could add a test for this error string when passing a bool? Maybe rpc_deprecated or anywhere else?

    jnewbery commented at 8:31 pm on February 26, 2019:
    Agree that this is the wrong error message, but I think it makes sense to keep the isBool check above, so it can be removed cleanly in a future version.

    kallewoof commented at 7:26 am on March 4, 2019:
    Fixed error message.
  84. in test/functional/feature_fee_estimation.py:68 in 9e6f7875f2 outdated
    64@@ -65,7 +65,7 @@ def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee
    65     # the ScriptSig that will satisfy the ScriptPubKey.
    66     for inp in tx.vin:
    67         inp.scriptSig = SCRIPT_SIG[inp.prevout.n]
    68-    txid = from_node.sendrawtransaction(ToHex(tx), True)
    69+    txid = from_node.sendrawtransaction(ToHex(tx), 1.0)
    


    MarcoFalke commented at 6:50 pm on February 25, 2019:

    in commit 9e6f7875f27e632fe38518cff59ff61ce48dded6

    nit: Should be 0 and use named args?


    kallewoof commented at 7:27 am on March 4, 2019:
    Thanks, fixed!
  85. in test/functional/feature_fee_estimation.py:98 in 9e6f7875f2 outdated
    94@@ -95,7 +95,7 @@ def split_inputs(from_node, txins, txouts, initial_split=False):
    95     else:
    96         tx.vin[0].scriptSig = SCRIPT_SIG[prevtxout["vout"]]
    97         completetx = ToHex(tx)
    98-    txid = from_node.sendrawtransaction(completetx, True)
    99+    txid = from_node.sendrawtransaction(completetx, 1.0)
    


    MarcoFalke commented at 6:51 pm on February 25, 2019:
    same
  86. in src/rpc/rawtransaction.cpp:1120 in 685f2f5486 outdated
    1126@@ -1127,7 +1127,6 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
    1127             }.ToString());
    1128     }
    1129 
    1130-    RPCTypeCheck(request.params, {UniValue::VARR, UniValue::VBOOL});
    


    MarcoFalke commented at 6:55 pm on February 25, 2019:

    In commit 685f2f54866e14f79d56c1220abbd37e23b709d8

    Same as above

  87. in src/rpc/rawtransaction.cpp:1153 in 685f2f5486 outdated
    1151+        // the +3/4 part rounds the value up, and is the same formula used when
    1152+        // calculating the fee for a transaction
    1153+        // (see GetVirtualTransactionSize)
    1154+        max_raw_tx_fee = fr.GetFee((weight+3)/4);
    1155+    } else if (!request.params[1].isNull()) {
    1156+        throw JSONRPCError(RPC_INVALID_PARAMETER, "second argument must be a bool (allowhighfees) or numeric (maxfeerate)");
    


    MarcoFalke commented at 6:55 pm on February 25, 2019:

    in commit 685f2f54866e14f79d56c1220abbd37e23b709d8

    Same as above

  88. in src/rpc/rawtransaction.cpp:1190 in 349860df86 outdated
    1186+            } else {
    1187+                CFeeRate fr_shortage(max_raw_tx_fee - fee_out, (weight+3)/4);
    1188+                fees.pushKV("fee-abs-shortage", ValueFromAmount(max_raw_tx_fee - fee_out));
    1189+                fees.pushKV("fee-rate-shortage", ValueFromAmount(fr_shortage.GetFeePerK()));
    1190+            }
    1191+            result_0.pushKV("fees", fees);
    


    MarcoFalke commented at 7:01 pm on February 25, 2019:

    in commit 349860df8695ff0ad657a3d6d1502edb46571174

    This is undocumented, but I am also not sure if it is a desired feature. Might want to split out as a separate pull request after the first part is merged?


    jnewbery commented at 4:10 pm on February 27, 2019:
    I agree that this is unnecessary in this PR. Happy to review in a follow-up PR.
  89. MarcoFalke commented at 7:01 pm on February 25, 2019: member
    utACK 685f2f54866e14f79d56c1220abbd37e23b709d8
  90. in src/rpc/client.cpp:94 in 349860df86 outdated
    94@@ -95,8 +95,10 @@ static const CRPCConvertParam vRPCConvertParams[] =
    95     { "signrawtransactionwithkey", 2, "prevtxs" },
    96     { "signrawtransactionwithwallet", 1, "prevtxs" },
    97     { "sendrawtransaction", 1, "allowhighfees" },
    


    jnewbery commented at 8:29 pm on February 26, 2019:
    remove this (and same for testmempoolaccept below)

    kallewoof commented at 7:34 am on March 4, 2019:
    I think it makes sense to keep until we remove the bool check, in case somebody is using named style, or is that unnecessary?
  91. in src/rpc/rawtransaction.cpp:2081 in 349860df86 outdated
    2088@@ -2047,11 +2089,11 @@ static const CRPCCommand commands[] =
    2089     { "rawtransactions",    "createrawtransaction",         &createrawtransaction,      {"inputs","outputs","locktime","replaceable"} },
    2090     { "rawtransactions",    "decoderawtransaction",         &decoderawtransaction,      {"hexstring","iswitness"} },
    2091     { "rawtransactions",    "decodescript",                 &decodescript,              {"hexstring"} },
    2092-    { "rawtransactions",    "sendrawtransaction",           &sendrawtransaction,        {"hexstring","allowhighfees"} },
    2093+    { "rawtransactions",    "sendrawtransaction",           &sendrawtransaction,        {"hexstring","allowhighfees|maxfeerate"} },
    


    jnewbery commented at 8:31 pm on February 26, 2019:
    remove allowhighfees (and same for testmempoolaccept below)
  92. kallewoof force-pushed on Mar 4, 2019
  93. kallewoof commented at 7:52 am on March 4, 2019: member
    Addressed review comments and removed fee info related commits 121afc4f5c323776584dd83d93c6da77128b6775 349860df8695ff0ad657a3d6d1502edb46571174
  94. MarcoFalke commented at 6:49 pm on March 4, 2019: member
    Could you fixup the last commit, please?
  95. MarcoFalke commented at 6:53 pm on March 4, 2019: member
    re-utACK 6c98fd0466 otherwise
  96. kallewoof force-pushed on Mar 5, 2019
  97. kallewoof commented at 1:13 am on March 5, 2019: member
    @MarcoFalke Squashed.
  98. in test/functional/feature_cltv.py:116 in b202e25dba outdated
    112@@ -113,7 +113,7 @@ def run_test(self):
    113         # rejected from the mempool for exactly that reason.
    114         assert_equal(
    115             [{'txid': spendtx.hash, 'allowed': False, 'reject-reason': '64: non-mandatory-script-verify-flag (Negative locktime)'}],
    116-            self.nodes[0].testmempoolaccept(rawtxs=[bytes_to_hex_str(spendtx.serialize())], allowhighfees=True)
    117+            self.nodes[0].testmempoolaccept(rawtxs=[bytes_to_hex_str(spendtx.serialize())], maxfeerate=0)
    


    MarcoFalke commented at 2:16 pm on March 5, 2019:
    bytes_to_hex_str has been removed. Sorry, needs rebase again :(

    kallewoof commented at 1:00 am on March 6, 2019:
    NP! Rebased.
  99. DrahtBot added the label Needs rebase on Mar 5, 2019
  100. test: Refactor vout fetches in rpc_rawtransaction e5efacb941
  101. kallewoof force-pushed on Mar 6, 2019
  102. DrahtBot removed the label Needs rebase on Mar 6, 2019
  103. MarcoFalke commented at 6:02 pm on March 7, 2019: member
    re-utACK 6c17985e8b
  104. in src/rpc/rawtransaction.cpp:1072 in 6c17985e8b outdated
    1071 
    1072-    bool allowhighfees = false;
    1073-    if (!request.params[1].isNull()) allowhighfees = request.params[1].get_bool();
    1074-    const CAmount highfee{allowhighfees ? 0 : ::maxTxFee};
    1075+    CAmount max_raw_tx_fee = maxTxFee;
    1076+    // TODO: temporary migration code for old clients. Remove in v0.21
    


    MarcoFalke commented at 6:10 pm on March 7, 2019:
    0    // TODO: temporary migration code for old clients. Remove in v0.20
    

    Released in 0.19.0, so can be removed in 0.20.0?

  105. in test/functional/rpc_rawtransaction.py:432 in 6c17985e8b outdated
    425@@ -434,5 +426,31 @@ def run_test(self):
    426         decrawtx = self.nodes[0].decoderawtransaction(rawtx)
    427         assert_equal(decrawtx['version'], 0x7fffffff)
    428 
    429+        self.log.info('sendrawtransaction/testmempoolaccept with maxfeerate')
    430+
    431+        addr = self.nodes[2].getnewaddress()
    432+        txId = self.nodes[0].sendtoaddress(addr, 1.0)
    


    MarcoFalke commented at 6:10 pm on March 7, 2019:
    0        txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.0)
    

    Could inline addr

  106. MarcoFalke commented at 6:28 pm on March 13, 2019: member
    Just some style nits (could be ignored)
  107. wallet/rpc: add maxfeerate parameter to sendrawtransaction 6c0a6f73e3
  108. wallet/rpc: add maxfeerate parameter to testmempoolaccept 7abd2e697c
  109. kallewoof force-pushed on Mar 13, 2019
  110. kallewoof commented at 0:51 am on March 14, 2019: member
    Addressed @MarcoFalke nits.
  111. MarcoFalke merged this on Mar 18, 2019
  112. MarcoFalke closed this on Mar 18, 2019

  113. MarcoFalke referenced this in commit c033c4b5ce on Mar 18, 2019
  114. in src/validation.cpp:3151 in 6c0a6f73e3 outdated
    3146+                return (int)o;
    3147+            }
    3148+        }
    3149+    }
    3150+    return -1;
    3151+}
    


    MarcoFalke commented at 5:25 pm on March 18, 2019:

    re-utACK 7abd2e697c0f8e93245e09ac853bae05d0b48bee

    Sorry I only noticed this unused method in this hunk after merge :crying_cat_face:.

  115. laanwj referenced this in commit e45b7f20e6 on Mar 18, 2019
  116. kallewoof deleted the branch on Mar 18, 2019
  117. jnewbery commented at 8:11 pm on March 26, 2019: member

    post-merge ACK 7abd2e697c0f8e93245e09ac853bae05d0b48bee

    (except the change to validation.cpp :see_no_evil: )

  118. luke-jr referenced this in commit da80965597 on Apr 22, 2019
  119. luke-jr referenced this in commit b369af8f4f on Apr 22, 2019
  120. deadalnix referenced this in commit 1d4e5281a7 on May 26, 2020
  121. vijaydasmp referenced this in commit 7a9af07b34 on Nov 15, 2021
  122. vijaydasmp referenced this in commit 99d82a8149 on Nov 16, 2021
  123. vijaydasmp referenced this in commit d81cf3c0b7 on Dec 5, 2021
  124. vijaydasmp referenced this in commit e17ac3c822 on Dec 5, 2021
  125. vijaydasmp referenced this in commit 232eeb1ce0 on Dec 6, 2021
  126. vijaydasmp referenced this in commit 82a9388106 on Dec 6, 2021
  127. kittywhiskers referenced this in commit 6609a6b676 on Dec 8, 2021
  128. kittywhiskers referenced this in commit 33bc222656 on Dec 11, 2021
  129. kittywhiskers referenced this in commit c6c307b3f7 on Dec 12, 2021
  130. DrahtBot locked this on Dec 16, 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: 2024-12-22 09:12 UTC

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