State channel: state update/signature


What would be the recommended way to know if a channel state change (via event stateChanged) was
triggered by which update we previously signed ?

I’m checking the “update” information at tx-signature time (1), but that is not enough to assert
what I sign will be for sure in the channel/state.

Also, I do get more info calling channel.state() than what I got when “stateChanged” event is triggered (2).

Ideally I would like to receive with stateChanged the most state info available, and being able to check what I get in (1) is included in (2).


Can you give some more details about your use case?

Normally you would check for accepted param, e.g.

const { accepted } = await channel.update(sender, recipient, amount, signFn)

If it’s true then stateChanged will be called with the same transaction.


Actually, this is the other side, not the update caller.

Alice sends an update (and signs it) to Bob.

So first Bob will receive a request to sign the update, so he does sign it. (1)

Then, the update reach the channel state. This will trigger an “state update” event in the channel object. (2).

Now, my question is: what is the best way to know that one update_event (2) is related to with a signed update in (1) ?

Actually know I “guess” the content of the event in (2) is related to the last call I received to (1). But it feels not the best… :frowning:

Thanks Michal!!