mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 22:56:43 +00:00
core/txpool, eth: polish
This commit is contained in:
parent
10f20d8f62
commit
52aef17fd3
6 changed files with 18 additions and 16 deletions
|
|
@ -89,7 +89,7 @@ type blobTxMeta struct {
|
||||||
|
|
||||||
id uint64 // Storage ID in the pool's persistent store
|
id uint64 // Storage ID in the pool's persistent store
|
||||||
storageSize uint32 // Byte size in the pool's persistent store
|
storageSize uint32 // Byte size in the pool's persistent store
|
||||||
size uint64 // RLP-encoded size of transaction
|
size uint64 // RLP-encoded size of transaction including the attached blob
|
||||||
|
|
||||||
nonce uint64 // Needed to prioritize inclusion order within an account
|
nonce uint64 // Needed to prioritize inclusion order within an account
|
||||||
costCap *uint256.Int // Needed to validate cumulative balance sufficiency
|
costCap *uint256.Int // Needed to validate cumulative balance sufficiency
|
||||||
|
|
@ -1238,14 +1238,16 @@ func (p *BlobPool) GetRLP(hash common.Hash) []byte {
|
||||||
return p.getRLP(hash)
|
return p.getRLP(hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMetadata returns the transaction type and transaction size with the given
|
// GetMetadata returns the transaction type and transaction size with the
|
||||||
// hash.
|
// given transaction hash.
|
||||||
|
//
|
||||||
|
// The size refers the length of the 'rlp encoding' of a blob transaction
|
||||||
|
// including the attached blobs.
|
||||||
func (p *BlobPool) GetMetadata(hash common.Hash) *txpool.TxMetadata {
|
func (p *BlobPool) GetMetadata(hash common.Hash) *txpool.TxMetadata {
|
||||||
size, ok := p.lookup.sizeOfTx(hash)
|
size, ok := p.lookup.sizeOfTx(hash)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return &txpool.TxMetadata{
|
return &txpool.TxMetadata{
|
||||||
Type: types.BlobTxType,
|
Type: types.BlobTxType,
|
||||||
Size: size,
|
Size: size,
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import (
|
||||||
|
|
||||||
type txMetadata struct {
|
type txMetadata struct {
|
||||||
id uint64 // the billy id of transction
|
id uint64 // the billy id of transction
|
||||||
size uint64 // the RLP encoded size of transaction
|
size uint64 // the RLP encoded size of transaction (blobs are included)
|
||||||
}
|
}
|
||||||
|
|
||||||
// lookup maps blob versioned hashes to transaction hashes that include them,
|
// lookup maps blob versioned hashes to transaction hashes that include them,
|
||||||
|
|
|
||||||
|
|
@ -1035,14 +1035,13 @@ func (pool *LegacyPool) GetRLP(hash common.Hash) []byte {
|
||||||
return encoded
|
return encoded
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMetadata returns the transaction type and transaction size with the given
|
// GetMetadata returns the transaction type and transaction size with the
|
||||||
// hash.
|
// given transaction hash.
|
||||||
func (pool *LegacyPool) GetMetadata(hash common.Hash) *txpool.TxMetadata {
|
func (pool *LegacyPool) GetMetadata(hash common.Hash) *txpool.TxMetadata {
|
||||||
tx := pool.all.Get(hash)
|
tx := pool.all.Get(hash)
|
||||||
if tx == nil {
|
if tx == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return &txpool.TxMetadata{
|
return &txpool.TxMetadata{
|
||||||
Type: tx.Type(),
|
Type: tx.Type(),
|
||||||
Size: tx.Size(),
|
Size: tx.Size(),
|
||||||
|
|
|
||||||
|
|
@ -86,9 +86,10 @@ type PendingFilter struct {
|
||||||
OnlyBlobTxs bool // Return only blob transactions (block blob-space filling)
|
OnlyBlobTxs bool // Return only blob transactions (block blob-space filling)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TxMetadata denotes the metadata of a transaction.
|
||||||
type TxMetadata struct {
|
type TxMetadata struct {
|
||||||
Type uint8
|
Type uint8 // The type of the transaction
|
||||||
Size uint64
|
Size uint64 // The length of the 'rlp encoding' of a transaction
|
||||||
}
|
}
|
||||||
|
|
||||||
// SubPool represents a specialized transaction pool that lives on its own (e.g.
|
// SubPool represents a specialized transaction pool that lives on its own (e.g.
|
||||||
|
|
@ -132,8 +133,8 @@ type SubPool interface {
|
||||||
// GetRLP returns a RLP-encoded transaction if it is contained in the pool.
|
// GetRLP returns a RLP-encoded transaction if it is contained in the pool.
|
||||||
GetRLP(hash common.Hash) []byte
|
GetRLP(hash common.Hash) []byte
|
||||||
|
|
||||||
// GetMetadata returns the transaction type and transaction size with the given
|
// GetMetadata returns the transaction type and transaction size with the
|
||||||
// hash.
|
// given transaction hash.
|
||||||
GetMetadata(hash common.Hash) *TxMetadata
|
GetMetadata(hash common.Hash) *TxMetadata
|
||||||
|
|
||||||
// GetBlobs returns a number of blobs are proofs for the given versioned hashes.
|
// GetBlobs returns a number of blobs are proofs for the given versioned hashes.
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ type txPool interface {
|
||||||
// with given tx hash.
|
// with given tx hash.
|
||||||
GetRLP(hash common.Hash) []byte
|
GetRLP(hash common.Hash) []byte
|
||||||
|
|
||||||
// GetMetadata returns the transaction type and transaction size with the given
|
// GetMetadata returns the transaction type and transaction size with the
|
||||||
// hash.
|
// given transaction hash.
|
||||||
GetMetadata(hash common.Hash) *txpool.TxMetadata
|
GetMetadata(hash common.Hash) *txpool.TxMetadata
|
||||||
|
|
||||||
// Add should add the given transactions to the pool.
|
// Add should add the given transactions to the pool.
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,8 @@ type TxPool interface {
|
||||||
// the given hash.
|
// the given hash.
|
||||||
GetRLP(hash common.Hash) []byte
|
GetRLP(hash common.Hash) []byte
|
||||||
|
|
||||||
// GetMetadata returns the transaction type and transaction size with the given
|
// GetMetadata returns the transaction type and transaction size with the
|
||||||
// hash.
|
// given transaction hash.
|
||||||
GetMetadata(hash common.Hash) *txpool.TxMetadata
|
GetMetadata(hash common.Hash) *txpool.TxMetadata
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue