returns forfeitsTxs in Ping RPC while the finalization started (#161)

This commit is contained in:
Louis Singer
2024-04-29 18:58:11 +02:00
committed by GitHub
parent 4ef35c8d26
commit dc64947d28
7 changed files with 226 additions and 182 deletions

View File

@@ -34,7 +34,7 @@ type Service interface {
GetRoundByTxid(ctx context.Context, poolTxid string) (*domain.Round, error)
GetCurrentRound(ctx context.Context) (*domain.Round, error)
GetEventsChannel(ctx context.Context) <-chan domain.RoundEvent
UpdatePaymentStatus(ctx context.Context, id string) error
UpdatePaymentStatus(ctx context.Context, id string) (unsignedForfeitTxs []string, err error)
ListVtxos(ctx context.Context, pubkey *secp256k1.PublicKey) ([]domain.Vtxo, []domain.Vtxo, error)
GetInfo(ctx context.Context) (string, int64, int64, error)
Onboard(ctx context.Context, boardingTx string, congestionTree tree.CongestionTree, userPubkey *secp256k1.PublicKey) error
@@ -178,8 +178,17 @@ func (s *service) ClaimVtxos(ctx context.Context, creds string, receivers []doma
return s.paymentRequests.update(*payment)
}
func (s *service) UpdatePaymentStatus(_ context.Context, id string) error {
return s.paymentRequests.updatePingTimestamp(id)
func (s *service) UpdatePaymentStatus(_ context.Context, id string) ([]string, error) {
err := s.paymentRequests.updatePingTimestamp(id)
if err != nil {
if _, ok := err.(errPaymentNotFound); ok {
return s.forfeitTxs.view(), nil
}
return nil, err
}
return nil, nil
}
func (s *service) SignVtxos(ctx context.Context, forfeitTxs []string) error {