Skip to content

Commit 83be060

Browse files
committed
Revert: feat(adjudicate): stateMap to signedState: This reverts commit 2bb1a55.
Signed-off-by: Minh Huy Tran <huy@perun.network>
1 parent a5c5eb3 commit 83be060

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

channel/adjudicator.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ type (
207207
}
208208

209209
// StateMap represents a channel state tree.
210-
StateMap map[ID]*SignedState
210+
StateMap map[ID]*State
211211
)
212212

213213
// NewProgressReq creates a new ProgressReq object.
@@ -305,12 +305,12 @@ func (t *TimeTimeout) String() string {
305305

306306
// MakeStateMap creates a new StateMap object.
307307
func MakeStateMap() StateMap {
308-
return make(map[ID]*SignedState)
308+
return make(map[ID]*State)
309309
}
310310

311311
// Add adds the given states to the state map.
312-
func (m StateMap) Add(states ...*SignedState) {
312+
func (m StateMap) Add(states ...*State) {
313313
for _, s := range states {
314-
m[s.State.ID] = s
314+
m[s.ID] = s
315315
}
316316
}

client/adjudicate.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,7 @@ func (c *Channel) gatherSubChannelStates() (states []channel.SignedState, err er
445445
func (c *Channel) subChannelStateMap() (states channel.StateMap, err error) {
446446
states = channel.MakeStateMap()
447447
err = c.applyToSubChannelsRecursive(func(c *Channel) error {
448-
states[c.ID()] = &channel.SignedState{
449-
Params: c.Params(),
450-
State: c.machine.CurrentTX().State,
451-
Sigs: c.machine.CurrentTX().Sigs,
452-
}
448+
states[c.ID()] = c.state()
453449
return nil
454450
})
455451
return

client/test/backend.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ func (b *MockBackend) Withdraw(_ context.Context, req channel.AdjudicatorReq, su
265265
states[0] = req.Tx.State
266266
i := 1
267267
for _, s := range subStates {
268-
states[i] = s.State
268+
states[i] = s
269269
i++
270270
}
271271
if err := b.checkStates(states, checkWithdraw); err != nil {
@@ -361,7 +361,7 @@ func (b *MockBackend) setLatestEvent(ch channel.ID, e channel.AdjudicatorEvent)
361361
func outcomeRecursive(state *channel.State, subStates channel.StateMap) (outcome channel.Balances) {
362362
outcome = state.Balances.Clone()
363363
for _, subAlloc := range state.Locked {
364-
subOutcome := outcomeRecursive(subStates[subAlloc.ID].State, subStates)
364+
subOutcome := outcomeRecursive(subStates[subAlloc.ID], subStates)
365365
for a, bals := range subOutcome {
366366
for p, bal := range bals {
367367
_p := p

client/test/subchannel_dispute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (r *DisputeSusie) exec(_cfg ExecConfig, ledgerChannel *paymentChannel) {
106106

107107
r.log.Debug("Attempt withdrawing refuted state.")
108108
m := channel.MakeStateMap()
109-
m.Add(&subState0)
109+
m.Add(subState0.State)
110110
err = r.setup.Adjudicator.Withdraw(ctx, reqLedger, m)
111111
r.RequireTruef(err != nil, "withdraw should fail because other party should have refuted.")
112112

0 commit comments

Comments
 (0)