Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit d36e7eb

Browse files
author
Karl Einholz
committed
Adding data access functions
TransactionProposal.GetBytes, deprecates ChainExtension.GetProposalBytes and TransactionProposalResponse.GetPayload Change-Id: Iffebe7328ca7388b58ab2758a8f592c643b5a96b Signed-off-by: Karl Einholz <karl.einholz@securekey.com>
1 parent fe98dcb commit d36e7eb

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

fabric-client/chain.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ type ChainExtension interface {
8787
SignPayload(payload []byte) (*SignedEnvelope, error)
8888
BroadcastEnvelope(envelope *SignedEnvelope) ([]*TransactionResponse, error)
8989

90-
// TODO: This should go somewhere else?
90+
// TODO: This should go somewhere else - see TransactionProposal.GetBytes(). - deprecated
9191
GetProposalBytes(tp *TransactionProposal) ([]byte, error)
9292
}
9393

@@ -109,6 +109,11 @@ type TransactionProposal struct {
109109
proposal *pb.Proposal
110110
}
111111

112+
// GetBytes returns the serialized bytes of this proposal
113+
func (tp *TransactionProposal) GetBytes() ([]byte, error) {
114+
return proto.Marshal(tp.signedProposal)
115+
}
116+
112117
// TransactionProposalResponse ...
113118
/**
114119
* The TransactionProposalResponse result object returned from endorsers.
@@ -122,14 +127,22 @@ type TransactionProposalResponse struct {
122127
proposalResponse *pb.ProposalResponse
123128
}
124129

125-
// GetResponsePayload returns the response payload
130+
// GetResponsePayload returns the response object payload
126131
func (tpr *TransactionProposalResponse) GetResponsePayload() []byte {
127132
if tpr == nil || tpr.proposalResponse == nil {
128133
return nil
129134
}
130135
return tpr.proposalResponse.GetResponse().Payload
131136
}
132137

138+
// GetPayload returns the response payload
139+
func (tpr *TransactionProposalResponse) GetPayload() []byte {
140+
if tpr == nil || tpr.proposalResponse == nil {
141+
return nil
142+
}
143+
return tpr.proposalResponse.Payload
144+
}
145+
133146
// The Transaction object created from an endorsed proposal
134147
type Transaction struct {
135148
proposal *TransactionProposal

0 commit comments

Comments
 (0)