-
Notifications
You must be signed in to change notification settings - Fork 45
Add conditional logic to use getBlock rather than getBlockInfo. #130
base: master
Are you sure you want to change the base?
Conversation
getBlock is used for nodeos chains under 2.1.0 and getBlockInfo is used for 2.1.0+
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.
Just some minor comments.
I tested these cases and they all were passed:
- Used the lib with the example app that point to a testnet which were using v2.0.7. Transaction was executed successfully without any configuration.
- Same set up as above but manually set the
chainVersionString
to thedefault
value (2.0.0) (Transaction was executed successfully) and theget block Info available
value (2.1.0). (Transaction were failed - which is expected)
eosiojava/src/main/java/one/block/eosiojava/interfaces/IRPCProvider.java
Outdated
Show resolved
Hide resolved
import one.block.eosiojava.error.rpcProvider.GetInfoRpcError; | ||
import one.block.eosiojava.error.rpcProvider.GetRequiredKeysRpcError; | ||
import one.block.eosiojava.error.rpcProvider.SendTransactionRpcError; | ||
import one.block.eosiojava.error.rpcProvider.*; |
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.
Please avoid using wildcard import.
eosiojava/src/main/java/one/block/eosiojava/session/TransactionProcessor.java
Outdated
Show resolved
Hide resolved
eosiojava/src/test/java/one/block/eosiojava/session/TransactionProcessorTest.java
Outdated
Show resolved
Hide resolved
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 I get this URL: http://192.168.182.4:8888/v1/chain/get_block_info
I use SDK 1.0 & eosio version=v1.8.14...
how to resolve this issue?
Thanks.
For now you will have to use the older version of the SDKs until this PR can be merged and a new release deployed. 1.0.0 was originally designed to be released with nodeos 2.1 which replaced get_block in the transaction signing process with get_block_info. 2.1 has been delayed to this PR adds backward compatibility. @GonnaGitYou FYI |
getBlock is used for nodeos chains under 2.1.0 and getBlockInfo is used for 2.1.0+
TransactionConfig has a new member called
chainVersionString
that contains the target chain ID that the transaction is meant for. This value is unset by default. The user may set the value manually if they desire. Semantic versioning is used for the parsing and comparison of the versions. If the value is unset,TransactionProcessor
will use the return fromgetInfo
in order to determine the server version and setchainVersionString
appropriately. If the value cannot be found or parsed a default of2.0.0
will be used, causinggetBlock
to be called for TAPOS rather thangetBlockInfo
. This should allow the SDK to work transparently on 2.0.0 and 2.1.0+ nodes.TransactionProcessorTest
updated to be parameterized to run one pass with 2.0.0 and another with 2.1.0.