From 3801e37775fdd26921cb89151e90938714bc3c16 Mon Sep 17 00:00:00 2001 From: xinran chen Date: Fri, 17 Apr 2026 17:02:39 +0800 Subject: [PATCH] poa.singleNodeCfg --- apps/poa/config.go | 17 +++++++++++++++++ apps/poa/tests/single_node_test.go | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/poa/config.go b/apps/poa/config.go index c86ff511..2673bd93 100644 --- a/apps/poa/config.go +++ b/apps/poa/config.go @@ -61,6 +61,23 @@ func DefaultCfg(idx int) *PoaConfig { return cfg } +func SingleNodeCfg() *PoaConfig { + secret := DefaultSecrets[0] + pub, _ := GenSrKeyWithSecret([]byte(secret)) + logrus.Infof("pub0 is %s", pub.String()) + logrus.Info("My Address is ", pub.Address().String()) + return &PoaConfig{ + KeyType: Sr25519, + MySecret: secret, + Validators: []*ValidatorConf{ + {Pubkey: pub.StringWithType(), P2pIp: "12D3KooWHHzSeKaY8xuZVzkLbKFfvNgPPeKhFBGrMbNzbm5akpqu"}, + }, + BlockInterval: 3000, + PackNum: 30000, + PrettyLog: true, + } +} + type ValidatorConf struct { Pubkey string `toml:"pubkey"` P2pIp string `toml:"p2p_ip"` diff --git a/apps/poa/tests/single_node_test.go b/apps/poa/tests/single_node_test.go index accfec8c..f32296e9 100644 --- a/apps/poa/tests/single_node_test.go +++ b/apps/poa/tests/single_node_test.go @@ -27,7 +27,7 @@ func TestPoa(t *testing.T) { } func runChain(wg *sync.WaitGroup) { - poaCfg := poa.DefaultCfg(0) + poaCfg := poa.SingleNodeCfg() //poaCfg.BlockInterval = 2 yuCfg := startup.InitDefaultKernelConfig() yuCfg.MaxBlockNum = 10