Skip to content

Commit 8a996b7

Browse files
authored
feat: support certificates in utxorpc conversions (#1034)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 9d634fb commit 8a996b7

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

ledger/common/tx.go

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ func (b *TransactionBodyBase) Utxorpc() *utxorpc.Tx {
193193
// TransactionBodyToUtxorpc is a common helper for converting TransactionBody to utxorpc.Tx
194194
func TransactionBodyToUtxorpc(tx TransactionBody) *utxorpc.Tx {
195195
txi := []*utxorpc.TxInput{}
196-
txri := []*utxorpc.TxInput{}
197196
txo := []*utxorpc.TxOutput{}
198197
for _, i := range tx.Inputs() {
199198
input := i.Utxorpc()
@@ -206,24 +205,30 @@ func TransactionBodyToUtxorpc(tx TransactionBody) *utxorpc.Tx {
206205
}
207206
txo = append(txo, output)
208207
}
209-
for _, ri := range tx.ReferenceInputs() {
210-
input := ri.Utxorpc()
211-
txri = append(txri, input)
212-
}
213208
ret := &utxorpc.Tx{
214209
Inputs: txi,
215210
Outputs: txo,
216-
// Certificates: tx.Certificates(),
217-
// Withdrawals: tx.Withdrawals(),
218-
// Mint: tx.Mint(),
219-
ReferenceInputs: txri,
220-
// Witnesses: tx.Witnesses(),
221-
// Collateral: tx.Collateral(),
211+
// Certificates: tx.Certificates(),
212+
// Withdrawals: tx.Withdrawals(),
213+
// Mint: tx.Mint(),
214+
// ReferenceInputs: tx.ReferenceInputs(),
215+
// Witnesses: tx.Witnesses(),
216+
// Collateral: tx.Collateral(),
222217
Fee: tx.Fee(),
223-
// Successful: tx.Successful(),
224-
// Auxiliary: tx.AuxData(),
225-
// Validity: tx.Validity(),
218+
// Validity: tx.Validity(),
219+
// Successful: tx.Successful(),
220+
// Auxiliary: tx.AuxData(),
226221
Hash: tx.Hash().Bytes(),
222+
// Proposals: tx.ProposalProcedures(),
223+
}
224+
for _, ri := range tx.ReferenceInputs() {
225+
input := ri.Utxorpc()
226+
ret.ReferenceInputs = append(ret.ReferenceInputs, input)
227227
}
228+
for _, c := range tx.Certificates() {
229+
cert := c.Utxorpc()
230+
ret.Certificates = append(ret.Certificates, cert)
231+
}
232+
228233
return ret
229234
}

0 commit comments

Comments
 (0)