forked from cerc-io/plugeth
		
	rawdb: remove unused parameter for WritePreimages func (#18059)
* rawdb: remove unused parameter for WritePreimages func and modify a spelling mistake * rawdb: update the doc for function WritePreimages
This commit is contained in:
		
							parent
							
								
									f574c4e74b
								
							
						
					
					
						commit
						1ff152f3a4
					
				| @ -272,13 +272,13 @@ func ImportPreimages(db *ethdb.LDBDatabase, fn string) error { | |||||||
| 		// Accumulate the preimages and flush when enough ws gathered
 | 		// Accumulate the preimages and flush when enough ws gathered
 | ||||||
| 		preimages[crypto.Keccak256Hash(blob)] = common.CopyBytes(blob) | 		preimages[crypto.Keccak256Hash(blob)] = common.CopyBytes(blob) | ||||||
| 		if len(preimages) > 1024 { | 		if len(preimages) > 1024 { | ||||||
| 			rawdb.WritePreimages(db, 0, preimages) | 			rawdb.WritePreimages(db, preimages) | ||||||
| 			preimages = make(map[common.Hash][]byte) | 			preimages = make(map[common.Hash][]byte) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	// Flush the last batch preimage data
 | 	// Flush the last batch preimage data
 | ||||||
| 	if len(preimages) > 0 { | 	if len(preimages) > 0 { | ||||||
| 		rawdb.WritePreimages(db, 0, preimages) | 		rawdb.WritePreimages(db, preimages) | ||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  | |||||||
| @ -1002,7 +1002,7 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types. | |||||||
| 		} | 		} | ||||||
| 		// Write the positional metadata for transaction/receipt lookups and preimages
 | 		// Write the positional metadata for transaction/receipt lookups and preimages
 | ||||||
| 		rawdb.WriteTxLookupEntries(batch, block) | 		rawdb.WriteTxLookupEntries(batch, block) | ||||||
| 		rawdb.WritePreimages(batch, block.NumberU64(), state.Preimages()) | 		rawdb.WritePreimages(batch, state.Preimages()) | ||||||
| 
 | 
 | ||||||
| 		status = CanonStatTy | 		status = CanonStatTy | ||||||
| 	} else { | 	} else { | ||||||
|  | |||||||
| @ -77,9 +77,8 @@ func ReadPreimage(db DatabaseReader, hash common.Hash) []byte { | |||||||
| 	return data | 	return data | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // WritePreimages writes the provided set of preimages to the database. `number` is the
 | // WritePreimages writes the provided set of preimages to the database.
 | ||||||
| // current block number, and is used for debug messages only.
 | func WritePreimages(db DatabaseWriter, preimages map[common.Hash][]byte) { | ||||||
| func WritePreimages(db DatabaseWriter, number uint64, preimages map[common.Hash][]byte) { |  | ||||||
| 	for hash, preimage := range preimages { | 	for hash, preimage := range preimages { | ||||||
| 		if err := db.Put(preimageKey(hash), preimage); err != nil { | 		if err := db.Put(preimageKey(hash), preimage); err != nil { | ||||||
| 			log.Crit("Failed to store trie preimage", "err", err) | 			log.Crit("Failed to store trie preimage", "err", err) | ||||||
|  | |||||||
| @ -35,7 +35,7 @@ var ( | |||||||
| 	// headBlockKey tracks the latest know full block's hash.
 | 	// headBlockKey tracks the latest know full block's hash.
 | ||||||
| 	headBlockKey = []byte("LastBlock") | 	headBlockKey = []byte("LastBlock") | ||||||
| 
 | 
 | ||||||
| 	// headFastBlockKey tracks the latest known incomplete block's hash duirng fast sync.
 | 	// headFastBlockKey tracks the latest known incomplete block's hash during fast sync.
 | ||||||
| 	headFastBlockKey = []byte("LastFast") | 	headFastBlockKey = []byte("LastFast") | ||||||
| 
 | 
 | ||||||
| 	// fastTrieProgressKey tracks the number of trie entries imported during fast sync.
 | 	// fastTrieProgressKey tracks the number of trie entries imported during fast sync.
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user