mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
light: fixed new conflict
This commit is contained in:
parent
2df585114b
commit
02f06e98b8
2 changed files with 12 additions and 4 deletions
|
|
@ -143,7 +143,7 @@ func (bc *LightChain) Odr() OdrBackend {
|
||||||
// loadLastState loads the last known chain state from the database. This method
|
// loadLastState loads the last known chain state from the database. This method
|
||||||
// assumes that the chain manager mutex is held.
|
// assumes that the chain manager mutex is held.
|
||||||
func (bc *LightChain) loadLastState() error {
|
func (bc *LightChain) loadLastState() error {
|
||||||
if head := core.GetHeadHeaderHash(bc.chainDb); head == (common.Hash{}) {
|
if head := rawdb.ReadHeadHeaderHash(bc.chainDb); head == (common.Hash{}) {
|
||||||
// Corrupt or empty database, init from scratch
|
// Corrupt or empty database, init from scratch
|
||||||
bc.Reset()
|
bc.Reset()
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -221,7 +221,11 @@ func (bc *LightChain) GetBody(ctx context.Context, hash common.Hash) (*types.Bod
|
||||||
body := cached.(*types.Body)
|
body := cached.(*types.Body)
|
||||||
return body, nil
|
return body, nil
|
||||||
}
|
}
|
||||||
body, err := GetBody(ctx, bc.odr, hash, bc.hc.GetBlockNumber(hash))
|
number := bc.hc.GetBlockNumber(hash)
|
||||||
|
if number == nil {
|
||||||
|
return nil, errors.New("unknown block")
|
||||||
|
}
|
||||||
|
body, err := GetBody(ctx, bc.odr, hash, *number)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -237,7 +241,11 @@ func (bc *LightChain) GetBodyRLP(ctx context.Context, hash common.Hash) (rlp.Raw
|
||||||
if cached, ok := bc.bodyRLPCache.Get(hash); ok {
|
if cached, ok := bc.bodyRLPCache.Get(hash); ok {
|
||||||
return cached.(rlp.RawValue), nil
|
return cached.(rlp.RawValue), nil
|
||||||
}
|
}
|
||||||
body, err := GetBodyRLP(ctx, bc.odr, hash, bc.hc.GetBlockNumber(hash))
|
number := bc.hc.GetBlockNumber(hash)
|
||||||
|
if number == nil {
|
||||||
|
return nil, errors.New("unknown block")
|
||||||
|
}
|
||||||
|
body, err := GetBodyRLP(ctx, bc.odr, hash, *number)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -412,7 +412,7 @@ func (pool *TxPool) add(ctx context.Context, tx *types.Transaction) error {
|
||||||
// Notify the subscribers. This event is posted in a goroutine
|
// Notify the subscribers. This event is posted in a goroutine
|
||||||
// because it's possible that somewhere during the post "Remove transaction"
|
// because it's possible that somewhere during the post "Remove transaction"
|
||||||
// gets called which will then wait for the global tx pool lock and deadlock.
|
// gets called which will then wait for the global tx pool lock and deadlock.
|
||||||
go pool.txFeed.Send(core.TxPreEvent{Tx: tx})
|
go pool.txFeed.Send(core.NewTxsEvent{Txs: types.Transactions{tx}})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print a log message if low enough level is set
|
// Print a log message if low enough level is set
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue