Skip to content

Commit b43cfa2

Browse files
committed
Merge bitcoin/bitcoin#30142: doc: add guidance for RPC to developer notes
c6eca6f doc: add guidance for RPC to developer notes (tdb3) Pull request description: Adds guidance statements to the RPC interface section of the developer notes with examples of when to implement `-deprecatedrpc=`. Wanted to increase awareness of preferred RPC implementation approaches for newer contributors. This implements some of what's discussed in bitcoin/bitcoin#29912 (comment) Opinions may differ, so please don't be shy. We want to make RPC as solid/safe as possible. Examples of discussions where guidelines/context might have added value: bitcoin/bitcoin#30212 (comment) bitcoin/bitcoin#29845 (comment) bitcoin/bitcoin#30381 (review) bitcoin/bitcoin#29954 (comment) bitcoin/bitcoin#30410 (review) bitcoin/bitcoin#30713 bitcoin/bitcoin#30381 bitcoin/bitcoin#29060 (review) ACKs for top commit: l0rinc: ACK c6eca6f fjahr: ACK c6eca6f maflcko: lgtm ACK c6eca6f jonatack: ACK c6eca6f Tree-SHA512: 01a98a8dc0eb91762b225d3278cdb4a5e380ceb7486fd096b4ad9122bed859cea8584d8996d3dce51272fdb792f4a793a1bd1c5445efeb87f0a30f9b6e59a790
2 parents 85feb09 + c6eca6f commit b43cfa2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/developer-notes.md

+6
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,12 @@ A few guidelines for introducing and reviewing new RPC interfaces:
14681468
- *Rationale*: JSON strings are Unicode strings, not byte strings, and
14691469
RFC8259 requires JSON to be encoded as UTF-8.
14701470

1471+
A few guidelines for modifying existing RPC interfaces:
1472+
1473+
- It's preferable to avoid changing an RPC in a backward-incompatible manner, but in that case, add an associated `-deprecatedrpc=` option to retain previous RPC behavior during the deprecation period. Backward-incompatible changes include: data type changes (e.g. from `{"warnings":""}` to `{"warnings":[]}`, changing a value from a string to a number, etc.), logical meaning changes of a value, or key name changes (e.g. `{"warning":""}` to `{"warnings":""}`). Adding a key to an object is generally considered backward-compatible. Include a release note that refers the user to the RPC help for details of feature deprecation and re-enabling previous behavior. [Example RPC help](https://github.com/bitcoin/bitcoin/blob/94f0adcc/src/rpc/blockchain.cpp#L1316-L1323).
1474+
1475+
- *Rationale*: Changes in RPC JSON structure can break downstream application compatibility. Implementation of `deprecatedrpc` provides a grace period for downstream applications to migrate. Release notes provide notification to downstream users.
1476+
14711477
Internal interface guidelines
14721478
-----------------------------
14731479

0 commit comments

Comments
 (0)