Return block hash with wallet calls #18567

issue maflcko openend this issue on April 8, 2020
  1. maflcko commented at 6:33 pm on April 8, 2020: member

    Some wallet calls (like getbalances) need to lock the chainstate to make sure they are caught up on the latest block (which may have been reported to the users in getblockchaininfo or similar).

    Those calls could benefit if the block hash they were valid on was included in the response. For example, immature balance can only change when the chainstate changes. (Assuming no keys are imported)

    It seems those calls can include the block hash they are caught up with for free in the response. They could simply include m_last_block_processed in the response.

    I haven’t checked back with other developers to see if they like this approach, but to start simple only a single call could be updated for now. E.g. getbalances.

    Useful skills:

    Basic understanding of threads, the Bitcoin Core wallet and the Bitcoin Core RPC interface.

    Want to work on this issue?

    The purpose of the good first issue label is to highlight which issues are suitable for a new contributor without a deep understanding of the codebase.

    You do not need to request permission to start working on this. You are encouraged to comment on the issue if you are planning to work on it. This will help other contributors monitor which issues are actively being addressed and is also an effective way to request assistance if and when you need it.

    For guidance on contributing, please read CONTRIBUTING.md before opening your pull request.

  2. maflcko added the label good first issue on Apr 8, 2020
  3. maflcko added the label RPC/REST/ZMQ on Apr 8, 2020
  4. maflcko added the label Wallet on Apr 8, 2020
  5. brakmic commented at 11:03 pm on April 8, 2020: contributor
    Will look into it.
  6. promag commented at 0:14 am on April 9, 2020: member

    Those calls could benefit if the block hash they were valid on was included in the response. For example, immature balance can only change when the chainstate changes. @MarcoFalke but what’s the idea? Next time calling getbalances cliend would also send last received m_last_block_processed so that the server would reply “no change”? Or just because this is valuable information?

    In this particular case, an import+rescan makes things worse right?

  7. maflcko commented at 0:17 am on April 9, 2020: member

    Or just because this is valuable information?

    Yes

    an import+rescan makes things worse right?

    What things? m_last_block_processed is a wallet member and including it in the reply is free.

  8. promag commented at 0:20 am on April 9, 2020: member

    What things? m_last_block_processed is a wallet member and including it in the reply is free.

    It should be fine to add that to RPC that return objects. I was asking other thing but you already said in OP:

    immature balance can only change when the chainstate changes. (Assuming no keys are imported)

  9. maflcko removed the label good first issue on May 3, 2020
  10. achow101 closed this on May 2, 2023

  11. sidhujag referenced this in commit ab8a2a0751 on May 4, 2023
  12. BlackcoinDev referenced this in commit da9f62f912 on Feb 5, 2024
  13. bitcoin locked this on May 1, 2024

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-18 18:12 UTC

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