fix: transaction_record_query nil dereference
package hedera
import (
+ "fmt"
"github.com/hashgraph/hedera-sdk-go/proto"
)
@@ -11,7 +12,7 @@ type TransactionRecordQuery struct {
func NewTransactionRecordQuery() *TransactionRecordQuery {
header := proto.QueryHeader{}
- query := newQuery(false, &header)
+ query := newQuery(true, &header)
pb := &proto.TransactionGetRecordQuery{Header: &header}
return &TransactionRecordQuery{
@@ -20,12 +21,12 @@ func NewTransactionRecordQuery() *TransactionRecordQuery {
}
}
-func TransactionRecordQuery_shouldRetry(status Status, response response) bool {
+func transactionRecordQuery_shouldRetry(status Status, response response) bool {
switch status {
case StatusBusy, StatusUnknown, StatusReceiptNotFound:
return true
}
-
+ fmt.Printf("%+v\n", response.query)
status = Status(response.query.GetTransactionGetRecord().TransactionRecord.Receipt.Status)
switch status {
@@ -36,11 +37,11 @@ func TransactionRecordQuery_shouldRetry(status Status, response response) bool {
}
}
-func TransactionRecordQuery_mapResponseStatus(_ request, response response) Status {
+func transactionRecordQuery_mapResponseStatus(_ request, response response) Status {
return Status(response.query.GetTransactionGetRecord().Header.NodeTransactionPrecheckCode)
}
-func TransactionRecordQuery_getMethod(_ request, channel *channel) method {
+func transactionRecordQuery_getMethod(_ request, channel *channel) method {
return method{
query: channel.getCrypto().GetTxRecordByTxID,
}
@@ -84,6 +85,9 @@ func (query *TransactionRecordQuery) Execute(client *Client) (TransactionRecord,
return TransactionRecord{}, errNoClientProvided
}
+ fmt.Printf("%+v\n", query.pb.Header)
+ fmt.Printf("%+v\n", query.pbHeader)
+
query.queryPayment = NewHbar(2)
query.paymentTransactionID = TransactionIDGenerate(client.operator.accountID)
@@ -110,21 +114,26 @@ func (query *TransactionRecordQuery) Execute(client *Client) (TransactionRecord,
query.paymentTransactionNodeIDs = append(query.paymentTransactionNodeIDs, nodeID)
query.paymentTransactions = append(query.paymentTransactions, transaction)
}
+ println("transactionId10")
+ fmt.Printf("%+v\n", query.pb.Header.String())
+ fmt.Printf("%+v\n", query.pbHeader.String())
resp, err := execute(
client,
request{
query: &query.Query,
},
- TransactionRecordQuery_shouldRetry,
+ transactionRecordQuery_shouldRetry,
query_makeRequest,
query_advanceRequest,
query_getNodeId,
- TransactionRecordQuery_getMethod,
- TransactionRecordQuery_mapResponseStatus,
+ transactionRecordQuery_getMethod,
+ transactionRecordQuery_mapResponseStatus,
query_mapResponse,
)
+ println("transactionId11")
+
if err != nil {
return TransactionRecord{}, err
}
