You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.3 KiB
54 lines
1.3 KiB
8 months ago
|
package wiki
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"math/big"
|
||
|
|
||
|
"github.com/ethereum/go-ethereum/common"
|
||
|
"github.com/woop-chain/woop/core/types"
|
||
|
)
|
||
|
|
||
|
// GetPoolStats returns the number of pending and queued transactions
|
||
|
func (wiki *Woop) GetPoolStats() (pendingCount, queuedCount int) {
|
||
|
return wiki.TxPool.Stats()
|
||
|
}
|
||
|
|
||
|
// GetPoolNonce ...
|
||
|
func (wiki *Woop) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) {
|
||
|
return wiki.TxPool.State().GetNonce(addr), nil
|
||
|
}
|
||
|
|
||
|
// GetPoolTransaction ...
|
||
|
func (wiki *Woop) GetPoolTransaction(hash common.Hash) types.PoolTransaction {
|
||
|
return wiki.TxPool.Get(hash)
|
||
|
}
|
||
|
|
||
|
// GetPendingCXReceipts ..
|
||
|
func (wiki *Woop) GetPendingCXReceipts() []*types.CXReceiptsProof {
|
||
|
return wiki.NodeAPI.PendingCXReceipts()
|
||
|
}
|
||
|
|
||
|
// GetPoolTransactions returns pool transactions.
|
||
|
func (wiki *Woop) GetPoolTransactions() (types.PoolTransactions, error) {
|
||
|
pending, err := wiki.TxPool.Pending()
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
queued, err := wiki.TxPool.Queued()
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var txs types.PoolTransactions
|
||
|
for _, batch := range pending {
|
||
|
txs = append(txs, batch...)
|
||
|
}
|
||
|
for _, batch := range queued {
|
||
|
txs = append(txs, batch...)
|
||
|
}
|
||
|
return txs, nil
|
||
|
}
|
||
|
|
||
|
func (wiki *Woop) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
||
|
return wiki.gpo.SuggestPrice(ctx)
|
||
|
}
|