Commit 60801199 authored by Son of Odin's avatar Son of Odin 💬

Merge branch '380-issue' into 'master'

[bugfix] don't return a point for keysign func

Closes #380

See merge request !696
parents 6cdb730a 507e90ce
Pipeline #130229055 passed with stages
in 63 minutes and 36 seconds
......@@ -105,15 +105,14 @@ func (b *ThorchainBlockScan) processTxOutBlock(blockHeight int64) error {
}
tx, err := b.thorchain.GetKeysign(blockHeight, pk.String())
if err != nil {
if errors.Is(err, thorclient.ErrNotFound) {
// custom error (to be dropped and not logged) because the block is
// available yet
return errors.New("")
}
return errors.Wrap(err, "fail to get keysign from block scanner")
}
// custom error (to be dropped and not logged) because the block is
// available yet
if tx == nil {
return errors.New("")
}
for c, out := range tx.Chains {
b.logger.Debug().Str("chain", c.String()).Msg("chain")
if len(out.TxArray) == 0 {
......
......@@ -11,21 +11,23 @@ import (
"gitlab.com/thorchain/thornode/bifrost/thorclient/types"
)
var ErrNotFound error = fmt.Errorf("not found")
// GetKeysign retrieves txout from this block height from thorchain
func (b *ThorchainBridge) GetKeysign(blockHeight int64, pk string) (*types.ChainsTxOut, error) {
func (b *ThorchainBridge) GetKeysign(blockHeight int64, pk string) (types.ChainsTxOut, error) {
url := fmt.Sprintf("%s/%d/%s", KeysignEndpoint, blockHeight, pk)
body, status, err := b.get(url)
if err != nil {
b.errCounter.WithLabelValues("fail_get_tx_out", strconv.FormatInt(blockHeight, 10)).Inc()
if status == http.StatusNotFound {
return nil, nil
return types.ChainsTxOut{}, ErrNotFound
}
return &types.ChainsTxOut{}, errors.Wrap(err, "failed to get tx from a block height")
return types.ChainsTxOut{}, errors.Wrap(err, "failed to get tx from a block height")
}
var txOut types.ChainsTxOut
if err := json.Unmarshal(body, &txOut); err != nil {
b.errCounter.WithLabelValues("fail_unmarshal_tx_out", strconv.FormatInt(blockHeight, 10)).Inc()
return &types.ChainsTxOut{}, errors.Wrap(err, "failed to unmarshal TxOut")
return types.ChainsTxOut{}, errors.Wrap(err, "failed to unmarshal TxOut")
}
return &txOut, nil
return txOut, nil
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment