Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions internal/utxorpc/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ func (s *queryServiceServer) ReadUtxos(
for _, txo := range keys {
// txo.Hash, txo.Index
tmpTxIn := ledger.ShelleyTransactionInput{
TxId: ledger.Blake2b256(txo.Hash),
OutputIndex: uint32(txo.Index),
TxId: ledger.Blake2b256(txo.GetHash()),
OutputIndex: uint32(txo.GetIndex()),
}
tmpTxIns = append(tmpTxIns, tmpTxIn)
}
Expand All @@ -137,16 +137,16 @@ func (s *queryServiceServer) ReadUtxos(
var aud query.AnyUtxoData
var audc query.AnyUtxoData_Cardano
aud.TxoRef = txo
txHash := hex.EncodeToString(txo.Hash)
txHash := hex.EncodeToString(txo.GetHash())
if utxoId.Hash.String() == txHash &&
// #nosec G115
uint32(utxoId.Idx) == txo.Index {
uint32(utxoId.Idx) == txo.GetIndex() {
aud.NativeBytes = utxo.Cbor()
audc.Cardano = utxo.Utxorpc()
if audc.Cardano.Datum != nil {
if audc.Cardano.GetDatum() != nil {
// Check if Datum.Hash is all zeroes
isAllZeroes := true
for _, b := range audc.Cardano.Datum.Hash {
for _, b := range audc.Cardano.GetDatum().GetHash() {
if b != 0 {
isAllZeroes = false
break
Expand All @@ -159,7 +159,7 @@ func (s *queryServiceServer) ReadUtxos(
"Datum Hash is all zeroes; setting Datum to nil",
)
} else {
log.Printf("Datum Hash present: %x", audc.Cardano.Datum.Hash)
log.Printf("Datum Hash present: %x", audc.Cardano.GetDatum().GetHash())
}
}
aud.ParsedState = &audc
Expand All @@ -173,8 +173,8 @@ func (s *queryServiceServer) ReadUtxos(
}
log.Printf(
"Prepared response with LedgerTip: Slot=%v, Hash=%v",
resp.LedgerTip.Slot,
resp.LedgerTip.Hash,
resp.GetLedgerTip().GetSlot(),
resp.GetLedgerTip().GetHash(),
)
log.Printf("Final response: %v", resp)
return connect.NewResponse(resp), nil
Expand Down Expand Up @@ -282,10 +282,10 @@ func (s *queryServiceServer) SearchUtxos(
// If AssetPattern is specified, filter based on it
if assetPattern != nil {
assetFound := false
for _, multiasset := range audc.Cardano.Assets {
if bytes.Equal(multiasset.PolicyId, assetPattern.PolicyId) {
for _, asset := range multiasset.Assets {
if bytes.Equal(asset.Name, assetPattern.AssetName) {
for _, multiasset := range audc.Cardano.GetAssets() {
if bytes.Equal(multiasset.GetPolicyId(), assetPattern.GetPolicyId()) {
for _, asset := range multiasset.GetAssets() {
if bytes.Equal(asset.GetName(), assetPattern.GetAssetName()) {
assetFound = true
break
}
Expand Down
2 changes: 1 addition & 1 deletion internal/utxorpc/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func (s *submitServiceServer) WatchMempool(
Stage: submit.Stage_STAGE_MEMPOOL,
}
resp.Tx = record
if string(record.NativeBytes) == cTx.String() {
if string(record.GetNativeBytes()) == cTx.String() {
if predicate == nil {
err := stream.Send(resp)
if err != nil {
Expand Down