More tweaking of context handling in the messagepool
This commit is contained in:
@@ -61,8 +61,7 @@ func ChainBlockService(bs dtypes.ExposedBlockstore, rem dtypes.ChainBitswap) dty
|
||||
|
||||
func MessagePool(lc fx.Lifecycle, sm *stmgr.StateManager, ps *pubsub.PubSub, ds dtypes.MetadataDS, nn dtypes.NetworkName, j journal.Journal) (*messagepool.MessagePool, error) {
|
||||
mpp := messagepool.NewProvider(sm, ps)
|
||||
// TODO: I still don't know how go works -- should this context be part of the builder?
|
||||
mp, err := messagepool.New(context.TODO(), mpp, ds, nn, j)
|
||||
mp, err := messagepool.New(mpp, ds, nn, j)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("constructing mpool: %w", err)
|
||||
}
|
||||
|
||||
@@ -27,14 +27,14 @@ func (a *MpoolNonceAPI) GetNonce(ctx context.Context, addr address.Address) (uin
|
||||
ts := a.StateAPI.Chain.GetHeaviestTipSet()
|
||||
|
||||
// make sure we have a key address so we can compare with messages
|
||||
keyAddr, err := a.StateAPI.StateManager.ResolveToKeyAddress(context.TODO(), addr, ts)
|
||||
keyAddr, err := a.StateAPI.StateManager.ResolveToKeyAddress(ctx, addr, ts)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// Load the last nonce from the state, if it exists.
|
||||
highestNonce := uint64(0)
|
||||
if baseActor, err := a.StateAPI.StateManager.LoadActorRaw(context.TODO(), addr, ts.ParentState()); err != nil {
|
||||
if baseActor, err := a.StateAPI.StateManager.LoadActorRaw(ctx, addr, ts.ParentState()); err != nil {
|
||||
if !xerrors.Is(err, types.ErrActorNotFound) {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user