-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new RPC methods #640
Add new RPC methods #640
Conversation
933e372
to
4ecc8f6
Compare
Fix formatting of these files: - `JsonRpcServer.js` - `TransactionDetails.js`
Add new RPC method (`getTransactionByHash2`) that returns more fields than the `getTransactionByHash` method. The added fields are: - `toType` - `fromType` - `validityStartHeight` - `networkId`
@@ -103,6 +103,7 @@ class JsonRpcServer { | |||
this._methods.set('getTransactionByBlockHashAndIndex', this.getTransactionByBlockHashAndIndex.bind(this)); | |||
this._methods.set('getTransactionByBlockNumberAndIndex', this.getTransactionByBlockNumberAndIndex.bind(this)); | |||
this._methods.set('getTransactionByHash', this.getTransactionByHash.bind(this)); | |||
this._methods.set('getTransactionByHash2', this.getTransactionByHash2.bind(this)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why must this be a new method, if you are only adding fields? That is not a breaking change, is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a breaking change as long as the client library/code supports it (there are de-serialization libraries that require extra configuration to ignore unknown fields or else they will throw and exception/error out). We can´t change custom client code that works this way (nor is our responsibility), but at least we should check and, if needed, fix this on the community provided libraries, but we didn't want to make this core-js
change dependent on that (the idea is to update and release core-js
first and then release a new version of the libraries to support the new RPC methods and to make sure they ignore unknown fields, but this second step may take some time).
For PoS we should make sure to release with some kind of versioning scheme that allows us to improve the API while retaining backward compatibility for people who can't update their clients/libraries at the same time as their nodes.
Add RPC method to get an accounts tree chunk: `getAccountsTreeChunk`. The method receives as `string` arguments` the block hash on which the snapshot will be taken and the `startPrefix` of the accounts tree chunk. Then it returns an `AccountsTreeChunk` object.
getAccountsTreeChunk
. The method receives asstring arguments
the block hash on which the snapshot will be taken and thestartPrefix
of the accounts tree chunk. Then it returns anAccountsTreeChunk
object.getTransactionByHash2
) that returns more fields than thegetTransactionByHash
method. The added fields are:toType
fromType
validityStartHeight
networkId
JsonRpcServer.js
TransactionDetails.js
Pull request checklist