aboutsummaryrefslogtreecommitdiffstats
path: root/core/blockchain.go
Commit message (Collapse)AuthorAgeFilesLines
* core: fix some small typos on comment code (#17278)Ha ĐANG2018-07-301-1/+1
|
* core: report progress on log chain exports (#17066)Raghav Sood2018-07-261-3/+7
| | | | | | * core/blockchain: export progress * core: polish up chain export progress report a bit
* ethdb, core: implement delete for db batch (#17101)gary rong2018-07-021-3/+6
|
* trie: cache collapsed tries node, not rlp blobs (#16876)Péter Szilágyi2018-06-211-2/+2
| | | | | | | | | | | | The current trie memory database/cache that we do pruning on stores trie nodes as binary rlp encoded blobs, and also stores the node relationships/references for GC purposes. However, most of the trie nodes (everything apart from a value node) is in essence just a collection of references. This PR switches out the RLP encoded trie blobs with the collapsed-but-not-serialized trie nodes. This permits most of the references to be recovered from within the node data structure, avoiding the need to track them a second time (expensive memory wise).
* core, eth, les: more efficient hash-based header chain retrieval (#16946)Felföldi Zsolt2018-06-121-0/+12
|
* core: improve getBadBlocks to return full block rlp (#16902)Martin Holst Swende2018-06-111-13/+7
| | | | | | | | * core: improve getBadBlocks to return full block rlp * core, eth, ethapi: changes to getBadBlocks formatting * ethapi: address review concerns
* core: concurrent background transaction sender ecrecoverPéter Szilágyi2018-06-051-0/+7
|
* core, eth, trie: streaming GC for the trie cache (#16810)Péter Szilágyi2018-06-041-22/+20
| | | | | | * core, eth, trie: streaming GC for the trie cache * trie: track memcache statistics
* core/rawdb: separate raw database access to own package (#16666)Péter Szilágyi2018-05-071-70/+69
|
* core: check transaction/receipt count match when reconstructing blocks (#16272)Kyuntae Ethan Kim2018-03-071-2/+8
|
* core: make current*Block atomic, and accessor functions mutex-free (#16171)Martin Holst Swende2018-02-261-57/+55
| | | | | | | | | | * core: make current*Block atomic, and accessor functions mutex-free * core: fix review concerns * core: fix error in atomic assignment * core/light: implement atomic getter/setter for headerchain
* core: flush out trie cache more meaningfully on stop (#16143)Péter Szilágyi2018-02-231-13/+12
| | | | | | * core: flush out trie cache more meaningfully on stop * core: upgrade legacy tests to chain maker
* metrics: pull library and introduce ResettingTimer and InfluxDB reporter ↵Anton Evangelatov2018-02-231-1/+1
| | | | | | | | | | | | | | | | | | | | (#15910) * go-metrics: fork library and introduce ResettingTimer and InfluxDB reporter. * vendor: change nonsense/go-metrics to ethersphere/go-metrics * go-metrics: add tests. move ResettingTimer logic from reporter to type. * all, metrics: pull in metrics package in go-ethereum * metrics/test: make sure metrics are enabled for tests * metrics: apply gosimple rules * metrics/exp, internal/debug: init expvar endpoint when starting pprof server * internal/debug: tiny comment formatting fix
* core: soften up state memory force-commit log messages (#16080)Felix Lange2018-02-131-6/+2
| | | | | | Talk about "state" instead of "trie timing", "trie memory" and remove the overzealous warning when the limit is just reached. Since the time limit is always reached on slow machines, move the message to info level so users don't freak out about internal details.
* core: force import known but rolled back blocksPéter Szilágyi2018-02-121-2/+6
|
* core, trie: intermediate mempool between trie and database (#15857)Péter Szilágyi2018-02-061-71/+263
| | | This commit reduces database I/O by not writing every state trie to disk.
* Merge pull request #15996 from karalabe/drop-redundant-methodsPéter Szilágyi2018-01-311-18/+1
|\ | | | | core, eth, les, light: get rid of redundant methods
| * core, eth, les, light: get rid of redundant methodsPéter Szilágyi2018-01-311-18/+1
| |
* | core, ethdb: reuse database batches (#15989)Martin Holst Swende2018-01-311-1/+1
|/ | | | | | * leveldb: Update leveldb to 211f780 (poolfix) * core, ethdb: reuse database batches
* core: sorted reorg insertion order for proper head header updatingPéter Szilágyi2018-01-221-7/+6
|
* all: switch gas limits from big.Int to uint64Péter Szilágyi2018-01-031-4/+4
|
* core, p2p/discv5: use time.NewTicker instead of time.Tick (#15747)ferhat elmas2018-01-021-2/+3
|
* core: split same-td blocks on block heightPéter Szilágyi2017-11-131-1/+6
|
* core: revert invalid block dedup code (#15235)Péter Szilágyi2017-10-041-5/+0
|
* core: only fire one chain head per batch (#15123)Péter Szilágyi2017-09-111-21/+32
| | | | | | * core: only fire one chain head per batch * miner: announce chan events synchronously
* core, eth/downloader: commit block data using batches (#15115)Felix Lange2017-09-101-127/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ethdb: add Putter interface and Has method * ethdb: improve docs and add IdealBatchSize * ethdb: remove memory batch lock Batches are not safe for concurrent use. * core: use ethdb.Putter for Write* functions This covers the easy cases. * core/state: simplify StateSync * trie: optimize local node check * ethdb: add ValueSize to Batch * core: optimize HasHeader check This avoids one random database read get the block number. For many uses of HasHeader, the expectation is that it's actually there. Using Has avoids a load + decode of the value. * core: write fast sync block data in batches Collect writes into batches up to the ideal size instead of issuing many small, concurrent writes. * eth/downloader: commit larger state batches Collect nodes into a batch up to the ideal size instead of committing whenever a node is received. * core: optimize HasBlock check This avoids a random database read to get the number. * core: use numberCache in HasHeader numberCache has higher capacity, increasing the odds of finding the header without a database lookup. * core: write imported block data using a batch Restore batch writes of state and add blocks, tx entries, receipts to the same batch. The change also simplifies the miner. This commit also removes posting of logs when a forked block is imported. * core: fix DB write error handling * ethdb: use RLock for Has * core: fix HasBlock comment
* core, eth: add bloombit indexer, filter based on itZsolt Felfoldi2017-09-061-15/+0
|
* core: make txpool operate on immutable statePéter Szilágyi2017-09-051-12/+0
|
* core, light: send chain events using event.Feed (#14865)Miya Chen2017-08-181-23/+69
|
* core: avoid write existing block again (#14849)Mark2017-07-311-0/+5
|
* core: remove redundant storage of transactions and receipts (#14801)Péter Szilágyi2017-07-151-24/+9
| | | | | | | | | | | | | | * core: remove redundant storage of transactions and receipts * core, eth, internal: new transaction schema usage polishes * eth: implement upgrade mechanism for db deduplication * core, eth: drop old sequential key db upgrader * eth: close last iterator on successful db upgrage * core: prefix the lookup entries to make their purpose clearer
* core: fix an off-by-one when the block import counts blocksMartin Holst Swende2017-06-291-1/+1
|
* core/state: access trie through Database interface, track errors (#14589)Felix Lange2017-06-271-22/+16
| | | | | | | | | With this commit, core/state's access to the underlying key/value database is mediated through an interface. Database errors are tracked in StateDB and returned by CommitTo or the new Error method. Motivation for this change: We can remove the light client's duplicated copy of core/state. The light client now supports node iteration, so tracing and storage enumeration can work with the light client (not implemented in this commit).
* core: fix minor accidental typos and comment errorsPéter Szilágyi2017-05-251-5/+5
|
* core: typos and comments improvechanghong2017-05-251-236/+237
| | | | | | | | 1. fix typos 2. methods recevier of struct should be same 3. comments improve (cherry picked from commit 1ba979539582a00b7fd1a7c8a37a6852e59eac0d)
* core: fix processing regression during receipt importPéter Szilágyi2017-05-081-3/+4
|
* core, light: delete SplitStatTy, ChainSplitEvent (unused)Felix Lange2017-04-221-6/+3
|
* consensus, core, ethstats: use engine specific block beneficiary (#14318)Péter Szilágyi2017-04-121-0/+3
| | | | | | * consensus, core, ethstats: use engine specific block beneficiary * core, eth, les, miner: use explicit beneficiary during mining
* core: fix comment typoJustin2017-04-101-1/+1
|
* consensus, core: drop all the legacy custom core error typesPéter Szilágyi2017-04-061-9/+8
|
* core, consensus: pluggable consensus engines (#3817)Péter Szilágyi2017-04-051-36/+26
| | | | | This commit adds pluggable consensus engines to go-ethereum. In short, it introduces a generic consensus interface, and refactors the entire codebase to use this interface.
* les: implement request distributor, fix blocking issues (#3660)Felföldi Zsolt2017-03-231-1/+6
| | | | | * les: implement request distributor, fix blocking issues * core: moved header validation before chain mutex lock
* core, eth, les: support resuming fast sync on heavy rollback (#3743)Péter Szilágyi2017-03-221-24/+49
|
* all: swap out the C++ ethash to the pure Go one (mining todo)Péter Szilágyi2017-03-091-0/+3
|
* Merge pull request #3739 from karalabe/logger-updates-4Péter Szilágyi2017-03-041-2/+0
|\ | | | | all: update light logs (and a few others) to the new model
| * all: update light logs (and a few others) to the new modelPéter Szilágyi2017-03-031-2/+0
| |
* | core: reorg logs crashed, add a check for corner casesPéter Szilágyi2017-03-031-6/+9
|/
* core, log: track field length and pad to alignPéter Szilágyi2017-02-281-5/+5
|
* all: next batch of log polishes to contextual versionsPéter Szilágyi2017-02-281-83/+68
|
* all: blidly swap out glog to our log15, logs need reworkPéter Szilágyi2017-02-231-52/+52
|
* core, core/state, core/vm: remove exported account getters (#3618)Jeffrey Wilcke2017-02-231-1/+0
| | | | Removed exported statedb object accessors, reducing the chance for nasty bugs to creep in. It's also ugly and unnecessary to have these methods.
* core/blockchain: Change iterator in procFutureBlocks to use lru.Peek instead ↵Martin Holst Swende2017-02-181-1/+1
| | | | of Get (#3655)
* core, eth, internal: Added `debug_getBadBlocks()` method (#3654)Martin Holst Swende2017-02-141-1/+29
| | | | | | | | | | | | | | | | * core,eth,internal: Added `debug_getBadBlocks()` method When bad blocks are discovered, these are stored within geth. An RPC-endpoint makes them availablewithin the `debug` namespace. This feature makes it easier to discover network forks. ``` * core, api: go format + docs * core/blockchain: Documentation, fix minor nitpick * core: fix failing blockchain test
* core: fix a small typo in blockchain.go (#3611)Vivek Anand2017-01-261-1/+1
|
* core/blockchain: Made logging of reorgs more structured (#3573)Martin Holst Swende2017-01-171-6/+13
| | | | | | | | * core: Made logging of reorgs more structured, also always log if reorg is > 63 blocks long * core/blockchain: go fmt * core/blockchain: Minor fixes to the reorg reporting
* cmd/geth, core: add support for recording SHA3 preimages (#3543)Nick Johnson2017-01-171-2/+8
|
* core: improve import log alignmentFelix Lange2017-01-111-9/+7
|
* all: fix ineffectual assignments and remove uses of crypto.Sha3Felix Lange2017-01-091-2/+1
| | | | | go get github.com/gordonklaus/ineffassign ineffassign .
* logger, pow/dagger, pow/ezp: delete dead codeFelix Lange2017-01-071-3/+0
|
* all: fix issues reported by honnef.co/go/simple/cmd/gosimpleFelix Lange2017-01-071-4/+1
|
* all: gofmt -w -sFelix Lange2017-01-061-1/+1
|
* core/vm: move Log to core/typesFelix Lange2017-01-061-3/+3
| | | | | | | | This significantly reduces the dependency closure of ethclient, which no longer depends on core/vm as of this change. All uses of vm.Logs are replaced by []*types.Log. NewLog is gone too, the constructor simply returned a literal.
* core: import future blocks one-by-one, enfore chain ancestryPéter Szilágyi2016-12-131-3/+29
|
* core, core/vm, eth/filters: move Removed field into vm.LogFelix Lange2016-12-051-14/+15
| | | | | | | | | | | | This field used to be assigned by the filter system and returned through the RPC API. Now that we have a Go client that uses the underlying type, the field needs to move. It is now assigned to true when the RemovedLogs event is generated so the filter system doesn't need to care about the field at all. While here, remove the log list from ChainSideEvent. There are no users of this field right now and any potential users could subscribe to RemovedLogsEvent instead.
* core: fixed unwinding bad hash (#3347)Jeffrey Wilcke2016-11-281-3/+8
| | | Fixed unwinding of bad hashes when already on the canon chain
* core: improved bad block error reporting (#3320)Jeffrey Wilcke2016-11-231-8/+21
|
* core/types, params: EIP#155Jeffrey Wilcke2016-11-131-5/+8
|
* core, core/state, trie: EIP158, reprice & skip empty account writeJeffrey Wilcke2016-11-131-5/+6
| | | | | | | | | | | | | | | This commit implements EIP158 part 1, 2, 3 & 4 1. If an account is empty it's no longer written to the trie. An empty account is defined as (balance=0, nonce=0, storage=0, code=0). 2. Delete an empty account if it's touched 3. An empty account is redefined as either non-existent or empty. 4. Zero value calls and zero value suicides no longer consume the 25k reation costs. params: moved core/config to params Signed-off-by: Jeffrey Wilcke <jeffrey@ethereum.org>
* light: light chain, VM env and tx poolZsolt Felfoldi2016-11-091-26/+32
|
* cmd/geth, code, eth/downloader: tune import logs and mem statsPéter Szilágyi2016-10-211-2/+15
|
* Merge pull request #3156 from holiman/metrics-blocksJeffrey Wilcke2016-10-181-0/+2
|\ | | | | core: Add block processing time metric collection
| * core: Add block processing time metric collectionMartin Holst Swende2016-10-181-0/+2
| |
* | common, core, eth/downloader: adjust import log formattingPéter Szilágyi2016-10-181-16/+23
|/
* trie, core/state: improve memory usage and performance (#3135)Felix Lange2016-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * trie: store nodes as pointers This avoids memory copies when unwrapping node interface values. name old time/op new time/op delta Get 388ns ± 8% 215ns ± 2% -44.56% (p=0.000 n=15+15) GetDB 363ns ± 3% 202ns ± 2% -44.21% (p=0.000 n=15+15) UpdateBE 1.57µs ± 2% 1.29µs ± 3% -17.80% (p=0.000 n=13+15) UpdateLE 1.92µs ± 2% 1.61µs ± 2% -16.25% (p=0.000 n=14+14) HashBE 2.16µs ± 6% 2.18µs ± 6% ~ (p=0.436 n=15+15) HashLE 7.43µs ± 3% 7.21µs ± 3% -2.96% (p=0.000 n=15+13) * trie: close temporary databases in GetDB benchmark * trie: don't keep []byte from DB load around Nodes decoded from a DB load kept hashes and values as sub-slices of the DB value. This can be a problem because loading from leveldb often returns []byte with a cap that's larger than necessary, increasing memory usage. * trie: unload old cached nodes * trie, core/state: use cache unloading for account trie * trie: use explicit private flags (fixes Go 1.5 reflection issue). * trie: fixup cachegen overflow at request of nick * core/state: rename journal size constant
* core: fixed import reporterJeffrey Wilcke2016-10-111-1/+1
|
* core: print import stats more oftenFelix Lange2016-10-081-11/+42
| | | | | | If geth is busy importing 2048 heavy blocks it can take a while before it prints anything. This change ensures that a message gets printed every 8s.
* core, eth, trie: reuse trie journals in all our codePéter Szilágyi2016-09-281-1/+6
|
* core/state: track all accounts in canon stateFelix Lange2016-09-261-13/+22
| | | | | This change introduces a global, per-state cache that keeps account data in the canon state. Thanks to @karalabe for lots of fixes.
* core: ensure the canonical block is written before the canonical hash is setBas van Kervel2016-08-161-9/+9
|
* core: solve a remote-import/local-mine data racePéter Szilágyi2016-07-081-4/+3
|
* core: improved chainDb using sequential keyszsfelfoldi2016-06-071-52/+72
|
* core, core/state, trie: enterprise hand-tuned multi-level cachingPéter Szilágyi2016-05-261-1/+6
|
* eth: enable bad block reportsFelix Lange2016-05-251-4/+1
| | | | | | | | | | | | We used to have reporting of bad blocks, but it was disabled before the Frontier release. We need it back because users are usually unable to provide the full RLP data of a bad block when it occurs. A shortcoming of this particular implementation is that the origin peer is not tracked for blocks received during eth/63 sync. No origin peer info is still better than no report at all though.
* core: Provide a public accessor for ChainConfigNicholas Johnson2016-04-291-0/+3
| | | | This is necessary for external users of the go-ethereum code who want to, for instance, build a custom node that plays back transactions, as core.ApplyTransaction requires a ChainConfig as a parameter.
* all: fix go vet warningsFelix Lange2016-04-151-2/+2
|
* core, core/types, eth: add and use Block.BodyFelix Lange2016-04-151-1/+1
| | | | | This fixes a few uses of unkeyed Body literals which go vet was complaining about.
* core: added basic chain configurationJeffrey Wilcke2016-04-011-15/+10
| | | | | | | | | Added chain configuration options and write out during genesis database insertion. If no "config" was found, nothing is written to the database. Configurations are written on a per genesis base. This means that any chain (which is identified by it's genesis hash) can have their own chain settings.
* core, eth, cmd: temporary work around for enabling the jitJeffrey Wilcke2016-03-241-1/+6
| | | | | This commit serves as a temporary workaround for enabling the jit until the block customisation PR is merged in.
* core: Added EVM configuration optionsJeffrey Wilcke2016-03-241-1/+1
| | | | | The EVM is now initialised with an additional configured object that allows you to turn on debugging options.
* Merge pull request #2341 from leijurv/patch-2Péter Szilágyi2016-03-161-3/+3
|\ | | | | core: fixed various typos
| * core: fixed various typosLeif Jurvetson2016-03-161-3/+3
| |
* | core, eth: replace reorganiz with reorganisLeif Jurvetson2016-03-161-1/+1
|/
* Merge pull request #2311 from obscuren/future-proc-fixJeffrey Wilcke2016-03-121-14/+15
|\ | | | | core: added future proc mutex lock
| * core: added future proc mutex lockJeffrey Wilcke2016-03-111-14/+15
| | | | | | | | | | | | | | | | | | | | Added a future lock which prevents the anything being added or removed from or to the set when looping over the set of blocks. This fixes a nil pointer in the range loop when trying to retrieve a block from the set which was previously available but removed due to regular chain processing. Fixes #2305
* | core: cache fresh headers and tds to avoid db trashingPéter Szilágyi2016-03-111-2/+2
|/
* core: create a header chain structure shared by core.BlockChain and ↵zsfelfoldi2016-03-101-340/+125
| | | | light.LightChain
* core: announce ChainSideEvent during reorgJeffrey Wilcke2016-03-081-6/+21
| | | | | | | | | | | Previously all blocks that were already in our chain were never re announced as potential uncle block (e.g. ChainSideEvent). This is problematic during mining where you want to gather as much possible uncles as possible increasing the profit. This is now addressed in this PR where during reorganisations of chains the old chain is regarded as uncles. Fixed #2298
* core: Added new TD strategy which mitigate the risk for selfish miningJeffrey Wilcke2016-02-181-6/+14
| | | | | | | | | | | | | | | | Assuming the following scenario where a miner has 15% of all hashing power and the ability to exert a moderate control over the network to the point where if the attacker sees a message A, it can't stop A from propagating, but what it **can** do is send a message B and ensure that most nodes see B before A. The attacker can then selfish mine and augment selfish mining strategy by giving his own blocks an advantage. This change makes the time at which a block is received less relevant and so the level of control an attacker has over the network no longer makes a difference. This change changes the current td algorithm `B_td > C_td` to the new algorithm `B_td > C_td || B_td == C_td && rnd < 0.5`.
* eth/filters: ✨ pending logs ✨Jeffrey Wilcke2016-02-131-1/+1
| | | | | | Pending logs are now filterable through the Go API. Filter API changed such that each filter type has it's own bucket and adding filter explicitly requires you specify the bucket to put it in.
* core, eth/downloader: ensure state presence in ancestor lookupPéter Szilágyi2016-01-041-0/+13
|
* core: write individual transactions and receipts too on fast syncPéter Szilágyi2015-12-041-0/+12
|
* core: added a new RemovedLogEventJeffrey Wilcke2015-12-011-2/+20
| | | | | | When a chain reorganisation occurs we collect the logs that were deleted during the chain reorganisation. The removed logs are posted to the event mux indicating that those were deleted during the reorg.
* cmd, common, core, eth, node, rpc, tests, whisper, xeth: use protocol stacksPéter Szilágyi2015-11-271-5/+1
|
* core, eth, miner, xeth: clean up tx/receipt db accessorsPéter Szilágyi2015-11-191-6/+6
|
* core, eth, rpc: split out block validator and state processorJeffrey Wilcke2015-11-181-20/+114
| | | | | | | | | | | | This removes the burden on a single object to take care of all validation and state processing. Now instead the validation is done by the `core.BlockValidator` (`types.Validator`) that takes care of both header and uncle validation through the `ValidateBlock` method and state validation through the `ValidateState` method. The state processing is done by a new object `core.StateProcessor` (`types.Processor`) and accepts a new state as input and uses that to process the given block's transactions (and uncles for rewords) to calculate the state root for the next block (P_n + 1).
* core: only reset head header/fastblock if stalePéter Szilágyi2015-10-281-11/+18
|
* core, eth, trie: fix data races and merge/review issuesPéter Szilágyi2015-10-211-29/+42
|
* core, eth: roll back uncertain headers in failed fast syncsPéter Szilágyi2015-10-191-1/+36
|
* eth/downloader: concurrent receipt and state processingPéter Szilágyi2015-10-191-86/+180
|
* core, eth, trie: direct state trie synchronizationPéter Szilágyi2015-10-191-4/+21
|
* core, eth: receipt chain reconstructionPéter Szilágyi2015-10-191-40/+170
|
* core: fix block canonical mark / content write racePéter Szilágyi2015-10-191-20/+11
|
* core: support inserting pure header chainsPéter Szilágyi2015-10-191-65/+233
|
* Merge pull request #1899 from obscuren/mipmap-bloomJeffrey Wilcke2015-10-171-5/+22
|\ | | | | core, eth/filters, miner, xeth: Optimised log filtering
| * core, eth/filters, miner, xeth: Optimised log filteringJeffrey Wilcke2015-10-171-5/+22
| | | | | | | | | | | | | | Log filtering is now using a MIPmap like approach where addresses of logs are added to a mapped bloom bin. The current levels for the MIP are in ranges of 1.000.000, 500.000, 100.000, 50.000, 1.000. Logs are therefor filtered in batches of 1.000.
* | core/state, core, miner: handle missing root error from state.NewGustav Simonsson2015-10-161-1/+1
|/
* core, eth, event, miner, xeth: fix event post / subscription racePéter Szilágyi2015-10-121-38/+27
|
* core: fixed head write on block insertionJeffrey Wilcke2015-10-051-0/+3
| | | | | Due to a rebase this probably got overlooked / ignored. This fixes the issue of a block insertion never writing the last block.
* cmd/geth, cmd/utils, core, rpc: renamed to blockchainJeffrey Wilcke2015-10-041-0/+809
* Renamed ChainManager to BlockChain * Checkpointing is no longer required and never really properly worked when the state was corrupted.