-
Notifications
You must be signed in to change notification settings - Fork 188
Update process_transaction #680
Update process_transaction #680
Conversation
Merge CoZ Development into jseagrave21 Development
Merge CoZ Development into jseagrave21 Development
Merge CoZ Development into jseagrave21 Development
* Update ExtendedJsonRpcApi.py - add fix provided by @localhuman so original methods are returned as well as extended methods
…yOfZion#661) * Add the option -u (unittest-net) to prompt.py * Add unittest guildeline and add the smart contract source codes (UnitTest-SM.zip) to the fixtures package
for compatibility
* Fix ExtendedJsonRpcApi (CityOfZion#662) * Update ExtendedJsonRpcApi.py - add fix provided by @localhuman so original methods are returned as well as extended methods * Mute expected test stacktrace and clearly identify why an exception is thrown. (CityOfZion#663) * Add guideline for adding tests to the neo-privnet-unittest image (CityOfZion#661) * Add the option -u (unittest-net) to prompt.py * Add unittest guildeline and add the smart contract source codes (UnitTest-SM.zip) to the fixtures package * Add raw transaction building examples (CityOfZion#665) * Update neo-boa version to fix core building test
Merge CoZ Development into jseagrave21 Development
Merge CoZ Development into jseagrave21 Development
- add logic in case the tx is not relayed
- Add test in case tx fails to relay
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.
I will leave the PR open for now so you can decide if you want to suggest the change to the C# project. If you do so and once it's accepted we can merge this. If you choose not to, then we'll have to close this. Please let me know your intentions
neo/api/JSONRPC/JsonRpcApi.py
Outdated
self.wallet.SaveTransaction(tx) | ||
return tx.ToJson() | ||
else: | ||
raise JsonRpcError(-32001, "Could not relay tx %s " % tx.Hash.ToString()) |
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.
Unfortunately accepting this change would make the behaviour of calls like sendtoaddress
deviate from the C# implementation, which is not what we want. See:
/~https://github.com/neo-project/neo/blob/dbe688b7b1d64975128b8aefb5c3ee692df07cd5/neo/Network/RPC/RpcServer.cs#L525-L532
@ixje I will try to suggest the change to C# but I may fail because I don't know C#. Perhaps a good compromise would be to just include |
@ixje I looked at the neo-project RPC and I just don't feel comfortable tinkering since I am not set up to test the code and I don't really know how to code in C#. I still think that this line /~https://github.com/CityOfZion/neo-python/pull/680/files#diff-f9e9d3e0fbf0fb287940a8d009a379b2R560 is equivalent to this line /~https://github.com/neo-project/neo/blob/dbe688b7b1d64975128b8aefb5c3ee692df07cd5/neo/Network/RPC/RpcServer.cs#L528 and should be added. I would be happy to eliminate the additonal logic in case the tx fails to relay. What do you think? |
@ixje Based on my reading of the purpose of neo-python/neo/Wallets/Wallet.py Lines 1102 to 1109 in 773e57e
I really think we should at least add this line. |
Sounds reasonable. I hope @localhuman can shed a quick light here because I'm far from familiar with that part of the |
Based on our discussion, I will update the PR accordingly. |
- revert original changes but maintain parody with neo-cli and include `self.wallet.SaveTransaction(tx)` to ensure the tx is saved to the wallet - see /~https://github.com/neo-project/neo/blob/dbe688b7b1d64975128b8aefb5c3ee692df07cd5/neo/Network/RPC/RpcServer.cs#L528
- remove test for failure to relay
for compatibility
Merge neo-python development into jseagrave21 update-process_transaction
Okay @localhuman this is ready for your review. A brief recap: Originally, this PR was to bring the RPC method to parody with |
👍 |
What current issue(s) does this address, or what feature is it adding?
process_transaction
fromSend.py
neo-python/neo/Prompt/Commands/Send.py
Line 206 in fd5e1d9
-update-
How did you solve this problem?
trial and error
How did you make sure your solution works?
unittest
Are there any special changes in the code that we should be aware of?
no
Please check the following, if applicable:
make lint
?make test
?CHANGELOG.rst
? (if not, please do)