diff --git a/chain/ring.go b/chain/ring.go index acee086..06645b0 100644 --- a/chain/ring.go +++ b/chain/ring.go @@ -38,7 +38,7 @@ func (c *Chain) GetRingOutputs(amount uint64, offsets []uint64) ([]types.PublicK case types.TxOutputBare: toKey, ok := out.Target.(types.TxOutToKey) if !ok { - return nil, fmt.Errorf("ring output %d: unsupported target type %T", i, out.Target) + return nil, coreerr.E("Chain.GetRingOutputs", fmt.Sprintf("ring output %d: unsupported target type %T", i, out.Target), nil) } pubs[i] = toKey.Key default: diff --git a/consensus/block.go b/consensus/block.go index 5345b6f..dfaf16b 100644 --- a/consensus/block.go +++ b/consensus/block.go @@ -152,8 +152,8 @@ func expectedBlockMajorVersion(forks []config.HardFork, height uint64) uint8 { func checkBlockVersion(blk *types.Block, forks []config.HardFork, height uint64) error { expected := expectedBlockMajorVersion(forks, height) if blk.MajorVersion != expected { - return fmt.Errorf("%w: got %d, want %d at height %d", - ErrBlockMajorVersion, blk.MajorVersion, expected, height) + return coreerr.E("checkBlockVersion", fmt.Sprintf("got %d, want %d at height %d", + blk.MajorVersion, expected, height), ErrBlockMajorVersion) } return nil } @@ -226,7 +226,7 @@ func IsPreHardforkFreeze(forks []config.HardFork, version uint8, height uint64) func ValidateTransactionInBlock(tx *types.Transaction, txBlob []byte, forks []config.HardFork, height uint64) error { // Pre-hardfork freeze: reject non-coinbase transactions in the freeze window. if !isCoinbase(tx) && IsPreHardforkFreeze(forks, config.HF5, height) { - return fmt.Errorf("%w: height %d is within HF5 freeze window", ErrPreHardforkFreeze, height) + return coreerr.E("ValidateTransactionInBlock", fmt.Sprintf("height %d is within HF5 freeze window", height), ErrPreHardforkFreeze) } return ValidateTransaction(tx, txBlob, forks, height)