core: fix typos (#15720)

This commit is contained in:
Kurkó Mihály 2017-12-20 19:08:51 +02:00 committed by Péter Szilágyi
parent da58afcea0
commit b4cf57a581
2 changed files with 14 additions and 14 deletions

View File

@ -103,7 +103,7 @@ var (
underpricedTxCounter = metrics.NewCounter("txpool/underpriced") underpricedTxCounter = metrics.NewCounter("txpool/underpriced")
) )
// TxStatus is the current status of a transaction as seen py the pool. // TxStatus is the current status of a transaction as seen by the pool.
type TxStatus uint type TxStatus uint
const ( const (
@ -199,7 +199,7 @@ type TxPool struct {
pendingState *state.ManagedState // Pending state tracking virtual nonces pendingState *state.ManagedState // Pending state tracking virtual nonces
currentMaxGas *big.Int // Current gas limit for transaction caps currentMaxGas *big.Int // Current gas limit for transaction caps
locals *accountSet // Set of local transaction to exepmt from evicion rules locals *accountSet // Set of local transaction to exempt from eviction rules
journal *txJournal // Journal of local transaction to back up to disk journal *txJournal // Journal of local transaction to back up to disk
pending map[common.Address]*txList // All currently processable transactions pending map[common.Address]*txList // All currently processable transactions
@ -214,7 +214,7 @@ type TxPool struct {
} }
// NewTxPool creates a new transaction pool to gather, sort and filter inbound // NewTxPool creates a new transaction pool to gather, sort and filter inbound
// trnsactions from the network. // transactions from the network.
func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain blockChain) *TxPool { func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain blockChain) *TxPool {
// Sanitize the input to ensure no vulnerable gas prices are set // Sanitize the input to ensure no vulnerable gas prices are set
config = (&config).sanitize() config = (&config).sanitize()

View File

@ -153,6 +153,7 @@ func (tx *Transaction) DecodeRLP(s *rlp.Stream) error {
return err return err
} }
// MarshalJSON encodes the web3 RPC transaction format.
func (tx *Transaction) MarshalJSON() ([]byte, error) { func (tx *Transaction) MarshalJSON() ([]byte, error) {
hash := tx.Hash() hash := tx.Hash()
data := tx.data data := tx.data
@ -168,8 +169,8 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error {
} }
var V byte var V byte
if isProtectedV(dec.V) { if isProtectedV(dec.V) {
chainId := deriveChainId(dec.V).Uint64() chainID := deriveChainId(dec.V).Uint64()
V = byte(dec.V.Uint64() - 35 - 2*chainId) V = byte(dec.V.Uint64() - 35 - 2*chainID)
} else { } else {
V = byte(dec.V.Uint64() - 27) V = byte(dec.V.Uint64() - 27)
} }
@ -192,11 +193,10 @@ func (tx *Transaction) CheckNonce() bool { return true }
func (tx *Transaction) To() *common.Address { func (tx *Transaction) To() *common.Address {
if tx.data.Recipient == nil { if tx.data.Recipient == nil {
return nil return nil
} else { }
to := *tx.data.Recipient to := *tx.data.Recipient
return &to return &to
} }
}
// Hash hashes the RLP encoding of tx. // Hash hashes the RLP encoding of tx.
// It uniquely identifies the transaction. // It uniquely identifies the transaction.
@ -315,22 +315,22 @@ func (tx *Transaction) String() string {
) )
} }
// Transaction slice type for basic sorting. // Transactions is a Transaction slice type for basic sorting.
type Transactions []*Transaction type Transactions []*Transaction
// Len returns the length of s // Len returns the length of s.
func (s Transactions) Len() int { return len(s) } func (s Transactions) Len() int { return len(s) }
// Swap swaps the i'th and the j'th element in s // Swap swaps the i'th and the j'th element in s.
func (s Transactions) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s Transactions) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
// GetRlp implements Rlpable and returns the i'th element of s in rlp // GetRlp implements Rlpable and returns the i'th element of s in rlp.
func (s Transactions) GetRlp(i int) []byte { func (s Transactions) GetRlp(i int) []byte {
enc, _ := rlp.EncodeToBytes(s[i]) enc, _ := rlp.EncodeToBytes(s[i])
return enc return enc
} }
// Returns a new set t which is the difference between a to b // TxDifference returns a new set t which is the difference between a to b.
func TxDifference(a, b Transactions) (keep Transactions) { func TxDifference(a, b Transactions) (keep Transactions) {
keep = make(Transactions, 0, len(a)) keep = make(Transactions, 0, len(a))
@ -378,7 +378,7 @@ func (s *TxByPrice) Pop() interface{} {
} }
// TransactionsByPriceAndNonce represents a set of transactions that can return // TransactionsByPriceAndNonce represents a set of transactions that can return
// transactions in a profit-maximising sorted order, while supporting removing // transactions in a profit-maximizing sorted order, while supporting removing
// entire batches of transactions for non-executable accounts. // entire batches of transactions for non-executable accounts.
type TransactionsByPriceAndNonce struct { type TransactionsByPriceAndNonce struct {
txs map[common.Address]Transactions // Per account nonce-sorted list of transactions txs map[common.Address]Transactions // Per account nonce-sorted list of transactions