Documentation ¶
Overview ¶
Package localtxsubmission implements the Ouroboros local-tx-submission protocol
Index ¶
- Constants
- Variables
- func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error)
- type Client
- type Config
- type LocalTxSubmission
- type LocalTxSubmissionOptionFunc
- type MsgAcceptTx
- type MsgDone
- type MsgRejectTx
- type MsgSubmitTx
- type MsgSubmitTxTransaction
- type Server
- type SubmitTxFunc
- type TransactionRejectedError
Constants ¶
const ( MessageTypeSubmitTx = 0 MessageTypeAcceptTx = 1 MessageTypeRejectTx = 2 MessageTypeDone = 3 )
Message types
Variables ¶
var StateMap = protocol.StateMap{ // contains filtered or unexported fields }
LocalTxSubmission protocol state machine
Functions ¶
Types ¶
type Client ¶
Client implements the LocalTxSubmission client
func NewClient ¶
func NewClient(protoOptions protocol.ProtocolOptions, cfg *Config) *Client
NewClient returns a new LocalTxSubmission client object
type Config ¶
type Config struct { SubmitTxFunc SubmitTxFunc Timeout time.Duration }
Config is used to configure the LocalTxSubmission protocol instance
func NewConfig ¶
func NewConfig(options ...LocalTxSubmissionOptionFunc) Config
NewConfig returns a new LocalTxSubmission config object with the provided options
type LocalTxSubmission ¶
LocalTxSubmission is a wrapper object that holds the client and server instances
func New ¶
func New(protoOptions protocol.ProtocolOptions, cfg *Config) *LocalTxSubmission
New returns a new LocalTxSubmission object
type LocalTxSubmissionOptionFunc ¶
type LocalTxSubmissionOptionFunc func(*Config)
LocalTxSubmissionOptionFunc represents a function used to modify the LocalTxSubmission protocol config
func WithSubmitTxFunc ¶
func WithSubmitTxFunc(submitTxFunc SubmitTxFunc) LocalTxSubmissionOptionFunc
WithSubmitTxFunc specifies the callback function when a TX is submitted when acting as a server
func WithTimeout ¶
func WithTimeout(timeout time.Duration) LocalTxSubmissionOptionFunc
WithTimeout specifies the timeout for a TX submit operation when acting as a client
type MsgAcceptTx ¶
type MsgAcceptTx struct {
protocol.MessageBase
}
func NewMsgAcceptTx ¶
func NewMsgAcceptTx() *MsgAcceptTx
type MsgDone ¶
type MsgDone struct {
protocol.MessageBase
}
func NewMsgDone ¶
func NewMsgDone() *MsgDone
type MsgRejectTx ¶
type MsgRejectTx struct { protocol.MessageBase // We use RawMessage here because the failure reason can be numerous different // structures, and we'll need to do further processing Reason cbor.RawMessage }
func NewMsgRejectTx ¶
func NewMsgRejectTx(reasonCbor []byte) *MsgRejectTx
type MsgSubmitTx ¶
type MsgSubmitTx struct { protocol.MessageBase Transaction MsgSubmitTxTransaction }
func NewMsgSubmitTx ¶
func NewMsgSubmitTx(eraId uint16, tx []byte) *MsgSubmitTx
type MsgSubmitTxTransaction ¶
type TransactionRejectedError ¶
TransactionRejectedError represents an explicit transaction rejection
func (TransactionRejectedError) Error ¶
func (e TransactionRejectedError) Error() string