chore: improve comments

This commit is contained in:
healthykim 2025-11-29 00:23:58 +09:00
parent 96891be7f9
commit c961983210
3 changed files with 7 additions and 8 deletions

View file

@ -53,8 +53,6 @@ type Request struct {
Peer string // Demultiplexer if cross-peer requests are batched together Peer string // Demultiplexer if cross-peer requests are batched together
Sent time.Time // Timestamp when the request was sent Sent time.Time // Timestamp when the request was sent
continued bool
} }
// Close aborts an in-flight request. Although there's no way to notify the // Close aborts an in-flight request. Although there's no way to notify the

View file

@ -353,8 +353,9 @@ func serviceGetReceiptsQuery69(chain *core.BlockChain, query GetReceiptsRequest)
} }
// serviceGetReceiptsQuery70 assembles the response to a receipt query. // serviceGetReceiptsQuery70 assembles the response to a receipt query.
// If the receipts exceed 10 MiB, it trims them and sets the lastBlockIncomplete flag. // If the receipts exceed 10 MiB, it trims them and sets the
// Indices smaller than firstBlockReceiptIndex are omitted from the first block receipt list. // lastBlockIncomplete flag. Indices smaller than firstBlockReceiptIndex
// are omitted from the first block receipt list.
func serviceGetReceiptsQuery70(chain *core.BlockChain, query GetReceiptsRequest, firstBlockReceiptIndex uint64) ([]rlp.RawValue, bool) { func serviceGetReceiptsQuery70(chain *core.BlockChain, query GetReceiptsRequest, firstBlockReceiptIndex uint64) ([]rlp.RawValue, bool) {
var ( var (
bytes int bytes int

View file

@ -43,7 +43,7 @@ const (
maxQueuedTxAnns = 4096 maxQueuedTxAnns = 4096
) )
type partialReceipt struct { type receiptRequest struct {
request []common.Hash request []common.Hash
list []*ReceiptList69 // list of partially collected receipts list []*ReceiptList69 // list of partially collected receipts
lastLogSize uint64 // log size of last receipt list lastLogSize uint64 // log size of last receipt list
@ -67,7 +67,7 @@ type Peer struct {
reqCancel chan *cancel // Dispatch channel to cancel pending requests and untrack them reqCancel chan *cancel // Dispatch channel to cancel pending requests and untrack them
resDispatch chan *response // Dispatch channel to fulfil pending requests and untrack them resDispatch chan *response // Dispatch channel to fulfil pending requests and untrack them
receiptBuffer map[uint64]*partialReceipt // requestId to receiptlist map receiptBuffer map[uint64]*receiptRequest // Previously requested receipts to buffer partial receipts
term chan struct{} // Termination channel to stop the broadcasters term chan struct{} // Termination channel to stop the broadcasters
} }
@ -87,7 +87,7 @@ func NewPeer(version uint, p *p2p.Peer, rw p2p.MsgReadWriter, txpool TxPool) *Pe
reqCancel: make(chan *cancel), reqCancel: make(chan *cancel),
resDispatch: make(chan *response), resDispatch: make(chan *response),
txpool: txpool, txpool: txpool,
receiptBuffer: make(map[uint64]*partialReceipt), receiptBuffer: make(map[uint64]*receiptRequest),
term: make(chan struct{}), term: make(chan struct{}),
} }
// Start up all the broadcasters // Start up all the broadcasters
@ -356,7 +356,7 @@ func (p *Peer) RequestReceipts(hashes []common.Hash, sink chan *Response) (*Requ
FirstBlockReceiptIndex: 0, FirstBlockReceiptIndex: 0,
}, },
} }
p.receiptBuffer[id] = &partialReceipt{request: hashes} p.receiptBuffer[id] = &receiptRequest{request: hashes}
} else { } else {
req = &Request{ req = &Request{
id: id, id: id,