Skip to content

Commit

Permalink
Add height to Flash.Listener.State
Browse files Browse the repository at this point in the history
We are gonna use the height for checking when states has changed.
  • Loading branch information
linked0 authored and hewison-chris committed Feb 16, 2022
1 parent 54c4597 commit c4fde63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/agora/flash/Node.d
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ public class FlashNode : FlashControlAPI
if (state == ChannelState.Open) // todo: might not exist
this.onChannelOpen(reg_pk, this.channels[chan_id].conf, height);

this.listener.onChannelNotify(reg_pk, chan_id, state, error);
this.listener.onChannelNotify(reg_pk, chan_id, state, error, height);
}

///
Expand Down
5 changes: 3 additions & 2 deletions source/agora/test/Flash.d
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ private class FlashListener : TestFlashListenerAPI
{
ChannelState state;
ErrorCode error;
Height height;
}

State[PublicKey][Hash] channel_state;
Expand Down Expand Up @@ -565,12 +566,12 @@ private class FlashListener : TestFlashListenerAPI
}

public void onChannelNotify (PublicKey pk, Hash chan_id, ChannelState state,
ErrorCode error, Height = Height(0))
ErrorCode error, Height height = Height(0))
{
log.info("Channel event {}, id {}", state, chan_id.flashPrettify);
if (chan_id !in this.channel_state)
this.channel_state[chan_id] = typeof(this.channel_state[chan_id]).init;
this.channel_state[chan_id][pk] = State(state, error);
this.channel_state[chan_id][pk] = State(state, error, height);
}

public Result!ChannelUpdate onRequestedChannelOpen (PublicKey pk, ChannelConfig conf)
Expand Down

0 comments on commit c4fde63

Please sign in to comment.