Skip to content

Commit ed757da

Browse files
authored
fix: msapprovals missing pending transaction (#395)
1 parent daf7e2b commit ed757da

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

tasks/actorstate/multisig.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ func ExtractMultisigTransactions(a ActorInfo, ec *MsigExtractionContext) (multis
7575
return nil, xerrors.Errorf("diffing pending transactions: %w", err)
7676
}
7777

78-
log.Debugw("multisig diff", "added", len(changes.Added), "modified", len(changes.Modified), "removed", len(changes.Removed))
79-
8078
for _, added := range changes.Added {
8179
approved := make([]string, len(added.Tx.Approved))
8280
for i, addr := range added.Tx.Approved {

tasks/msapprovals/msapprovals.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ func (p *Task) getTransactionIfApplied(ctx context.Context, msg *types.Message,
247247
}
248248

249249
// Get state of actor before the message was applied
250-
act, err := p.node.StateGetActor(ctx, msg.To, pts.Key())
250+
// pts is the tipset containing the messages, so we need the state as seen at the start of message processing
251+
// for that tipset
252+
act, err := p.node.StateGetActor(ctx, msg.To, pts.Parents())
251253
if err != nil {
252254
return false, nil, xerrors.Errorf("failed to load previous actor: %w", err)
253255
}
@@ -257,21 +259,26 @@ func (p *Task) getTransactionIfApplied(ctx context.Context, msg *types.Message,
257259
return false, nil, xerrors.Errorf("failed to load previous actor state: %w", err)
258260
}
259261

260-
var tx transaction
262+
var tx *transaction
261263

262264
if err := prevActorState.ForEachPendingTxn(func(id int64, txn multisig.Transaction) error {
263265
if id == int64(params.ID) {
264-
tx.id = int64(params.ID)
265-
tx.to = txn.To.String()
266-
tx.value = txn.Value.String()
267-
return nil
266+
tx = &transaction{
267+
id: int64(params.ID),
268+
to: txn.To.String(),
269+
value: txn.Value.String(),
270+
}
268271
}
269-
return xerrors.Errorf("pending transaction %d not found", params.ID)
272+
return nil
270273
}); err != nil {
271274
return false, nil, xerrors.Errorf("failed to read transaction details: %w", err)
272275
}
273276

274-
return true, &tx, nil
277+
if tx == nil {
278+
return false, nil, xerrors.Errorf("pending transaction %d not found", params.ID)
279+
}
280+
281+
return true, tx, nil
275282

276283
default:
277284
// Not interested in any other methods

0 commit comments

Comments
 (0)