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

Commit

Permalink
Merge pull request #437 from BuxOrg/chore-add-more-logs
Browse files Browse the repository at this point in the history
chore(BUX-297): add more logs
  • Loading branch information
arkadiuszos4chain authored Oct 20, 2023
2 parents 27d80ad + 46f3f75 commit 9540f06
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chainstate/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (c *Client) ValidateMiners(ctx context.Context) {
if c.Minercraft().APIType() == minercraft.MAPI {
quote, err := c.Minercraft().FeeQuote(ctx, miner.Miner)
if err != nil {
client.options.logger.Error(ctx, fmt.Sprintf("No FeeQuote response from miner %s", miner.Miner.Name))
client.options.logger.Error(ctx, fmt.Sprintf("No FeeQuote response from miner %s. Reason: %s", miner.Miner.Name, err))
miner.FeeUnit = nil
return
}
Expand All @@ -234,7 +234,7 @@ func (c *Client) ValidateMiners(ctx context.Context) {
} else if c.Minercraft().APIType() == minercraft.Arc {
quote, err := c.Minercraft().PolicyQuote(ctx, miner.Miner)
if err != nil {
client.options.logger.Error(ctx, fmt.Sprintf("No FeeQuote response from miner %s", miner.Miner.Name))
client.options.logger.Error(ctx, fmt.Sprintf("No FeeQuote response from miner %s. Reason: %s", miner.Miner.Name, err))
miner.FeeUnit = nil
return
}
Expand Down
10 changes: 10 additions & 0 deletions paymail.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,26 @@ func startP2PTransaction(client paymail.ClientInterface,

// finalizeP2PTransaction will notify the paymail provider about the transaction
func finalizeP2PTransaction(ctx context.Context, client paymail.ClientInterface, p4 *PaymailP4, transaction *Transaction) (*paymail.P2PTransactionPayload, error) {
if transaction.client != nil {
transaction.client.Logger().Info(ctx, fmt.Sprintf("finalizeP2PTransaction(): start %s for TxID: %s", p4.Format, transaction.ID))
}

p2pTransaction, err := buildP2pTx(ctx, p4, transaction)
if err != nil {
return nil, err
}

response, err := client.SendP2PTransaction(p4.ReceiveEndpoint, p4.Alias, p4.Domain, p2pTransaction)
if err != nil {
if transaction.client != nil {
transaction.client.Logger().Info(ctx, fmt.Sprintf("finalizeP2PTransaction(): error %s for TxID: %s, reason: %s", p4.Format, transaction.ID, err.Error()))
}
return nil, err
}

if transaction.client != nil {
transaction.client.Logger().Info(ctx, fmt.Sprintf("finalizeP2PTransaction(): successfully finished %s for TxID: %s", p4.Format, transaction.ID))
}
return &response.P2PTransactionPayload, nil
}

Expand Down

0 comments on commit 9540f06

Please sign in to comment.