Skip to content

Commit 8b061de

Browse files
committed
fix(cmd): reject storage incentives in light and ultra-light modes
1 parent ebc5f4a commit 8b061de

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

cmd/bee/cmd/resolve_node_mode_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ func TestResolveNodeMode(t *testing.T) {
9292
},
9393
wantErr: "light node requires blockchain-rpc-endpoint",
9494
},
95+
{
96+
name: "light mode rejects storage-incentives-enable",
97+
config: map[string]any{
98+
optionNameNodeMode: "light",
99+
configKeyBlockchainRpcEndpoint: "http://localhost:8545",
100+
optionNameStorageIncentivesEnable: true,
101+
},
102+
wantErr: "light node cannot have storage-incentives-enable",
103+
},
95104
{
96105
name: "ultra-light mode succeeds",
97106
config: map[string]any{
@@ -107,6 +116,14 @@ func TestResolveNodeMode(t *testing.T) {
107116
},
108117
wantErr: "ultra-light node cannot have swap-enable",
109118
},
119+
{
120+
name: "ultra-light mode rejects storage-incentives-enable",
121+
config: map[string]any{
122+
optionNameNodeMode: "ultra-light",
123+
optionNameStorageIncentivesEnable: true,
124+
},
125+
wantErr: "ultra-light node cannot have storage-incentives-enable",
126+
},
110127
{
111128
name: "invalid node-mode value fails",
112129
config: map[string]any{

cmd/bee/cmd/start.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,16 @@ func (c *command) resolveNodeMode(logger log.Logger) (node.NodeMode, error) {
451451
if rpcEndpoint == "" {
452452
return "", errors.New("light node requires blockchain-rpc-endpoint to be set")
453453
}
454+
if incentivesEnable {
455+
return "", errors.New("light node cannot have storage-incentives-enable set to true")
456+
}
454457
case node.UltraLightMode:
455458
if swapEnable {
456459
return "", errors.New("ultra-light node cannot have swap-enable set to true")
457460
}
461+
if incentivesEnable {
462+
return "", errors.New("ultra-light node cannot have storage-incentives-enable set to true")
463+
}
458464
}
459465
return mode, nil
460466
}

0 commit comments

Comments
 (0)