Skip to content
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

feat(rpc): implement getrawmempool RPC method #3851

Merged
merged 9 commits into from
Mar 12, 2022
Merged

feat(rpc): implement getrawmempool RPC method #3851

merged 9 commits into from
Mar 12, 2022

Conversation

oxarbitrage
Copy link
Contributor

@oxarbitrage oxarbitrage commented Mar 11, 2022

Motivation

Will close #3160 eventually when done.

Solution

Implement getrawmempool

Review

@jvff already is working with me in this so will be nice to get a review from someone else.

Reviewer Checklist

  • Code implements Specs and Designs
  • Tests for Expected Behaviour
  • Tests for Errors

zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
zebra-rpc/src/methods/tests/vectors.rs Outdated Show resolved Hide resolved
jvff added 3 commits March 11, 2022 19:38
Ensure the returned type is serialized as an array of hexadecimal
strings.
Test it with random sets of transaction IDs.
Run `rustfmt` inside the `proptest!` block.
@oxarbitrage
Copy link
Contributor Author

By the lightwalletd integration tests logs it seems the getrawmempool does not provides any output:

Mar 11 19:36:23.183  INFO {net="Main"}: zebra_rpc::server: Opened RPC endpoint at 127.0.0.1:55578
{"app":"lightwalletd","buildDate":"","buildUser":"","gitCommit":"","level":"info","msg":"Starting gRPC server version v0.0.0.0-dev on 127.0.0.1:0","time":"2022-03-11T19:36:23Z"}
{"app":"lightwalletd","level":"warning","msg":"Starting insecure no-TLS (plaintext) server","time":"2022-03-11T19:36:23Z"}
Starting insecure server
{"app":"lightwalletd","level":"info","msg":"Got sapling height 0 block height 0 chain TODO: main branchID ","time":"2022-03-11T19:36:23Z"}
{"app":"lightwalletd","level":"info","msg":"Found 0 blocks in cache","time":"2022-03-11T19:36:23Z"}
{"app":"lightwalletd","level":"error","msg":"Couldn't open file /tmp/zebrad_testsAMA4SB/db/TODO: main/prices for writing: open /tmp/zebrad_testsAMA4SB/db/TODO: main/prices: no such file or directory","time":"2022-03-11T19:36:23Z"}
{"app":"lightwalletd","level":"error","msg":"Couldn't read historical prices, starting with empty map","time":"2022-03-11T19:36:23Z"}
{"app":"lightwalletd","error":"error requesting block: 0: Block not found","height":0,"level":"warning","msg":"error zcashd getblock rpc","time":"2022-03-11T19:36:23Z"}
{"app":"lightwalletd","level":"info","method":"CurrentPrice","msg":"Service","price":154.295,"provider":"github.com/adityapk00/lightwalletd/common.fetchCoinbasePrice","time":"2022-03-11T19:36:23Z"}
{"app":"lightwalletd","level":"info","method":"CurrentPrice","msg":"Service","price":154.458729947906,"provider":"github.com/adityapk00/lightwalletd/common.fetchCoinCapPrice","time":"2022-03-11T19:36:23Z"}
{"app":"lightwalletd","level":"info","method":"CurrentPrice","msg":"Service","price":154.5,"provider":"github.com/adityapk00/lightwalletd/common.fetchBinancePrice","time":"2022-03-11T19:36:23Z"}
{"app":"lightwalletd","level":"info","method":"SetCurrentPrice","msg":"Service","price":154.458729947906,"time":"2022-03-11T19:36:23Z"}
{"app":"lightwalletd","level":"info","msg":"Ingestor adding block to cache: 1","time":"2022-03-11T19:36:33Z"}
{"app":"lightwalletd","error":"error requesting block: 0: Block not found","height":801,"level":"warning","msg":"error zcashd getblock rpc","time":"2022-03-11T19:36:33Z"}
{"app":"lightwalletd","level":"info","msg":"Block hash changed, clearing mempool clients","time":"2022-03-11T19:36:35Z"}
{"app":"lightwalletd","level":"info","msg":"Ingestor adding block to cache: 801","time":"2022-03-11T19:36:43Z"}
Error: 
   0: stdout of command did not contain any matches for the given regex

Location:
   /app/zebra-test/src/command.rs:330

Command:
   "lightwalletd" "--zcash-conf-path" "/tmp/zebrad_testsAMA4SB/lightwalletd-zcash.conf" "--data-dir" "/tmp/zebrad_testsAMA4SB" "--log-file" "/dev/stdout" "--grpc-bind-addr" "127.0.0.1:0" "--http-bind-addr" "127.0.0.1:0" "--no-tls-very-insecure"

Exit Status:
   command terminated unsuccessfully by signal 9

Match Regex:
   "(Mempool refresh error: -32601: Method not found)|(Another refresh in progress, returning)"

See https://github.com/ZcashFoundation/zebra/runs/5516017007?check_suite_focus=true#step:4:220

Copy link
Contributor

@jvff jvff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed some commits with the suggestions, but feel free to revert or discard them if you want to do it differently :)

zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
zebra-rpc/src/methods/tests/vectors.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Mar 11, 2022

Codecov Report

Merging #3851 (a39e92e) into main (4197704) will decrease coverage by 0.07%.
The diff coverage is 83.33%.

@@            Coverage Diff             @@
##             main    #3851      +/-   ##
==========================================
- Coverage   78.82%   78.74%   -0.08%     
==========================================
  Files         295      295              
  Lines       33764    33788      +24     
==========================================
- Hits        26613    26606       -7     
- Misses       7151     7182      +31     

zebrad/tests/acceptance.rs Outdated Show resolved Hide resolved
zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
@oxarbitrage oxarbitrage marked this pull request as ready for review March 11, 2022 22:40
@oxarbitrage oxarbitrage requested a review from a team as a code owner March 11, 2022 22:40
@oxarbitrage oxarbitrage requested review from upbqdn and removed request for a team March 11, 2022 22:40
@oxarbitrage oxarbitrage changed the title feat(rpc): implement getrawtransaction RPC method feat(rpc): implement getrawmempool RPC method Mar 11, 2022
mergify bot added a commit that referenced this pull request Mar 12, 2022
@mergify mergify bot merged commit 53e2d2e into main Mar 12, 2022
@mergify mergify bot deleted the issue3160 branch March 12, 2022 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getrawmempool JSON-RPC method
2 participants