Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logger: change log level for "Couldn't find UTXO entry" to debug (and ignore message on orphan transactions) #2108

Merged
merged 8 commits into from
Jun 29, 2022
Prev Previous commit
Next Next commit
continue also if orphans
  • Loading branch information
michaelsutton committed Jun 29, 2022
commit ea285755d44490e14df4fd7bef56cf2d482160df
14 changes: 9 additions & 5 deletions app/rpc/rpchandlers/get_mempool_entries_by_addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func HandleGetMempoolEntriesByAddresses(context *rpccontext.Context, _ *router.R
if getMempoolEntriesByAddressesRequest.IncludeOrphanPool {

orphanPoolTransactions := context.Domain.MiningManager().AllOrphanTransactions()
orphanPoolEntriesByAddresse, err := extractMempoolEntriesByAddressesFromTransactions(
orphanPoolEntriesByAddress, err := extractMempoolEntriesByAddressesFromTransactions(
context,
getMempoolEntriesByAddressesRequest.Addresses,
orphanPoolTransactions,
Expand All @@ -59,7 +59,7 @@ func HandleGetMempoolEntriesByAddresses(context *rpccontext.Context, _ *router.R
return errorMessage, nil
}

mempoolEntriesByAddresses = append(mempoolEntriesByAddresses, orphanPoolEntriesByAddresse...)
mempoolEntriesByAddresses = append(mempoolEntriesByAddresses, orphanPoolEntriesByAddress...)
}

return appmessage.NewGetMempoolEntriesByAddressesResponseMessage(mempoolEntriesByAddresses), nil
Expand All @@ -80,9 +80,13 @@ func extractMempoolEntriesByAddressesFromTransactions(context *rpccontext.Contex
for _, transaction := range transactions {

for i, input := range transaction.Inputs {
// TODO: Fix this
if input.UTXOEntry == nil && !areOrphans { //orphans can have `input.UTXOEntry == nil`, this is not a bug!
log.Debugf("Couldn't find UTXO entry for input %d in mempool transaction %s. This is a bug and should be fixed.", i, consensushashing.TransactionID(transaction))
if input.UTXOEntry == nil {
if !areOrphans { // Orphans can legitimately have `input.UTXOEntry == nil`
// TODO: Fix the underlying cause of the bug for non-orphan entries
log.Debugf(
"Couldn't find UTXO entry for input %d in mempool transaction %s. This is a bug and should be fixed.",
i, consensushashing.TransactionID(transaction))
}
continue
}

Expand Down