mirror of
https://github.com/luxfi/node.git
synced 2026-10-30 15:24:05 +00:00
38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package builder
|
|
|
|
import (
|
|
"github.com/luxfi/constants"
|
|
"github.com/luxfi/ids"
|
|
"github.com/luxfi/node/vms/components/gas"
|
|
"github.com/luxfi/node/vms/platformvm/txs/fee"
|
|
"github.com/luxfi/runtime"
|
|
)
|
|
|
|
const Alias = "P"
|
|
|
|
type Context struct {
|
|
NetworkID uint32
|
|
ChainID ids.ID // Optional: if set, overrides default PlatformChainID
|
|
UTXOAssetID ids.ID
|
|
ComplexityWeights gas.Dimensions
|
|
GasPrice gas.Price
|
|
StaticFeeConfig fee.StaticConfig
|
|
}
|
|
|
|
func NewConsensusRuntime(networkID uint32, utxoAssetID ids.ID) (*runtime.Runtime, error) {
|
|
return NewConsensusRuntimeWithChainID(networkID, constants.PlatformChainID, utxoAssetID)
|
|
}
|
|
|
|
func NewConsensusRuntimeWithChainID(networkID uint32, chainID ids.ID, utxoAssetID ids.ID) (*runtime.Runtime, error) {
|
|
lookup := ids.NewAliaser()
|
|
rt := &runtime.Runtime{
|
|
NetworkID: networkID,
|
|
ChainID: chainID,
|
|
UTXOAssetID: utxoAssetID,
|
|
}
|
|
return rt, lookup.Alias(chainID, Alias)
|
|
}
|