diff --git a/docs/json_rpc_api.mediawiki b/docs/json_rpc_api.mediawiki
index 9e73a511..21408048 100644
--- a/docs/json_rpc_api.mediawiki
+++ b/docs/json_rpc_api.mediawiki
@@ -1892,7 +1892,9 @@ of the best block.
# includemempool: (string,default=true) Include the mempool when true.
|-
!Description
-| Returns information about an unspent transaction output.
+|
+: Returns information about an unspent transaction output.
+: Returns null if the output is spent or never existed.
|-
!Returns
|(json object)
diff --git a/rpcserver.go b/rpcserver.go
index 8b9c1741..f20e3399 100644
--- a/rpcserver.go
+++ b/rpcserver.go
@@ -62,7 +62,7 @@ const (
jsonrpcSemverString = "6.1.1"
jsonrpcSemverMajor = 6
jsonrpcSemverMinor = 1
- jsonrpcSemverPatch = 1
+ jsonrpcSemverPatch = 2
)
const (
@@ -3139,11 +3139,13 @@ func handleGetTxOut(_ context.Context, s *rpcServer, cmd interface{}) (interface
} else {
entry, err := s.cfg.Chain.FetchUtxoEntry(txHash)
if err != nil {
- return nil, rpcNoTxInfoError(txHash)
+ context := "Failed to retrieve utxo entry"
+ return nil, rpcInternalError(err.Error(), context)
}
// To match the behavior of the reference client, return nil
- // (JSON null) if the transaction output is spent by another
+ // (JSON null) if the transaction output could not be found
+ // (never existed or was pruned) or is spent by another
// transaction already in the main chain. Mined transactions
// that are spent by a mempool transaction are not affected by
// this.