diff --git a/action_paymails.go b/action_paymails.go index 85231636..11906981 100644 --- a/action_paymails.go +++ b/action_paymails.go @@ -20,7 +20,7 @@ func (c *Client) GetPaymailAddress(ctx context.Context, address string, opts ... if err != nil { return nil, err } else if paymailAddress == nil { - return nil, ErrMissingPaymail + return nil, ErrPaymailNotFound } return paymailAddress, nil @@ -142,7 +142,7 @@ func (c *Client) DeletePaymailAddress(ctx context.Context, address string, opts if err != nil { return err } else if paymailAddress == nil { - return ErrMissingPaymail + return ErrPaymailNotFound } // todo: make a better approach for deleting paymail addresses? @@ -174,7 +174,7 @@ func (c *Client) UpdatePaymailAddressMetadata(ctx context.Context, address strin if err != nil { return nil, err } else if paymailAddress == nil { - return nil, ErrMissingPaymail + return nil, ErrPaymailNotFound } // Update the metadata @@ -200,7 +200,7 @@ func (c *Client) UpdatePaymailAddress(ctx context.Context, address, publicName, if err != nil { return nil, err } else if paymailAddress == nil { - return nil, ErrMissingPaymail + return nil, ErrPaymailNotFound } // Update the public name diff --git a/action_paymails_test.go b/action_paymails_test.go index f295f96f..7b953721 100644 --- a/action_paymails_test.go +++ b/action_paymails_test.go @@ -81,7 +81,7 @@ func (ts *EmbeddedDBTestSuite) Test_DeletePaymailAddress() { paymail := "" err := tc.client.DeletePaymailAddress(tc.ctx, paymail, tc.client.DefaultModelOptions()...) - require.ErrorIs(t, err, ErrMissingPaymail) + require.ErrorIs(t, err, ErrPaymailNotFound) }) ts.T().Run(testCase.name+" - delete unknown paymail address", func(t *testing.T) { @@ -89,7 +89,7 @@ func (ts *EmbeddedDBTestSuite) Test_DeletePaymailAddress() { defer tc.Close(tc.ctx) err := tc.client.DeletePaymailAddress(tc.ctx, testPaymail, tc.client.DefaultModelOptions()...) - require.ErrorIs(t, err, ErrMissingPaymail) + require.ErrorIs(t, err, ErrPaymailNotFound) }) ts.T().Run(testCase.name+" - delete paymail address", func(t *testing.T) { diff --git a/cron_job_declarations.go b/cron_job_declarations.go index f1d6c594..1d039ecc 100644 --- a/cron_job_declarations.go +++ b/cron_job_declarations.go @@ -31,11 +31,11 @@ func (c *Client) cronJobs() taskmanager.CronJobs { Handler: handler(taskCleanupDraftTransactions), }, CronJobNameSyncTransactionBroadcast: { - Period: 30 * time.Second, + Period: 2 * time.Minute, Handler: handler(taskBroadcastTransactions), }, CronJobNameSyncTransactionSync: { - Period: 600 * time.Second, + Period: 5 * time.Minute, Handler: handler(taskSyncTransactions), }, } diff --git a/errors.go b/errors.go index 60f1be78..c8d9d9ed 100644 --- a/errors.go +++ b/errors.go @@ -97,6 +97,9 @@ var ErrDuplicateUTXOs = errors.New("duplicate utxos found") // ErrPaymailAddressIsInvalid is when the paymail address is NOT alias@domain.com var ErrPaymailAddressIsInvalid = errors.New("paymail address is invalid") +// ErrPaymailNotFound is when paymaail could not be found +var ErrPaymailNotFound = errors.New("paymail could not be found") + // ErrUtxoNotReserved is when the utxo is not reserved, but a transaction tries to spend it var ErrUtxoNotReserved = errors.New("transaction utxo has not been reserved for spending") @@ -166,9 +169,6 @@ var ErrUnknownAccessKey = errors.New("unknown access key") // ErrAccessKeyRevoked is when the access key has been revoked var ErrAccessKeyRevoked = errors.New("access key has been revoked") -// ErrMissingPaymail missing paymail -var ErrMissingPaymail = errors.New("missing paymail") - // ErrMissingPaymailID missing id in paymail var ErrMissingPaymailID = errors.New("missing id in paymail") diff --git a/paymail_service_provider.go b/paymail_service_provider.go index 2c28f8cd..a7632dc0 100644 --- a/paymail_service_provider.go +++ b/paymail_service_provider.go @@ -203,7 +203,7 @@ func (p *PaymailDefaultServiceProvider) createPaymailInformation(ctx context.Con if err != nil { return nil, nil, err } else if paymailAddress == nil { - return nil, nil, ErrMissingPaymail + return nil, nil, ErrPaymailNotFound } unlock, err := newWaitWriteLock(ctx, lockKey(paymailAddress), p.client.Cachestore()) diff --git a/sync_tx_service.go b/sync_tx_service.go index d5acc738..2d240107 100644 --- a/sync_tx_service.go +++ b/sync_tx_service.go @@ -136,9 +136,7 @@ func broadcastSyncTransaction(ctx context.Context, syncTx *SyncTransaction) erro if provider, err = syncTx.Client().Chainstate().Broadcast( ctx, syncTx.ID, txHex, defaultBroadcastTimeout, ); err != nil { - _bailAndSaveSyncTransaction( - ctx, syncTx, SyncStatusError, syncActionBroadcast, provider, "broadcast error: "+err.Error(), - ) + _bailAndSaveSyncTransaction(ctx, syncTx, SyncStatusReady, syncActionBroadcast, provider, err.Error()) return err }