Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion consensus/cuckoo/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,10 @@ func CalcDifficulty(config *params.ChainConfig, time uint64, parent *types.Heade
// important add gas limit to consensus
func checkGasLimit(gasUsed, gasLimit, currentGasLimit uint64) bool {
contrib := (gasUsed + gasUsed/2) / params.GasLimitBoundDivisor

decay := gasLimit/params.GasLimitBoundDivisor - 1
limit := gasLimit - decay + contrib

limit := gasLimit - decay + contrib
if limit < params.MinGasLimit {
limit = params.MinGasLimit
}
Expand All @@ -390,6 +391,7 @@ func checkGasLimit(gasUsed, gasLimit, currentGasLimit uint64) bool {
}
}

// TODO
return limit == currentGasLimit
}

Expand Down
22 changes: 22 additions & 0 deletions consensus/cuckoo/consensus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,25 @@ func randSlice(min, max uint32) []byte {
rand.Read(out)
return out
}

func TestGasLimitCheck(t *testing.T) {
if validate := checkGasLimit(0, 7992189, 8000000); !validate {
t.Fatalf("failed")
}

if validate := checkGasLimit(7992189, 7992189, 8000000); !validate {
t.Fatalf("failed")
}

if validate := checkGasLimit(0, 8000000, 7992189); validate {
t.Fatalf("failed")
}

if validate := checkGasLimit(7980000, 8000000, 8003878); !validate {
t.Fatalf("failed")
}

if validate := checkGasLimit(7980000, 8000000, 8003879); validate {
t.Fatalf("failed")
}
}
3 changes: 3 additions & 0 deletions core/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD
// ceil if the blocks are full. If the ceil is exceeded, it will always decrease
// the gas allowance.
func CalcGasLimit(parent *types.Block, gasFloor, gasCeil uint64) uint64 {
if gasFloor > gasCeil {
gasCeil = gasFloor
}
// contrib = (parentGasUsed * 3 / 2) / 1024
contrib := (parent.GasUsed() + parent.GasUsed()/2) / params.GasLimitBoundDivisor

Expand Down
9 changes: 2 additions & 7 deletions ctxc/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package ctxc

import (
"math/big"
//"math/big"
"os"
"os/user"
"time"
Expand Down Expand Up @@ -58,12 +58,7 @@ var DefaultConfig = Config{
TrieDirtyCache: 256,
TrieTimeout: 60 * time.Minute,
SnapshotCache: 102,
Miner: miner.Config{
GasFloor: params.MinerGasFloor,
GasCeil: params.MinerGasCeil,
GasPrice: big.NewInt(params.GWei),
Recommit: 3 * time.Second,
},
Miner: miner.DefaultConfig,

TxPool: txpool.DefaultConfig,
RPCGasCap: 50000000,
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.4.1
github.com/CortexFoundation/inference v1.0.2-0.20230307032835-9197d586a4e8
github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66
github.com/CortexFoundation/torrentfs v1.0.53-0.20230806110219-c5c9d8198923
github.com/CortexFoundation/torrentfs v1.0.53-0.20230808072508-61b90f87fb76
github.com/VictoriaMetrics/fastcache v1.12.1
github.com/arsham/figurine v1.3.0
github.com/aws/aws-sdk-go-v2 v1.19.0
Expand All @@ -17,7 +17,7 @@ require (
github.com/cespare/cp v1.1.1
github.com/charmbracelet/bubbletea v0.24.2
github.com/cloudflare/cloudflare-go v0.57.1
github.com/cockroachdb/pebble v0.0.0-20230804232740-ff9402f082b3
github.com/cockroachdb/pebble v0.0.0-20230807203122-df7e2ae16dbf
github.com/consensys/gnark-crypto v0.11.1
github.com/crate-crypto/go-kzg-4844 v0.3.0
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
Expand Down Expand Up @@ -83,7 +83,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/CortexFoundation/cvm-runtime v0.0.0-20221117094012-b5a251885572 // indirect
github.com/CortexFoundation/merkletree v0.0.0-20230724124840-b6e80265a137 // indirect
github.com/CortexFoundation/robot v1.0.5-0.20230806100035-808e561fa5d4 // indirect
github.com/CortexFoundation/robot v1.0.5-0.20230808071438-03ca58fc974a // indirect
github.com/DataDog/zstd v1.5.6-0.20230622172052-ea68dcab66c0 // indirect
github.com/RoaringBitmap/roaring v1.3.0 // indirect
github.com/ajwerner/btree v0.0.0-20211221152037-f427b3e689c0 // indirect
Expand Down Expand Up @@ -137,7 +137,7 @@ require (
github.com/crate-crypto/go-ipa v0.0.0-20230710183535-d5eb1c4661bd // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/deepmap/oapi-codegen v1.13.0 // indirect
github.com/dgraph-io/badger/v4 v4.2.0 // indirect
github.com/dgraph-io/badger/v4 v4.2.1-0.20230808010956-340ba1ae4c03 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dlclark/regexp2 v1.10.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand Down Expand Up @@ -168,7 +168,7 @@ require (
github.com/google/pprof v0.0.0-20230705174524-200ffdc848b8 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.5-0.20230705200825-f4cd393e7b29 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.5-0.20230807184434-3b3d2595eca1 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf // indirect
github.com/jedib0t/go-pretty/v6 v6.4.6 // indirect
Expand All @@ -192,7 +192,7 @@ require (
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/naoina/go-stringutil v0.1.0 // indirect
github.com/nutsdb/nutsdb v0.13.1-0.20230803123437-a81dd1afaf2f // indirect
github.com/nutsdb/nutsdb v0.13.1-0.20230808025958-28b0deedbd97 // indirect
github.com/onsi/gomega v1.20.0 // indirect
github.com/otiai10/copy v1.12.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.9 // indirect
Expand Down Expand Up @@ -236,7 +236,7 @@ require (
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd // indirect
github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb // indirect
github.com/ucwong/golang-kv v1.0.23-0.20230806100313-8093edf686fb // indirect
github.com/ucwong/golang-kv v1.0.23-0.20230808071813-15ccff947f41 // indirect
github.com/ucwong/shard v1.0.1-0.20230505153952-911e99b5f0c2 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
Expand Down
30 changes: 14 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ github.com/CortexFoundation/inference v1.0.2-0.20230307032835-9197d586a4e8 h1:W/
github.com/CortexFoundation/inference v1.0.2-0.20230307032835-9197d586a4e8/go.mod h1:Doj3mBNzdjCDvKVwysKaHEPbS20A7RRaQY0bHtEVz88=
github.com/CortexFoundation/merkletree v0.0.0-20230724124840-b6e80265a137 h1:GdrLwJRKPrUSd4V/cBpPyzhNQEo8IDT7Le15hmuC+/4=
github.com/CortexFoundation/merkletree v0.0.0-20230724124840-b6e80265a137/go.mod h1:OwfhC316GcEJ9QVNWPqj6QV7sorcXBnc0P9p8dPfSbM=
github.com/CortexFoundation/robot v1.0.5-0.20230806100035-808e561fa5d4 h1:V2Ec7pCgn/yxQLPI4aBkLGEbvIs2SFqr1A4d9OhIHmA=
github.com/CortexFoundation/robot v1.0.5-0.20230806100035-808e561fa5d4/go.mod h1:yOoFScl+eKxCkDZATeByDQEyEi6pqRkQeYm2kmqZAyQ=
github.com/CortexFoundation/robot v1.0.5-0.20230808071438-03ca58fc974a h1:ttJOLUPMAhW+HTKXaFfcOb4bzcnwgc2aYgo3zwY77EM=
github.com/CortexFoundation/robot v1.0.5-0.20230808071438-03ca58fc974a/go.mod h1:WVW7rG7HAlvAb85lrzDimTG4mbwGx4TKWFW9ONM5FKc=
github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66 h1:yJbN4DFvpStCShXOVxNV64aawsPqizLuXZhrnhCr2fY=
github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66/go.mod h1:AkjV4OECAskB9m6w+2e84F0Zcx7oZWEmHB3EKoaDXYk=
github.com/CortexFoundation/torrentfs v1.0.13-0.20200623060705-ce027f43f2f8/go.mod h1:Ma+tGhPPvz4CEZHaqEJQMOEGOfHeQBiAoNd1zyc/w3Q=
github.com/CortexFoundation/torrentfs v1.0.14-0.20200703071639-3fcabcabf274/go.mod h1:qnb3YlIJmuetVBtC6Lsejr0Xru+1DNmDCdTqnwy7lhk=
github.com/CortexFoundation/torrentfs v1.0.20-0.20200810031954-d36d26f82fcc/go.mod h1:N5BsicP5ynjXIi/Npl/SRzlJ630n1PJV2sRj0Z0t2HA=
github.com/CortexFoundation/torrentfs v1.0.53-0.20230806110219-c5c9d8198923 h1:fLOXuNxife/mfAPvUQPkkMchIA0lPrcfqpwl8o6mH+0=
github.com/CortexFoundation/torrentfs v1.0.53-0.20230806110219-c5c9d8198923/go.mod h1:W4VLSpmfeGZXdBQbjso4UNJJZX92A8m3VnAH+Q0kHZw=
github.com/CortexFoundation/torrentfs v1.0.53-0.20230808072508-61b90f87fb76 h1:0y0CrWtef8q2SlJy4WGIi7FISpl3ZzSSyXJK7mDVdeQ=
github.com/CortexFoundation/torrentfs v1.0.53-0.20230808072508-61b90f87fb76/go.mod h1:EdXA6CqyWkRQys7UKCJnQTGL+7+Vt51LNhdGWs9aP5c=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/DataDog/zstd v1.5.6-0.20230622172052-ea68dcab66c0 h1:ye3LRgDs6Og7SKC1wBQH8oMaGczhCRpPpnU74l4rma8=
github.com/DataDog/zstd v1.5.6-0.20230622172052-ea68dcab66c0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
Expand Down Expand Up @@ -322,7 +322,6 @@ github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU=
github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/charmbracelet/bubbletea v0.24.2 h1:uaQIKx9Ai6Gdh5zpTbGiWpytMU+CfsPp06RaW2cx/SY=
Expand Down Expand Up @@ -352,8 +351,8 @@ github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+
github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE=
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE=
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
github.com/cockroachdb/pebble v0.0.0-20230804232740-ff9402f082b3 h1:ocKiAqfi9eteS8zGMN6D8YSLXq30WZXdBtCD5l1hC64=
github.com/cockroachdb/pebble v0.0.0-20230804232740-ff9402f082b3/go.mod h1:FN5O47SBEz5+kO9fG8UTR64g2WS1u5ZFCgTvxGjoSks=
github.com/cockroachdb/pebble v0.0.0-20230807203122-df7e2ae16dbf h1:HjEj5zz0dXWts0znljJkBVE26dxwdoSqZrSJHFp9eJE=
github.com/cockroachdb/pebble v0.0.0-20230807203122-df7e2ae16dbf/go.mod h1:FN5O47SBEz5+kO9fG8UTR64g2WS1u5ZFCgTvxGjoSks=
github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30=
github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/cockroachdb/tokenbucket v0.0.0-20230613231145-182959a1fad6 h1:DJK8W/iB+s/qkTtmXSrHA49lp5O3OsR7E6z4byOLy34=
Expand Down Expand Up @@ -400,8 +399,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etly
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
github.com/deepmap/oapi-codegen v1.13.0 h1:cnFHelhsRQbYvanCUAbRSn/ZpkUb1HPRlQcu8YqSORQ=
github.com/deepmap/oapi-codegen v1.13.0/go.mod h1:Amy7tbubKY9qkZOXqymI3Z6xSbndmu+atMJheLdyg44=
github.com/dgraph-io/badger/v4 v4.2.0 h1:kJrlajbXXL9DFTNuhhu9yCx7JJa4qpYWxtE8BzuWsEs=
github.com/dgraph-io/badger/v4 v4.2.0/go.mod h1:qfCqhPoWDFJRx1gp5QwwyGo8xk1lbHUxvK9nK0OGAak=
github.com/dgraph-io/badger/v4 v4.2.1-0.20230808010956-340ba1ae4c03 h1:Cly/ijkVwsus9M55uex7BguxcJIXSX4Bvj6uWKU8P1s=
github.com/dgraph-io/badger/v4 v4.2.1-0.20230808010956-340ba1ae4c03/go.mod h1:qfCqhPoWDFJRx1gp5QwwyGo8xk1lbHUxvK9nK0OGAak=
github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8=
github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
Expand Down Expand Up @@ -687,8 +686,8 @@ github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uG
github.com/hashicorp/golang-lru v0.5.5-0.20200511160909-eb529947af53/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/golang-lru v0.5.5-0.20221011183528-d4900dc688bf h1:BQyif+/dqmbIGXyGhe5bDx/3grIchislVu5pK7j/bMQ=
github.com/hashicorp/golang-lru v0.5.5-0.20221011183528-d4900dc688bf/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/golang-lru/v2 v2.0.5-0.20230705200825-f4cd393e7b29 h1:ms53+xNey/RHASahOxI1AdzSm5snVNH8xQGTDc1xV2I=
github.com/hashicorp/golang-lru/v2 v2.0.5-0.20230705200825-f4cd393e7b29/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hashicorp/golang-lru/v2 v2.0.5-0.20230807184434-3b3d2595eca1 h1:awbgNfdB9Xns0QO/Oe8ZSmHGMs7JKoVBDA/v5T0O6IQ=
github.com/hashicorp/golang-lru/v2 v2.0.5-0.20230807184434-3b3d2595eca1/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
Expand Down Expand Up @@ -914,8 +913,8 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
github.com/nutsdb/nutsdb v0.13.1-0.20230803123437-a81dd1afaf2f h1:JXpZoe3mI+GwTJbHWb3embSwdg1XsNCAPuSN7T2qilA=
github.com/nutsdb/nutsdb v0.13.1-0.20230803123437-a81dd1afaf2f/go.mod h1:hCBX9MfA231rIikxDRIhGb5UKWa189v56aCP7mrXOxQ=
github.com/nutsdb/nutsdb v0.13.1-0.20230808025958-28b0deedbd97 h1:S0uUbm1aQuBJPpmvd70BSWHKI6imqeBY/33zescykt8=
github.com/nutsdb/nutsdb v0.13.1-0.20230808025958-28b0deedbd97/go.mod h1:5ZRl/i3/tXmanXW1pY/LSnS1jp+WbOKGH0A+tx0VNN0=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down Expand Up @@ -1262,8 +1261,8 @@ github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd h1:gBtlvLAsgLk+
github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd/go.mod h1:ddwX+NCjMZPdpzcGh1fcEbNTUTCtKgt2hC2rqvmLKgA=
github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb h1:dVZH3AH9f7zB3VBmsjn25B7lfcAyMP4QxdFYTrfj7tg=
github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb/go.mod h1:3yswsBsVuwsOjDvFfC5Na9XSEf4HC7mj3W3g6jvSY/s=
github.com/ucwong/golang-kv v1.0.23-0.20230806100313-8093edf686fb h1:xVLhHXeuM/QotlyLzZu3W0TnoG7TXWc32VWb+9OElhw=
github.com/ucwong/golang-kv v1.0.23-0.20230806100313-8093edf686fb/go.mod h1:t5qCXavwvPy45u7Uqd8f8dlYsxlwKrNok1ivUGk0lMI=
github.com/ucwong/golang-kv v1.0.23-0.20230808071813-15ccff947f41 h1:7hYtYh5t9cKeVvzOyhmg4EswFXH3lbTkS6uF0l36iT0=
github.com/ucwong/golang-kv v1.0.23-0.20230808071813-15ccff947f41/go.mod h1:XnN2YifqfXec0HHM+Uoor8lFp23Thj9I/jjWbbrxHuw=
github.com/ucwong/golang-set v1.8.1-0.20200419153428-d7b0b1ac2d43/go.mod h1:xu0FaiQFGbBcFZj2o7udZ5rbA8jRTsv47hkPoG5qQNM=
github.com/ucwong/goleveldb v1.0.3-0.20200508074755-578cba616f37/go.mod h1:dgJUTtDxq/ne6/JzZhHzF24OL/uqILz9IWk8HmT4V2g=
github.com/ucwong/goleveldb v1.0.3-0.20200618184106-f1c6bc3a428b/go.mod h1:7Sq6w7AfEZuB/a6mrlvHCSXCSkqojCMMrM3Ei12QAT0=
Expand Down Expand Up @@ -1304,7 +1303,6 @@ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRT
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/xtaci/kcp-go v5.4.20+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE=
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae/go.mod h1:gXtu8J62kEgmN++bm9BVICuT/e8yiLI2KFobd/TRFsE=
github.com/xujiajun/gorouter v1.2.0/go.mod h1:yJrIta+bTNpBM/2UT8hLOaEAFckO+m/qmR3luMIQygM=
github.com/xujiajun/mmap-go v1.0.1 h1:7Se7ss1fLPPRW+ePgqGpCkfGIZzJV6JPq9Wq9iv/WHc=
github.com/xujiajun/mmap-go v1.0.1/go.mod h1:CNN6Sw4SL69Sui00p0zEzcZKbt+5HtEnYUsc6BKKRMg=
github.com/xujiajun/utils v0.0.0-20220904132955-5f7c5b914235 h1:w0si+uee0iAaCJO9q86T6yrhdadgcsoNuh47LrUykzg=
Expand Down
7 changes: 7 additions & 0 deletions miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ type Config struct {
Devices string
}

var DefaultConfig = Config{
GasFloor: params.MinerGasFloor,
GasCeil: params.MinerGasCeil,
GasPrice: big.NewInt(params.GWei),
Recommit: 3 * time.Second,
}

// Miner creates blocks and searches for proof-of-work values.
type Miner struct {
mux *event.TypeMux
Expand Down
6 changes: 4 additions & 2 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ func (w *worker) setCoinbase(addr common.Address) {
func (w *worker) setGasCeil(ceil uint64) {
w.mu.Lock()
defer w.mu.Unlock()
w.config.GasCeil = ceil
if ceil > w.config.GasFloor {
w.config.GasCeil = ceil
}
}

// setExtra sets the content used to initialize the block extra field.
Expand Down Expand Up @@ -1041,7 +1043,7 @@ func (w *worker) commit(uncles []*types.Header, interval func(), update bool, st
w.unconfirmed.Shift(block.NumberU64() - 1)
log.Info("Commit new mining work", "number", block.Number(), "sealhash", w.engine.SealHash(block.Header()),
"uncles", len(uncles), "txs", w.current.tcount,
"gas", block.GasUsed(), "fees", totalFees(block, receipts),
"gas", block.GasUsed(), "limit", block.GasLimit(), "fees", totalFees(block, receipts),
"elapsed", common.PrettyDuration(time.Since(start)), "diff", block.Difficulty())

case <-w.exitCh:
Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/CortexFoundation/torrentfs/fs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading