2026-02-21 01:04:59 +00:00
|
|
|
//go:build !integration
|
|
|
|
|
|
|
|
|
|
package consensus
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"forge.lthn.ai/core/go-blockchain/config"
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestVerifyTransactionSignatures_Good_Coinbase(t *testing.T) {
|
|
|
|
|
// Coinbase transactions have no signatures to verify.
|
|
|
|
|
tx := validMinerTx(100)
|
2026-02-22 00:06:10 +00:00
|
|
|
err := VerifyTransactionSignatures(tx, config.MainnetForks, 100, nil, nil)
|
2026-02-21 01:04:59 +00:00
|
|
|
require.NoError(t, err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestVerifyTransactionSignatures_Bad_MissingSigs(t *testing.T) {
|
|
|
|
|
tx := validV1Tx()
|
|
|
|
|
tx.Signatures = nil // no signatures
|
2026-02-22 00:06:10 +00:00
|
|
|
err := VerifyTransactionSignatures(tx, config.MainnetForks, 100, nil, nil)
|
2026-02-21 01:04:59 +00:00
|
|
|
assert.Error(t, err)
|
|
|
|
|
}
|