mirror of
https://github.com/luxfi/netrunner.git
synced 2026-10-30 15:24:46 +00:00
Major changes: - Rename SubnetSpec → ChainSpec/ParticipantSpec throughout codebase - Rename BlockchainSpec → ChainSpec for full chain definitions - Update all protobuf definitions with new naming - Fix duplicate variable declarations from sed replacements - Update copyright headers to BSD-3-Clause with SPDX identifiers - Update github.com/luxfi/genesis to v1.5.6 (BLS signer keys) The genesis v1.5.6 update adds: - Initial stakers with BLS publicKey and proofOfPossession - Initial allocations for local network testing - Fixes "failed to load database state: not found" error Build fixes: - Fix api/mocks/client.go CChainAPI return type - Fix local/node_test.go with build tag for integration tests - Fix parameter name collisions (chainConfigs → pChainConfigs)
29 lines
606 B
Go
29 lines
606 B
Go
// Copyright (C) 2021-2025, Lux Industries Inc. All rights reserved.
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package utils
|
|
|
|
import "encoding/json"
|
|
|
|
// Set k=v in JSON string
|
|
// e.g., "track-chains" is the key and value is "a,b,c".
|
|
func SetJSONKey(jsonBody string, k string, v string) (string, error) {
|
|
var config map[string]interface{}
|
|
|
|
if err := json.Unmarshal([]byte(jsonBody), &config); err != nil {
|
|
return "", err
|
|
}
|
|
|
|
if v == "" {
|
|
delete(config, k)
|
|
} else {
|
|
config[k] = v
|
|
}
|
|
|
|
updatedJSON, err := json.Marshal(config)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return string(updatedJSON), nil
|
|
}
|