[wallet] [rpc] getreceivedbyaddress should return error if called with address not owned by the wallet #11055

pull jnewbery wants to merge 2 commits into bitcoin:master from jnewbery:getreceivedbyaddress_error changing 2 files +53 −73
  1. jnewbery commented at 3:56 PM on August 15, 2017: member

    Two commits:

    • First commit tidies up the receivedby.py test (and speeds it up by factor of two)
    • Second commit changes getreceivedbyaddress to return error if the address is not found in wallet, and adds test to receivedby.py
  2. jnewbery commented at 5:38 PM on August 15, 2017: member

    Should be included in v0.16 release notes

  3. jonasschnelli commented at 6:38 PM on August 15, 2017: contributor

    utACK 672fbde065df795d2d23080f2eec651c25875cb2.

  4. jonasschnelli added the label Wallet on Aug 15, 2017
  5. laanwj commented at 10:55 AM on August 16, 2017: member

    Concept ACK, this makes sense, there is no reason to ever call this on an unknown (neither directly owned nor watch-only) address.

  6. in src/wallet/rpcwallet.cpp:645 in 672fbde065 outdated
     641 | @@ -642,7 +642,7 @@ UniValue getreceivedbyaddress(const JSONRPCRequest& request)
     642 |          throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
     643 |      CScript scriptPubKey = GetScriptForDestination(address.Get());
     644 |      if (!IsMine(*pwallet, scriptPubKey)) {
     645 | -        return ValueFromAmount(0);
     646 | +        throw JSONRPCError(RPC_WALLET_ERROR, "Address not owned by this wallet");
    


    promag commented at 2:15 PM on August 17, 2017:
    throw JSONRPCError(RPC_WALLET_ERROR, "Address not found in wallet");
    
  7. promag commented at 2:30 PM on August 17, 2017: member

    IMO these 2 commits would do:

    • Cleanup receivedby.py
    • Throw error in getreceivedbyaddress if address is not found in wallet

    Where the 2nd commit adds the new error and also the corresponding test.

    Otherwise tested ACK 672fbde.

  8. jnewbery commented at 2:54 PM on August 17, 2017: member

    Thanks @promag - both good suggestions.

    I've squashed this down to 2 commits and changed the error text to "Address not found in wallet". No other changes.

  9. jnewbery force-pushed on Aug 17, 2017
  10. promag commented at 12:49 AM on August 18, 2017: member

    reACK 828c454.

  11. jnewbery renamed this:
    getreceivedbyaddress should return error if called with address not owned by the wallet
    [wallet] [rpc] getreceivedbyaddress should return error if called with address not owned by the wallet
    on Sep 1, 2017
  12. luke-jr commented at 6:47 AM on September 2, 2017: member

    Needs rebase

  13. MarcoFalke added the label Needs release notes on Sep 2, 2017
  14. jnewbery force-pushed on Sep 4, 2017
  15. jnewbery commented at 3:56 PM on September 4, 2017: member

    Rebased

  16. MarcoFalke commented at 8:02 PM on November 10, 2017: member

    @jnewbery Needs rebase

    Ping me back, so we can get this merged.

  17. [tests] Tidy up receivedby.py
    - Fix flake8 warnings
    - Remove the useless get_sub_array_from_array() function
    - Reduce runtime for receivedby.py by about half by only using two nodes
    ea0cd24f7d
  18. [wallet] getreceivedbyaddress should return error if address is not mine 5e0ba8f8cd
  19. jnewbery force-pushed on Nov 10, 2017
  20. jnewbery commented at 9:08 PM on November 10, 2017: member

    @MarcoFalke - apologies. I didn't realise there was a silent merge conflict. Rebased.

  21. MarcoFalke commented at 5:36 PM on November 11, 2017: member
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    utACK 5e0ba8f8cd55a5c2cea4e4e2343d7dcd52aa8fad
    -----BEGIN PGP SIGNATURE-----
    
    iQIcBAEBCgAGBQJaBzUWAAoJENLqSFDnUoslDMQQALgoBpiT9S6/rTIaOLTu1rHH
    EgZIta8nFZtKL7jBE5t2hac2kC7DolgslTHcxFrblugEM2qth9eArUYbTZ+nSEQU
    /8/N6rj3sQ/n1yumT3XGXLkdEI7JJNkq+mpeaw+e7iE4LwJ8rf3lZrVlbXp2vbtY
    W333L8lJn8z3D5sbNJq6yXo/UgZIjM0bnkSoF4fmBhBhhI2uD4G/Vc1nIUIiSsF/
    x6dUIcpAOp0/qfkqEVDKseKB2+zX3I+S1GVXxrafekvDPlcPNV5n4EXVJt6TSJP5
    d5bfamzS2eDYD5YcxrvcXrty+z/T8cU/Je3ZSL5RoAiHgF/xJ+o0IjyCnERDXx5f
    g5ax5nUuOhFfHd9xDukhjjyEUbgEqU7poYfT1LKeKU6jFIzE1BQl7xfbnV1tw57R
    Yakj3rHgs15SGou26BxIuSazw+qT59IsmFDAzzOY0ur/iaYCvBmbsCU3UBq8YZ14
    mf35nLlscDmgZhv8gMTF9OYK6y7Z7o9/JlEDZfxSo1/EYI+TG1LgiYcsTnzWN1js
    L7bsZ704Pr1/XxSoILbM3t9wLeGXSRMlhfq2SWnWEfHHKFbtup06azs5pP5WCwEs
    0JBc6Z6GBFCkio+fPdB/nc4LWULj6nWxRi2EFRZtWsMiJIo386RS/8+j0sKAYeHM
    AG2KYNZuV4dABLTwnpO8
    =CY9W
    -----END PGP SIGNATURE-----
    
    
  22. MarcoFalke merged this on Nov 11, 2017
  23. MarcoFalke closed this on Nov 11, 2017

  24. MarcoFalke referenced this in commit 95e14dc81d on Nov 11, 2017
  25. MarcoFalke removed the label Needs release notes on Nov 11, 2017
  26. jnewbery deleted the branch on Nov 11, 2017
  27. MarcoFalke referenced this in commit 41aa9c4a80 on Nov 13, 2017
  28. PastaPastaPasta referenced this in commit 1f88bb9556 on Jan 17, 2020
  29. PastaPastaPasta referenced this in commit 83d475ae34 on Jan 22, 2020
  30. PastaPastaPasta referenced this in commit cc5b2f163c on Jan 22, 2020
  31. PastaPastaPasta referenced this in commit 4dfa4001c7 on Jan 29, 2020
  32. ckti referenced this in commit 13f6469bd7 on Mar 28, 2021
  33. DrahtBot 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-04-17 09:15 UTC

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