Grinnode-live / 2020-grin-bug-bash-challenge

Finding bugs in Grin-Wallet & Grin-nodes for a bounty prior to Grin fork v5.
3 stars 1 forks source link

[GRIN-Node][Owner API 2.0] test the validate_chain API method #57

Closed marekyggdrasil closed 3 years ago

marekyggdrasil commented 3 years ago

Description Goal of this issue is to test the validate_chain API method

Prerequisites

  1. GRIN-Node

Test procedure

  1. Run GRIN-Node in Owner API listener mode
  2. Run the validate_chain API method

Expected result:

Output should match the example. Include all cURL requests and responses.

Include the exact version of your grin-node and also your environment

uname -a
mojitoo commented 3 years ago

Step 1 : Run GRIN-Node in Owner API listener mode

grin server run 

Step 2 : Run the validate_chain API method

workstation@MacBook-Pro-de-Workstation ~ % curl -ugrin:$(cat ~/.grin/main/.api_secret) localhost:3413/v2/owner -d '{"jsonrpc": "2.0", "method": "validate_chain", "params": [], "id": 1}' -w "\n" -v
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3413 (#0)
* Server auth using Basic with user 'grin'
> POST /v2/owner HTTP/1.1
> Host: localhost:3413
> Authorization: Basic Z3JpbjpNajJuNDFkUVcyN3Y3SXNtNjBiUw==
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Length: 69
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 69 out of 69 bytes
< HTTP/1.1 200 OK
< access-control-allow-origin: *
< access-control-allow-headers: Content-Type, Authorization
< content-type: application/json
< content-length: 67
< date: Fri, 01 Jan 2021 09:49:04 GMT
< 
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "Ok": null
  }
* Connection #0 to host localhost left intact
}
* Closing connection 0
marekyggdrasil commented 3 years ago

Looks like its working. Thanks for checking!