go-ethereum/consensus/hybrid-consensus/consensus_test.go
oxwa 5b14eb3f28 Changes to be committed:
new file:   cmd/geth/consensus/hybrid.go
	new file:   cmd/geth/core/blockchain.go
	modified:   cmd/geth/main.go
	new file:   cmd/geth/tests/hybrid_test.go
	new file:   consensus/hybrid-consensus/consensus.go
	new file:   consensus/hybrid-consensus/consensus_test.go
	new file:   consensus/hybrid-consensus/go.mod
	new file:   consensus/hybrid-consensus/hybridconsensus.go
	new file:   consensus/hybrid-consensus/metrics.go
	new file:   consensus/hybrid-consensus/validators.go
2024-10-06 16:33:49 +03:00

24 lines
499 B
Go

package hybridconsensus
import (
"testing"
)
func TestCreateBlock(t *testing.T) {
validators := []Validator{
{Address: "0xValidator1", Stake: 100},
{Address: "0xValidator2", Stake: 200},
}
hc := NewHybridConsensus(validators)
block, err := hc.CreateBlock("0xValidator1")
if err != nil {
t.Errorf("expected no error, got %v", err)
}
if block.Number != 1 {
t.Errorf("expected block number 1, got %d", block.Number)
}
}