Skip to content

Commit c4784b5

Browse files
committed
Add a dev notes document describing the new wallet RPC blocking
1 parent 3ea8b75 commit c4784b5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

doc/developer-notes.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,3 +644,16 @@ A few guidelines for introducing and reviewing new RPC interfaces:
644644

645645
- *Rationale*: If a RPC response is not a JSON object then it is harder to avoid API breakage if
646646
new data in the response is needed.
647+
648+
- Wallet RPCs call BlockUntilSyncedToCurrentChain to maintain consistency with
649+
`getblockchaininfo`'s state immediately prior to the call's execution. Wallet
650+
RPCs whose behavior does *not* depend on the current chainstate may omit this
651+
call.
652+
653+
- *Rationale*: In previous versions of Bitcoin Core, the wallet was always
654+
in-sync with the chainstate (by virtue of them all being updated in the
655+
same cs_main lock). In order to maintain the behavior that wallet RPCs
656+
return results as of at least the highest best-known block an RPC
657+
client may be aware of prior to entering a wallet RPC call, we must block
658+
until the wallet is caught up to the chainstate as of the RPC call's entry.
659+
This also makes the API much easier for RPC clients to reason about.

0 commit comments

Comments
 (0)