代码拉取完成,页面将自动刷新
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package transaction
import (
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/core/ledger/customtx"
"github.com/hyperledger/fabric/protos/common"
"github.com/pkg/errors"
)
// Processor implements the interface 'github.com/hyperledger/fabric/core/ledger/customtx/Processor'
// for FabToken transactions
type Processor struct {
TMSManager TMSManager
}
func (p *Processor) GenerateSimulationResults(txEnv *common.Envelope, simulator ledger.TxSimulator, initializingLedger bool) error {
// Extract channel header and token transaction
ch, ttx, ci, err := UnmarshalTokenTransaction(txEnv.Payload)
if err != nil {
return errors.WithMessage(err, "failed unmarshalling token transaction")
}
// Get a TMSTxProcessor that corresponds to the channel
txProcessor, err := p.TMSManager.GetTxProcessor(ch.ChannelId)
if err != nil {
return errors.WithMessage(err, "failed getting committer")
}
// Extract the read dependencies and ledger updates associated to the transaction using simulator
err = txProcessor.ProcessTx(ch.TxId, ci, ttx, simulator)
if err != nil {
// If the processor returns an InvalidTxError error then
// the transaction should be marked as invalid, therefore this error
// should be propagated.
// Otherwise, the error can be wrapped with additional information
if _, ok := err.(*customtx.InvalidTxError); ok {
return err
}
return errors.WithMessagef(err, "failed committing transaction for channel %s", ch.ChannelId)
}
return err
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。