rippled
rippled copied to clipboard
Look up if node enabled path finding (Version: 1.9.3)
Issue Description
For a node it is possible to set path_search_max to zero in its rippled.cfg to disable path finding.
Ripple Testnet (https://s.altnet.rippletest.net:51234/) seams to do so. I also had issues with S1 (https://s1.ripple.com:51234/) in the past.
When set path_search_max to zero and someone is calling the path_find method, one only gets an empty array for alternatives. This could be a problem if you are trying to find a path between a trading pair that is illiquid anyway. One could think that there simply are no paths available, even if there are.
Path finding is one of the key features of the XRPL, so we should have an easy way to look up if a node has it enabled.
Option 1
Return the field path_search_max in the server_info response, to have the opportunity to look it up.
Option 2
Have a warning in the path_find method's response, which explains that the node does not support path finding.
This affects all path finding methods (path_find, ripple_path_find).
Steps to Reproduce
Option 1
- https://xrpl.org/websocket-api-tool.html#server_info
- Choose Testnet (s.altnet.rippletest.net (Testnet Public Cluster))
- "Send request"
Option 2
- https://xrpl.org/websocket-api-tool.html#path_find
- Choose Testnet (s.altnet.rippletest.net (Testnet Public Cluster))
- "Send request"
Expected Result
Option 1 (field for server_info)
A response with a path_search_max field.
{
"id": 1,
"result": {
"info": {
"build_version": "1.9.3",
"complete_ledgers": "30410348-30983432",
"hostid": "HICK",
"initial_sync_duration_us": "255201252",
"io_latency_ms": 1,
"jq_trans_overflow": "0",
"last_close": {
"converge_time_s": 2,
"proposers": 6
},
"load_factor": 1,
"network_id": 1,
"path_search_max": 0, <<-------------------
"peer_disconnects": "3879",
"peer_disconnects_resources": "137",
"peers": 67,
"pubkey_node": "n9LGH8mv1XumE6eRV8sY7tRLdJSqbJ874G15mztbQB4BTCiaJXjP",
"server_state": "full",
"server_state_duration_us": "514336593812",
"state_accounting": {
"connected": {
"duration_us": "252153624",
"transitions": "2"
},
"disconnected": {
"duration_us": "1045046",
"transitions": "2"
},
"full": {
"duration_us": "514336593812",
"transitions": "1"
},
"syncing": {
"duration_us": "2002505",
"transitions": "1"
},
"tracking": {
"duration_us": "74",
"transitions": "1"
}
},
"time": "2022-Sep-07 19:50:48.492886 UTC",
"uptime": 514591,
"validated_ledger": {
"age": 3,
"base_fee_xrp": 0.00001,
"hash": "3198869EF19293B9ACB22DDA66658E22EA6822AFC396829CE9CADED60E5CA82A",
"reserve_base_xrp": 10,
"reserve_inc_xrp": 2,
"seq": 30983432
},
"validation_quorum": 5
}
},
"status": "success",
"type": "response"
}
Option 2 (warning for path finding methods)
{
"id": 8,
"result": {
"alternatives": [],
"destination_account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"destination_amount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0.001"
},
"full_reply": false,
"id": 8,
"source_account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"
},
"status": "success",
"type": "response",
"warnings": [ <<-------------------
{
"id": ...,
"message": "This node does not support path finding."
}
]
}
Actual Result
Option 1
{
"id": 1,
"result": {
"info": {
"build_version": "1.9.3",
"complete_ledgers": "30410348-30983432",
"hostid": "HICK",
"initial_sync_duration_us": "255201252",
"io_latency_ms": 1,
"jq_trans_overflow": "0",
"last_close": {
"converge_time_s": 2,
"proposers": 6
},
"load_factor": 1,
"network_id": 1,
"peer_disconnects": "3879",
"peer_disconnects_resources": "137",
"peers": 67,
"pubkey_node": "n9LGH8mv1XumE6eRV8sY7tRLdJSqbJ874G15mztbQB4BTCiaJXjP",
"server_state": "full",
"server_state_duration_us": "514336593812",
"state_accounting": {
"connected": {
"duration_us": "252153624",
"transitions": "2"
},
"disconnected": {
"duration_us": "1045046",
"transitions": "2"
},
"full": {
"duration_us": "514336593812",
"transitions": "1"
},
"syncing": {
"duration_us": "2002505",
"transitions": "1"
},
"tracking": {
"duration_us": "74",
"transitions": "1"
}
},
"time": "2022-Sep-07 19:50:48.492886 UTC",
"uptime": 514591,
"validated_ledger": {
"age": 3,
"base_fee_xrp": 0.00001,
"hash": "3198869EF19293B9ACB22DDA66658E22EA6822AFC396829CE9CADED60E5CA82A",
"reserve_base_xrp": 10,
"reserve_inc_xrp": 2,
"seq": 30983432
},
"validation_quorum": 5
}
},
"status": "success",
"type": "response"
}
Option 2
{
"id": 8,
"result": {
"alternatives": [],
"destination_account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"destination_amount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0.001"
},
"full_reply": false,
"id": 8,
"source_account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"
},
"status": "success",
"type": "response"
}
So turns out the path_search_max field gets checked for both path_find and ripple_path_find and returns an error when disabled.
So how come that you always get an empty array on Testnet instead of an error, even if there should be paths?
Error when path finding is disabled:
{
"error": "notSupported",
"error_code": 75,
"error_message": "Operation not supported.",
"id": 8,
"request": {
"command": "ripple_path_find",
"destination_account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"destination_amount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0.001"
},
"id": 8,
"source_account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"source_currencies": [
{
"currency": "XRP"
},
{
"currency": "USD"
}
]
},
"status": "error",
"type": "response",
"warnings": [
{
"id": 1004,
"message": "This is a reporting server. The default behavior of a reporting server is to only return validated data. If you are looking for not yet validated data, include \"ledger_index : current\" in your request, which will cause this server to forward the request to a p2p node. If the forward is successful the response will include \"forwarded\" : \"true\""
}
]
}