Documentation
¶
Overview ¶
Package tx implements the `fxadmin tx` command family: endorsing, merging, preparing, submitting, and sending configuration update transactions.
Index ¶
- type Handler
- func (*Handler) Endorse(inputPath, configPath, outputPath string) error
- func (*Handler) Merge(inputPaths []string, outputPath string) error
- func (*Handler) Prepare(inputPath, configPath, outputPath string) error
- func (h *Handler) Send(inputPath, configPath, currentBlockPath, outputPath string) error
- func (h *Handler) Submit(inputPath, configPath, currentBlockPath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler executes the tx subcommands. It carries the BCCSP used to build the channel config bundle when reading router endpoints from the config block.
func (*Handler) Endorse ¶
Endorse implements `fxadmin tx endorse`. It reads the marshaled common.ConfigUpdate at inputPath, signs it with the admin identity described by the configuration YAML at configPath, and writes a marshaled common.ConfigUpdateEnvelope carrying that admin's ConfigSignature to outputPath.
func (*Handler) Merge ¶
Merge implements `fxadmin tx merge`. It reads several marshaled common.ConfigUpdateEnvelope files, each endorsing the same ConfigUpdate, and writes a single envelope carrying the shared ConfigUpdate bytes and the union of their signatures. All inputs must endorse identical ConfigUpdate bytes; duplicate signers are de-duplicated, keeping the first occurrence. Signatures are not verified here; their validity is checked against channel policy at submission.
func (*Handler) Prepare ¶
Prepare implements `fxadmin tx prepare`. It reads the endorsed common.ConfigUpdateEnvelope at inputPath and wraps it in a common.Envelope whose channel header is of type CONFIG_UPDATE, signed by the submitting client identity described by the configuration YAML at configPath (a channel writer, which may be one of the admins). The marshaled envelope is written to outputPath, ready for submission to the routers.
func (*Handler) Send ¶
Send implements `fxadmin tx send`, equivalent to `tx prepare` followed by `tx submit` in one step: it prepares the configuration transaction from the endorsed common.ConfigUpdateEnvelope at inputPath, writing it to outputPath, then submits that transaction to the routers of the network described by the config block at currentBlockPath, using the client identity in the configuration YAML at configPath for both steps. The transaction is written by Prepare before Submit broadcasts it, so the record is kept even if the broadcast fails.
func (*Handler) Submit ¶
Submit implements `fxadmin tx submit`. It reads the prepared configuration transaction (a common.Envelope) at inputPath and broadcasts it to every router of the network described by the config block at currentBlockPath, using the client identity in the configuration YAML at configPath to sign the connection. It logs each router's outcome and a summary.
Submit succeeds only when at least 2f+1 of the routers acknowledged the transaction, where f is the number of faulty parties the network tolerates, derived from the number of parties in the config block. Otherwise, it returns an error, so a partial or failed delivery is reported to the caller.