Add checks for settxfee reasonableness #13988

pull ajtowns wants to merge 2 commits into bitcoin:master from ajtowns:201808-settxfee-checks changing 2 files +12 −2
  1. ajtowns commented at 2:52 am on August 16, 2018: member
    When using the settxfee RPC, the value is silently ignored if it is less than either than minrelaytxfee or the wallet’s mintxfee. This adds an error response if that’s going to happen, but still allows “settxfee 0” to deliberately default to the minimum value.
  2. Add checks for settxfee reasonableness 48618daf26
  3. fanquake added the label Wallet on Aug 16, 2018
  4. fanquake added the label RPC/REST/ZMQ on Aug 16, 2018
  5. DrahtBot commented at 4:45 am on August 16, 2018: member
  6. MarcoFalke commented at 10:58 am on August 16, 2018: member
    utACK 48618daf262b84c2e2f7322b5ca14375d7d68b64
  7. in src/wallet/rpcwallet.cpp:2990 in 48618daf26 outdated
    2981@@ -2982,8 +2982,16 @@ static UniValue settxfee(const JSONRPCRequest& request)
    2982     LOCK2(cs_main, pwallet->cs_wallet);
    2983 
    2984     CAmount nAmount = AmountFromValue(request.params[0]);
    2985+    CFeeRate tx_fee_rate(nAmount, 1000);
    2986+    if (tx_fee_rate == 0) {
    2987+        // automatic selection
    2988+    } else if (tx_fee_rate < ::minRelayTxFee) {
    2989+        throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("txfee cannot be less than min relay tx fee (%s)", ::minRelayTxFee.ToString()));
    2990+    } else if (tx_fee_rate < pwallet->m_min_fee) {
    


    promag commented at 0:44 am on August 20, 2018:
    How about check this first?
  8. promag commented at 0:45 am on August 20, 2018: member
    Concept ACK, could add tests?
  9. promag commented at 5:36 pm on August 20, 2018: member
    @ajtowns feel free to pick or squash ad367e1cb.
  10. test: Check RPC settxfee errors 317f2cb3f4
  11. laanwj commented at 9:10 am on August 22, 2018: member
    utACK 317f2cb3f4499afbaa63e3cac80567744f12c95b (thanks @promag for adding tests!)
  12. laanwj merged this on Aug 22, 2018
  13. laanwj closed this on Aug 22, 2018

  14. laanwj referenced this in commit 17d644901b on Aug 22, 2018
  15. deadalnix referenced this in commit 5262a13f03 on Jan 13, 2020
  16. 5tefan referenced this in commit c2076a025d on Jul 29, 2021
  17. UdjinM6 referenced this in commit 6218a94677 on Jul 29, 2021
  18. Munkybooty referenced this in commit 0627a06072 on Aug 3, 2021
  19. MarcoFalke 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: 2024-11-17 12:12 UTC

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