Documentation ¶
Index ¶
- Constants
- Variables
- func NewSender(api SenderAPI, signer SignerAPI, db *harmonydb.DB) (*Sender, *SendTask)
- type MessageWaiterApi
- type MessageWatcher
- type SendTask
- func (s *SendTask) Adder(taskFunc harmonytask.AddTaskFunc)
- func (s *SendTask) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
- func (s *SendTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)
- func (s *SendTask) TypeDetails() harmonytask.TaskTypeDetails
- type Sender
- type SenderAPI
- type SignerAPI
Constants ¶
const MinConfidence = 6
Variables ¶
var SendLockedWait = 100 * time.Millisecond
Functions ¶
Types ¶
type MessageWaiterApi ¶
type MessageWaiterApi interface { StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) ChainGetTipSetByHeight(context.Context, abi.ChainEpoch, types.TipSetKey) (*types.TipSet, error) ChainGetTipSet(context.Context, types.TipSetKey) (*types.TipSet, error) StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error) ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error) }
type MessageWatcher ¶
type MessageWatcher struct {
// contains filtered or unexported fields
}
func NewMessageWatcher ¶
func NewMessageWatcher(db *harmonydb.DB, ht *harmonytask.TaskEngine, pcs *chainsched.CurioChainSched, api MessageWaiterApi) (*MessageWatcher, error)
type SendTask ¶
type SendTask struct {
// contains filtered or unexported fields
}
func (*SendTask) Adder ¶
func (s *SendTask) Adder(taskFunc harmonytask.AddTaskFunc)
func (*SendTask) CanAccept ¶
func (s *SendTask) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
func (*SendTask) TypeDetails ¶
func (s *SendTask) TypeDetails() harmonytask.TaskTypeDetails
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender abstracts away highly-available message sending with coordination through HarmonyDB. It make sure that nonces are assigned transactionally, and that messages are correctly broadcasted to the network. It ensures that messages are sent serially, and that failures to send don't cause nonce gaps.
func (*Sender) Send ¶
func (s *Sender) Send(ctx context.Context, msg *types.Message, mss *api.MessageSendSpec, reason string) (cid.Cid, error)
Send atomically assigns a nonce, signs, and pushes a message to mempool. maxFee is only used when GasFeeCap/GasPremium fields aren't specified
When maxFee is set to 0, Send will guess appropriate fee based on current chain conditions
Send behaves much like fullnodeApi.MpoolPushMessage, but it coordinates through HarmonyDB, making it safe to broadcast messages from multiple independent API nodes
Send is also currently more strict about required parameters than MpoolPushMessage
type SenderAPI ¶
type SenderAPI interface { StateAccountKey(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, tsk types.TipSetKey) (*types.Message, error) WalletBalance(ctx context.Context, addr address.Address) (big.Int, error) MpoolGetNonce(context.Context, address.Address) (uint64, error) MpoolPush(context.Context, *types.SignedMessage) (cid.Cid, error) }