Skip to content

Commit d4e6825

Browse files
committed
🐛 [backend/eth/channel] Use the provided Log from EventSub.
Since a specific event that was casted from a generic event does not contain Raw field, we have to use the generic Log field here. Geth gets around this by manually setting the Raw field in their specifig event subs every time. Signed-off-by: Oliver Tale-Yazdi <oliver@perun.network>
1 parent 728a961 commit d4e6825

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

backend/ethereum/channel/subscription.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ evloop:
8484
currentTimeout := current.Timeout().(*BlockTimeout)
8585
// if newer version or same version and newer timeout, replace
8686
if current.Version() < next.Version || current.Version() == next.Version && currentTimeout.Time < next.Timeout {
87-
e, err := a.convertEvent(ctx, next)
87+
e, err := a.convertEvent(ctx, next, _next.Log.TxHash)
8888
if err != nil {
8989
r.err <- err
9090
break evloop
@@ -95,7 +95,7 @@ evloop:
9595
r.next <- current
9696
}
9797
default: // next-channel is empty
98-
e, err := a.convertEvent(ctx, next)
98+
e, err := a.convertEvent(ctx, next, _next.Log.TxHash)
9999
if err != nil {
100100
r.err <- err
101101
break evloop
@@ -147,14 +147,14 @@ func (r *RegisteredSub) Err() error {
147147
return <-r.err
148148
}
149149

150-
func (a *Adjudicator) convertEvent(ctx context.Context, e *adjudicator.AdjudicatorChannelUpdate) (channel.AdjudicatorEvent, error) {
150+
func (a *Adjudicator) convertEvent(ctx context.Context, e *adjudicator.AdjudicatorChannelUpdate, txHash common.Hash) (channel.AdjudicatorEvent, error) {
151151
base := channel.NewAdjudicatorEventBase(e.ChannelID, NewBlockTimeout(a.ContractInterface, e.Timeout), e.Version)
152152
switch e.Phase {
153153
case phaseDispute:
154154
return &channel.RegisteredEvent{AdjudicatorEventBase: *base}, nil
155155

156156
case phaseForceExec:
157-
args, err := a.fetchProgressCallData(ctx, e.Raw.TxHash)
157+
args, err := a.fetchProgressCallData(ctx, txHash)
158158
if err != nil {
159159
return nil, errors.WithMessage(err, "fetching call data")
160160
}

0 commit comments

Comments
 (0)