@@ -247,7 +247,9 @@ func (p *Task) getTransactionIfApplied(ctx context.Context, msg *types.Message,
247
247
}
248
248
249
249
// 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 ())
251
253
if err != nil {
252
254
return false , nil , xerrors .Errorf ("failed to load previous actor: %w" , err )
253
255
}
@@ -257,21 +259,26 @@ func (p *Task) getTransactionIfApplied(ctx context.Context, msg *types.Message,
257
259
return false , nil , xerrors .Errorf ("failed to load previous actor state: %w" , err )
258
260
}
259
261
260
- var tx transaction
262
+ var tx * transaction
261
263
262
264
if err := prevActorState .ForEachPendingTxn (func (id int64 , txn multisig.Transaction ) error {
263
265
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
+ }
268
271
}
269
- return xerrors . Errorf ( "pending transaction %d not found" , params . ID )
272
+ return nil
270
273
}); err != nil {
271
274
return false , nil , xerrors .Errorf ("failed to read transaction details: %w" , err )
272
275
}
273
276
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
275
282
276
283
default :
277
284
// Not interested in any other methods
0 commit comments