Skip to content

FEAT: utxo worker gasless endpoints#509

Open
GabrielTozatti wants to merge 5 commits intotzt/feat/utxo-worker-schema-servicefrom
tzt/feat/utxo-worker-gasless-endpoints
Open

FEAT: utxo worker gasless endpoints#509
GabrielTozatti wants to merge 5 commits intotzt/feat/utxo-worker-schema-servicefrom
tzt/feat/utxo-worker-gasless-endpoints

Conversation

@GabrielTozatti
Copy link
Collaborator

Description

Implements the gasless pool endpoints on the Worker, covering UTXO reservation with fee-based filtering and pool statistics with total value aggregation.

Summary

  • Implemented POST /worker/gasless/reserve with estimatedMaxFee validation
  • Added atomic UTXO reservation filtering by amount >= estimatedMaxFee * 1.5
  • Added owner field to GaslessUtxo interface
  • Removed unused ttlSeconds from ReserveUtxoOptions
  • Implemented GET /worker/gasless/pool/stats returning counts per status and totalValue
  • Updated getStats() aggregation to sum amount across all UTXOs using BigInt
  • Replaced total with totalValue: string in GaslessUtxoStats interface
  • Renamed controller status() to stats() aligned with new route

Checklist

  • I reviewed my PR code before submitting
  • I ensured that the implementation is working correctly and did not impact other parts of the app
  • I mentioned the PR link in the task

Copy link
Member

@guimroque guimroque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Summary

Implements gasless pool endpoints with UTXO reservation and statistics. The implementation follows good patterns with proper error handling and atomic operations, but has several critical issues around input validation and business logic that need to be addressed.

Strengths

  • Proper atomic UTXO reservation with MongoDB findOneAndUpdate
  • Good error handling structure with custom AppError class
  • Clean separation of concerns with controller/routes pattern
  • Proper fee-based filtering with 1.5x safety margin

Issues

  • 2 critical, 2 important, 1 suggestion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants