Fix signature in messagepool, wire in context
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
77d004ec06
commit
66c408938b
@ -795,7 +795,7 @@ func (mp *MessagePool) addLocked(m *types.SignedMessage, strict, untrusted bool)
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mp *MessagePool) GetNonce(addr address.Address) (uint64, error) {
|
func (mp *MessagePool) GetNonce(_ context.Context, addr address.Address, _ types.TipSetKey) (uint64, error) {
|
||||||
mp.curTsLk.Lock()
|
mp.curTsLk.Lock()
|
||||||
defer mp.curTsLk.Unlock()
|
defer mp.curTsLk.Unlock()
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ func (tma *testMpoolAPI) ChainComputeBaseFee(ctx context.Context, ts *types.TipS
|
|||||||
|
|
||||||
func assertNonce(t *testing.T, mp *MessagePool, addr address.Address, val uint64) {
|
func assertNonce(t *testing.T, mp *MessagePool, addr address.Address, val uint64) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
n, err := mp.GetNonce(addr)
|
n, err := mp.GetNonce(context.Background(), addr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ func (ms *MessageSigner) SignMessage(ctx context.Context, msg *types.Message, cb
|
|||||||
defer ms.lk.Unlock()
|
defer ms.lk.Unlock()
|
||||||
|
|
||||||
// Get the next message nonce
|
// Get the next message nonce
|
||||||
nonce, err := ms.nextNonce(msg.From)
|
nonce, err := ms.nextNonce(ctx, msg.From)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to create nonce: %w", err)
|
return nil, xerrors.Errorf("failed to create nonce: %w", err)
|
||||||
}
|
}
|
||||||
@ -92,12 +92,12 @@ func (ms *MessageSigner) SignMessage(ctx context.Context, msg *types.Message, cb
|
|||||||
|
|
||||||
// nextNonce gets the next nonce for the given address.
|
// nextNonce gets the next nonce for the given address.
|
||||||
// If there is no nonce in the datastore, gets the nonce from the message pool.
|
// If there is no nonce in the datastore, gets the nonce from the message pool.
|
||||||
func (ms *MessageSigner) nextNonce(addr address.Address) (uint64, error) {
|
func (ms *MessageSigner) nextNonce(ctx context.Context, addr address.Address) (uint64, error) {
|
||||||
// Nonces used to be created by the mempool and we need to support nodes
|
// Nonces used to be created by the mempool and we need to support nodes
|
||||||
// that have mempool nonces, so first check the mempool for a nonce for
|
// that have mempool nonces, so first check the mempool for a nonce for
|
||||||
// this address. Note that the mempool returns the actor state's nonce
|
// this address. Note that the mempool returns the actor state's nonce
|
||||||
// by default.
|
// by default.
|
||||||
nonce, err := ms.mpool.GetNonce(context.TODO(), addr, types.EmptyTSK)
|
nonce, err := ms.mpool.GetNonce(ctx, addr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, xerrors.Errorf("failed to get nonce from mempool: %w", err)
|
return 0, xerrors.Errorf("failed to get nonce from mempool: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ func (a *MpoolAPI) MpoolBatchPushMessage(ctx context.Context, msgs []*types.Mess
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *MpoolAPI) MpoolGetNonce(ctx context.Context, addr address.Address) (uint64, error) {
|
func (a *MpoolAPI) MpoolGetNonce(ctx context.Context, addr address.Address) (uint64, error) {
|
||||||
return a.Mpool.GetNonce(addr)
|
return a.Mpool.GetNonce(ctx, addr, types.EmptyTSK)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *MpoolAPI) MpoolSub(ctx context.Context) (<-chan api.MpoolUpdate, error) {
|
func (a *MpoolAPI) MpoolSub(ctx context.Context) (<-chan api.MpoolUpdate, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user