{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package customtx\n\n## Functions\n\n```go\nfunc Initialize(customTxProcessors Processors)\n```\nInitialize sets the custom processors. This function is expected to be invoked only during ledgermgmt.Initialize() function.\n\n```go\nfunc InitializeTestEnv(processors Processors)\n```\nInitializeTestEnv initializes custom tx processors for test\n\n## Types\n\n```go\ntype InvalidTxError struct {\n\tMsg string\n}\n```\nInvalidTxError is expected to be thrown by a custom transaction processor (an implementation of interface \\`Processor\\`) if it wants the ledger to record a particular transaction as invalid\n\n```go\nfunc (e *InvalidTxError) Error() string\n```\n\n```go\ntype Processor interface {\n\tGenerateSimulationResults(txEnvelop *common.Envelope, simulator ledger.TxSimulator, initializingLedger bool) error\n}\n```\nProcessor allows to generate simulation results during commit time for custom transactions. A custom processor may represent the information in a propriety fashion and can use this process to translate the information into the form of \\`TxSimulationResults\\`. Because, the original information is signed in a custom representation, an implementation of a \\`Processor\\` should be cautious that the custom representation is used for simulation in an deterministic fashion and should take care of compatibility cross fabric versions. 'initializingLedger' true indicates that either the transaction being processed is from the genesis block or the ledger is syncing the state (which could happen during peer startup if the statedb is found to be lagging behind the blockchain). In the former case, the transactions processed are expected to be valid and in the latter case, only valid transactions are reprocessed and hence any validation can be skipped.\n\n```go\nfunc GetProcessor(txType common.HeaderType) Processor\n```\nGetProcessor returns a Processor associated with the txType\n\n```go\ntype Processors map[common.HeaderType]Processor\n```\nProcessors maintains the association between a custom transaction type to its corresponding tx processor\n\n","path":"github.com/eric-erki/https-hyperledger.org/core/ledger/customtx","name":"customtx","synopsis":"","isRedistributable":true}
