HomePhabricator

Call `SyncWithValidationInterfaceQueue` after RPCs

Description

Call SyncWithValidationInterfaceQueue after RPCs

Summary:
RPCs that update the chain state now wait for the (async) CValidationInterface queue to finish.

The following RPCs will call SyncWithValidationInterfaceQueue before returning:

  • preciousblock
  • invalidateblock
  • parkblock
  • reconsiderblock
  • unparkblock
  • generatetodescriptor
  • generatetoaddress
  • generateblock
  • submitblock
  • sendrawtransaction

This is more in line with the expected behavior, after a user e.g. called sendrawtransaction, it's reasonable to expect the wallet/indexers to always have this tx indexed after the call returned.

While users could use syncwithvalidationinterfacequeue, to enforce this, it requires discipline, because usually after the call returned, the indexers caught up already, so only occasionally a call to syncwithvalidationinterfacequeue is actually necessary. This would make software using the node more brittle.

This diff makes it so that users of these RPCs don't have to wait for the queue to clear manually.

Test Plan:

  1. ninja check-functional
  2. All the build-* builds
  3. D13626, which relies on this diff

Reviewers: Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D13687

Details

Provenance
tobias_ruckAuthored on Apr 12 2023, 15:58
tobias_ruckPushed on Apr 12 2023, 21:39
Reviewer
Restricted Project
Differential Revision
D13687: Call `SyncWithValidationInterfaceQueue` after RPCs
Parents
rABC27bc2641c542: [ecashaddrjs] Version bump
Branches
Unknown
Tags
Unknown