Skip to content

Commit

Permalink
GH-600: Adapt to new Pokt message changes
Browse files Browse the repository at this point in the history
  • Loading branch information
masqrauder committed Jul 23, 2023
1 parent b43a48f commit 530c97c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions node/src/blockchain/blockchain_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ impl BlockchainBridge {

pub fn extract_max_block_count(&self, error: BlockchainError) -> Option<u64> {
let regex_result =
Regex::new(r".* (max:|more than|allowed for your plan:|limited to) (?P<max_block_count>\d+)(.*| blocks at once\.)")
Regex::new(r".* (max: |allowed for your plan: |is limited to |block range limit \()(?P<max_block_count>\d+).*")
.expect("Invalid regex");
let max_block_count = match error {
BlockchainError::QueryFailed(msg) => match regex_result.captures(msg.as_str()) {
Expand Down Expand Up @@ -2041,7 +2041,9 @@ mod tests {

#[test]
fn extract_max_block_range_from_pokt_error_response() {
let result = BlockchainError::QueryFailed("RPC error: Error { code: ServerError(-32064), message: \"You cannot query logs for more than 100000 blocks at once.\", data: None }".to_string());
// [{"jsonrpc":"2.0","id":4,"result":"0x2400ee1","error":{}},{"jsonrpc":"2.0","id":5,"error":{"code":-32001,"message":"Relay request failed validation: invalid relay request: eth_getLogs block range limit (100000 blocks) exceeded"}}]

let result = BlockchainError::QueryFailed("RPC error: Error { code: ServerError(-32001), message: \"Relay request failed validation: invalid relay request: eth_getLogs block range limit (100000 blocks) exceeded\"}".to_string());
let subject = BlockchainBridge::new(
Box::new(BlockchainInterfaceMock::default()),
Box::new(PersistentConfigurationMock::default()),
Expand Down

0 comments on commit 530c97c

Please sign in to comment.