Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into rc-v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-4chain authored Feb 6, 2024
2 parents 5ac2858 + 78f810a commit 99c2a38
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
8 changes: 4 additions & 4 deletions action_paymails.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions action_paymails_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ 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) {
tc := ts.genericDBClient(t, testCase.database, false)
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) {
Expand Down
4 changes: 2 additions & 2 deletions cron_job_declarations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
}
Expand Down
6 changes: 3 additions & 3 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ var ErrDuplicateUTXOs = errors.New("duplicate utxos found")
// ErrPaymailAddressIsInvalid is when the paymail address is NOT [email protected]
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")

Expand Down Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion paymail_service_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
4 changes: 1 addition & 3 deletions sync_tx_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 99c2a38

Please sign in to comment.