forked from hyperledger/fabric-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proposer.go
67 lines (53 loc) · 1.98 KB
/
proposer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package fab
import (
reqContext "context"
pb "github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/peer"
)
// ProposalProcessor simulates transaction proposal, so that a client can submit the result for ordering.
type ProposalProcessor interface {
ProcessTransactionProposal(reqContext.Context, ProcessProposalRequest) (*TransactionProposalResponse, error)
}
// ProposalSender provides the ability for a transaction proposal to be created and sent.
type ProposalSender interface {
CreateTransactionHeader() (TransactionHeader, error)
SendTransactionProposal(*TransactionProposal, []ProposalProcessor) ([]*TransactionProposalResponse, error)
}
// TransactionID provides the identifier of a Fabric transaction proposal.
type TransactionID string
// EmptyTransactionID represents a non-existing transaction (usually due to error).
const EmptyTransactionID = TransactionID("")
// SystemChannel is the Fabric channel for managaing resources.
const SystemChannel = ""
// TransactionHeader provides a handle to transaction metadata.
type TransactionHeader interface {
TransactionID() TransactionID
Creator() []byte
Nonce() []byte
ChannelID() string
}
// ChaincodeInvokeRequest contains the parameters for sending a transaction proposal.
type ChaincodeInvokeRequest struct {
ChaincodeID string
TransientMap map[string][]byte
Fcn string
Args [][]byte
}
// TransactionProposal contains a marashalled transaction proposal.
type TransactionProposal struct {
TxnID TransactionID
*pb.Proposal
}
// ProcessProposalRequest requests simulation of a proposed transaction from transaction processors.
type ProcessProposalRequest struct {
SignedProposal *pb.SignedProposal
}
// TransactionProposalResponse respresents the result of transaction proposal processing.
type TransactionProposalResponse struct {
Endorser string
Status int32
*pb.ProposalResponse
}