From 37983cc806a2fbd7ec2880afe41d741dcbde8487 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 20 Feb 2024 15:25:43 +0100 Subject: [PATCH] Add warning logs for low mana balance --- .github/workflows/golangci-lint.yml | 2 +- .github/workflows/release.yml | 2 +- pkg/faucet/faucet.go | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index a010f17..bb8c77b 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code into the Go module directory - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'true' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 97f5fbc..a2667be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code into the Go module directory - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'true' diff --git a/pkg/faucet/faucet.go b/pkg/faucet/faucet.go index d91d511..90d1689 100644 --- a/pkg/faucet/faucet.go +++ b/pkg/faucet/faucet.go @@ -666,11 +666,15 @@ func (f *Faucet) createTransactionBuilder(api iotago.API, unspentOutputs []UTXOB unboundStoredManaRemainder, err := safemath.SafeSub(availableManaInputs.UnboundStoredMana, totalManaPayouts) if err != nil { + f.logSoftError(ierrors.Wrapf(err, "not enough mana left in the faucet to do the payouts: %d < %d", availableManaInputs.UnboundStoredMana, totalManaPayouts)) + // underflow => not enough mana left in the faucet return 0 } if unboundStoredManaRemainder <= f.opts.manaAmountMinFaucet { + f.logSoftError(ierrors.Errorf("not enough mana left in the faucet: %d < %d", unboundStoredManaRemainder, f.opts.manaAmountMinFaucet)) + // not enough mana left in the faucet return 0 }