Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Enhance cleos to enable new RPC send_transaction #7585

Merged
merged 2 commits into from
Jul 4, 2019

Conversation

b1aafulei
Copy link
Contributor

Change Description

With regard to issue #7536, enhance cleos so as to enable send_transaction, an RPC newly introduced in EOSIO v1.8.

Changes are made to programs/cleos/main.cpp and programs/cleos/httpc.hpp.

Background

  • For versions v1.8 or after, both RPC send_transaction and push_transaction are supported.
  • For versions before v1.8, only RPC push_transaction is supported.
  • RPC send_transaction and push_transaction are almost the same, except the traces they return, which can be viewed in JSON format by adding a -j option in the command calling them.

Flow Control

  • Users can enforce always using old RPC push_transaction by adding a flag --use-old-rpc.
  • Otherwise, which RPC will be called depends on the current nodeos version:
    • If the nodeos version is between v1.0 and v1.7, call old RPC push_transaction;
    • Otherwise, call new RPC send_transaction.

Test

Have tested behavior such as create account, issue and transfer for nodeos version v1.8.0 and version v1.7.4.

Sidenote

In programs/cleos/main.cpp there is a void send_transaction(...) function, which, according to @arhag in issue #7536, is simply unrelated to this topic. Just ignore it.

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

programs/cleos/main.cpp Outdated Show resolved Hide resolved
@b1aafulei
Copy link
Contributor Author

I have modified the code adopting @arhag 's suggestion. Now the new flow is

Flow

  • Users can enforce using old RPC push_transaction by adding a flag --use-old-rpc.
  • Otherwise, without such a flag, cleos will always call the new RPC send_transaction.
    • If it happens that the call to send_transaction fails, an error message will be printed out, saying that the new RPC may not be supported, and suggesting the user add the flag --use-old-rpc to call push_transaction instead.

@b1aafulei b1aafulei merged commit 8ac8318 into develop Jul 4, 2019
@arhag arhag deleted the aaron-fu-enhance-push-txn branch July 4, 2019 01:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants