Skip to content

update {next,prev}_consensus_state implementations #164

@rnbguy

Description

@rnbguy

Bug in next_consensus_state

The following comparison should be reversed.

if height > &IbcHeight::new(path.revision_number, path.revision_height).unwrap() {
return Some(path);
}

Refactor prev_consensus_state

We can simplify the prev_consensus_state as next_consensus_state if we reverse the iterator here.

let pos = keys.iter().position(|path| {

ref impl in ibc-rs testkit.


Apart from that, next_consensus_state and prev_consensus_state - both cases, we are trying to find a partition point. Considering the keys are sorted, we may want to use partition_point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions