Commit 28d2b57d authored by David Vorick's avatar David Vorick

add constants to siac

also remove some constants that are no longer uesd from consensus api
parent 421df894
Pipeline #40816015 failed with stages
in 2 minutes and 42 seconds
......@@ -17,6 +17,8 @@ var (
Long: "Print the current state of consensus such as current block, block height, and target.",
Run: wrap(consensuscmd),
}
consensusCmdVerbose bool
)
// consensuscmd is the handler for the command `siac consensus`.
......@@ -44,6 +46,13 @@ Height: %v
Progress (estimated): %.1f%%
`, yesNo(cg.Synced), cg.Height, estimatedProgress)
}
if consensusCmdVerbose {
fmt.Println()
fmt.Println("Block Frequency:", cg.BlockFrequency)
fmt.Println("Block Size Limit:", cg.BlockSizeLimit)
fmt.Println("Maturity Delay:", cg.MaturityDelay)
fmt.Println("Genesis Timestamp:", time.Unix(int64(cg.GenesisTimestamp), 0))
}
}
// estimatedHeightAt returns the estimated block height for the given time.
......
......@@ -161,6 +161,7 @@ func main() {
gatewayCmd.AddCommand(gatewayConnectCmd, gatewayDisconnectCmd, gatewayAddressCmd, gatewayListCmd)
root.AddCommand(consensusCmd)
consensusCmd.Flags().BoolVarP(&consensusCmdVerbose, "verbose", "v", false, "Display full consensus information")
utilsCmd.AddCommand(bashcomplCmd, mangenCmd, utilsHastingsCmd, utilsEncodeRawTxnCmd, utilsDecodeRawTxnCmd,
utilsSigHashCmd, utilsCheckSigCmd, utilsVerifySeedCmd)
......
......@@ -126,7 +126,6 @@ Also returns the set of constants in use in the consensus code.
"mediantimestampwindow": 11, // blocks
"siafundcount": "10000", // siafund
"siafundportion": "39/1000", // fraction
"targetwindow": 1000, // blocks
"initialcoinbase": 300000, // Siacoins (see note in Daemon.md)
"minimumcoinbase": 30000, // Siacoins (see note in Daemon.md)
......@@ -134,9 +133,6 @@ Also returns the set of constants in use in the consensus code.
"roottarget": [0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], // hash
"rootdepth": [255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255], // hash
"maxtargetadjustmentup": "5/2", // fraction
"maxtargetadjustmentdown": "2/5", // fraction
"siacoinprecision": "1000000000000000000000000" // hastings per siacoin
}
```
......@@ -182,9 +178,6 @@ Total number of siafunds.
**siafundportion** | fraction
Fraction of each file contract payout given to siafund holders.
**targetwindow** | number of blocks
Height of the window used to adjust the difficulty.
**initialcoinbase** | siacoin
Number of coins given to the miner of the first block. Note that elsewhere in the API currency is typically returned in hastings and as a bignum. This is not the case here.
......@@ -197,12 +190,6 @@ Initial target.
**rootdepth** | hash
Initial depth.
**maxtargetadjustmentup** | fraction
Largest allowed ratio between the old difficulty and the new difficulty.
**maxtargetadjustmentdown** | fraction
Smallest allowed ratio between the old difficulty and the new difficulty.
**siacoinprecision** | hastings per siacoin
Number of Hastings in one Siacoin.
......
......@@ -32,7 +32,6 @@ type ConsensusGET struct {
MedianTimestampWindow uint64 `json:"mediantimestampwindow"`
SiafundCount types.Currency `json:"siafundcount"`
SiafundPortion *big.Rat `json:"siafundportion"`
TargetWindow types.BlockHeight `json:"targetwindow"`
InitialCoinbase uint64 `json:"initialcoinbase"`
MinimumCoinbase uint64 `json:"minimumcoinbase"`
......@@ -40,9 +39,6 @@ type ConsensusGET struct {
RootTarget types.Target `json:"roottarget"`
RootDepth types.Target `json:"rootdepth"`
MaxTargetAdjustmentUp *big.Rat `json:"maxtargetadjustmentup"`
MaxTargetAdjustmentDown *big.Rat `json:"maxtargetadjustmentdown"`
SiacoinPrecision types.Currency `json:"siacoinprecision"`
}
......@@ -213,7 +209,6 @@ func (api *API) consensusHandler(w http.ResponseWriter, req *http.Request, _ htt
MedianTimestampWindow: types.MedianTimestampWindow,
SiafundCount: types.SiafundCount,
SiafundPortion: types.SiafundPortion,
TargetWindow: types.TargetWindow,
InitialCoinbase: types.InitialCoinbase,
MinimumCoinbase: types.MinimumCoinbase,
......@@ -221,9 +216,6 @@ func (api *API) consensusHandler(w http.ResponseWriter, req *http.Request, _ htt
RootTarget: types.RootTarget,
RootDepth: types.RootDepth,
MaxTargetAdjustmentUp: types.MaxTargetAdjustmentUp,
MaxTargetAdjustmentDown: types.MaxTargetAdjustmentDown,
SiacoinPrecision: types.SiacoinPrecision,
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment