From f05419f0fb8c5328dca92ea9fb184d082300344a Mon Sep 17 00:00:00 2001 From: gary rong Date: Fri, 16 Jul 2021 07:52:40 +0800 Subject: [PATCH] les: fix eth_sendTransaction API (#23215) --- les/api_backend.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/les/api_backend.go b/les/api_backend.go index 2a2d406d1f..326b540b6f 100644 --- a/les/api_backend.go +++ b/les/api_backend.go @@ -60,8 +60,11 @@ func (b *LesApiBackend) SetHead(number uint64) { } func (b *LesApiBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) { + // Return the latest current as the pending one since there + // is no pending notion in the light client. TODO(rjl493456442) + // unify the behavior of `HeaderByNumber` and `PendingBlockAndReceipts`. if number == rpc.PendingBlockNumber { - return nil, nil + return b.eth.blockchain.CurrentHeader(), nil } if number == rpc.LatestBlockNumber { return b.eth.blockchain.CurrentHeader(), nil