mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
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
24 lines
499 B
Go
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)
|
|
}
|
|
}
|
|
|