diff --git a/blockdag/indexers/txindex.go b/blockdag/indexers/txindex.go index ee4cd4d36..5d9e4169d 100644 --- a/blockdag/indexers/txindex.go +++ b/blockdag/indexers/txindex.go @@ -544,16 +544,16 @@ func dbFetchTxAcceptingBlock(dbTx database.Tx, txID *daghash.TxID, dag *blockdag if bucket == nil { return nil, database.Error{ ErrorCode: database.ErrCorruption, - Description: fmt.Sprintf("No accepting blocks "+ - "were found for %s", txID), + Description: fmt.Sprintf("No accepting blocks bucket "+ + "exists for %s", txID), } } cursor := bucket.Cursor() if !cursor.First() { return nil, database.Error{ ErrorCode: database.ErrCorruption, - Description: fmt.Sprintf("No accepting blocks "+ - "were found for %s", txID), + Description: fmt.Sprintf("Accepting blocks bucket is "+ + "empty for %s", txID), } } for ; cursor.Key() != nil; cursor.Next() { diff --git a/server/rpc/rpcserver.go b/server/rpc/rpcserver.go index d016d8f2a..5db6a7951 100644 --- a/server/rpc/rpcserver.go +++ b/server/rpc/rpcserver.go @@ -3303,7 +3303,10 @@ func handleSearchRawTransactions(s *Server, cmd interface{}, closeChan <-chan st result.BlockHash = blkHashStr } - if s.cfg.TxIndex != nil { + // rtx.tx is only set when the transaction was retrieved from the mempool + result.IsInMempool = rtx.tx != nil + + if s.cfg.TxIndex != nil && !result.IsInMempool { confirmations, err := txConfirmations(s, mtx.TxID()) if err != nil { context := "Failed to obtain block confirmations" @@ -3311,9 +3314,6 @@ func handleSearchRawTransactions(s *Server, cmd interface{}, closeChan <-chan st } result.Confirmations = &confirmations } - - // rtx.tx is only set when the transaction was retrieved from the mempool - result.IsInMempool = rtx.tx != nil } return srtList, nil