Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Add getRecentPrioritizationFees RPC endpoint (backport #27278) #29547

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions client/src/rpc_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,3 +541,9 @@ pub struct RpcSnapshotSlotInfo {
pub full: Slot,
pub incremental: Option<Slot>,
}

#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq)]
pub struct RpcPrioritizationFee {
pub slot: Slot,
pub prioritization_fee: u64,
}
28 changes: 28 additions & 0 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,34 @@ impl Validator {
} else {
None
};
<<<<<<< HEAD
=======

let json_rpc_service = JsonRpcService::new(
rpc_addr,
config.rpc_config.clone(),
config.snapshot_config.clone(),
bank_forks.clone(),
block_commitment_cache.clone(),
blockstore.clone(),
cluster_info.clone(),
Some(poh_recorder.clone()),
genesis_config.hash(),
ledger_path,
config.validator_exit.clone(),
config.known_validators.clone(),
rpc_override_health_check.clone(),
startup_verification_complete,
optimistically_confirmed_bank.clone(),
config.send_transaction_service_config.clone(),
max_slots.clone(),
leader_schedule_cache.clone(),
connection_cache.clone(),
max_complete_transaction_status_slot,
prioritization_fee_cache.clone(),
)?;

>>>>>>> 9b8bed86f (Add getRecentPrioritizationFees RPC endpoint (#27278))
(
Some(JsonRpcService::new(
rpc_addr,
Expand Down
60 changes: 60 additions & 0 deletions docs/src/developing/clients/jsonrpc-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ gives a convenient interface for the RPC methods.
- [getMultipleAccounts](jsonrpc-api.md#getmultipleaccounts)
- [getProgramAccounts](jsonrpc-api.md#getprogramaccounts)
- [getRecentPerformanceSamples](jsonrpc-api.md#getrecentperformancesamples)
- [getRecentPrioritizationFees](jsonrpc-api.md#getrecentprioritizationfees)
- [getSignaturesForAddress](jsonrpc-api.md#getsignaturesforaddress)
- [getSignatureStatuses](jsonrpc-api.md#getsignaturestatuses)
- [getSlot](jsonrpc-api.md#getslot)
Expand Down Expand Up @@ -2114,6 +2115,65 @@ Result:
}
```

### getRecentPrioritizationFees

Returns a list of minimum prioritization fees from recent blocks. Currently, a
node's prioritization-fee cache stores data from up to 150 blocks.

#### Parameters:

- `<array>` - (optional) An array of account address strings. If this parameter is provided, the response will reflect the minimum prioritization fee to land a transaction locking all of the provided accounts as writable.

#### Results:

An array of:

- `RpcPrioritizationFee<object>`
- `slot: <u64>` - Slot in which minimum fee was observed
- `prioritizationFee: <u64>` - Minimum fee paid for a successfully landed transaction

#### Example:

Request:

```bash
// Request
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0", "id":1, "method":"getRecentPrioritizationFees", "params": [["CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"]]}
'
```

Result:

```json
{
"jsonrpc": "2.0",
"result": [
{
"slot": 348125,
"prioritizationFee": 0,
},
{
"slot": 348126,
"prioritizationFee": 1000,
},
{
"slot": 348127,
"prioritizationFee": 500,
},
{
"slot": 348128,
"prioritizationFee": 0,
},
{
"slot": 348129,
"prioritizationFee": 1234,
}
],
"id": 1
}
```

### getSignaturesForAddress

Returns signatures for confirmed transactions that include the given address in
Expand Down
Loading