fix: support multiple pools in stake snapshot query (#396)
This commit is contained in:
parent
43cdb74ee0
commit
4362341b43
4 changed files with 12 additions and 7 deletions
|
|
@ -99,7 +99,7 @@ impl Encode<()> for BlockQuery {
|
|||
e.u16(20)?;
|
||||
|
||||
if !pools.is_empty() {
|
||||
e.array(Vec::len(pools) as u64)?;
|
||||
e.array(1)?;
|
||||
e.tag(Tag::Unassigned(258))?;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// TODO: this should move to pallas::ledger crate at some point
|
||||
|
||||
use pallas_crypto::hash::Hash;
|
||||
use std::collections::BTreeSet;
|
||||
use std::hash::Hash as StdHash;
|
||||
// required for derive attrs to work
|
||||
use pallas_codec::minicbor::{self};
|
||||
|
|
@ -210,7 +211,7 @@ pub type Addr = Bytes;
|
|||
|
||||
pub type Addrs = Vec<Addr>;
|
||||
|
||||
pub type Pools = Vec<Option<Bytes>>;
|
||||
pub type Pools = BTreeSet<Bytes>;
|
||||
|
||||
pub type Coin = AnyUInt;
|
||||
|
||||
|
|
@ -388,7 +389,7 @@ pub async fn get_utxo_by_address(
|
|||
pub async fn get_stake_snapshots(
|
||||
client: &mut Client,
|
||||
era: u16,
|
||||
pools: Vec<Option<Bytes>>,
|
||||
pools: BTreeSet<Bytes>,
|
||||
) -> Result<StakeSnapshot, ClientError> {
|
||||
let query = BlockQuery::GetStakeSnapshots(pools);
|
||||
let query = LedgerQuery::BlockQuery(era, query);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
use std::collections::BTreeSet;
|
||||
use std::fs;
|
||||
use std::net::{Ipv4Addr, SocketAddrV4};
|
||||
use std::time::Duration;
|
||||
|
|
@ -673,7 +674,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
localstate::queries_v16::Request::LedgerQuery(
|
||||
localstate::queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
localstate::queries_v16::BlockQuery::GetStakeSnapshots(vec![]),
|
||||
localstate::queries_v16::BlockQuery::GetStakeSnapshots(BTreeSet::new()),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
|
@ -923,7 +924,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
|
|||
let request = AnyCbor::from_encode(localstate::queries_v16::Request::LedgerQuery(
|
||||
localstate::queries_v16::LedgerQuery::BlockQuery(
|
||||
5,
|
||||
localstate::queries_v16::BlockQuery::GetStakeSnapshots(vec![]),
|
||||
localstate::queries_v16::BlockQuery::GetStakeSnapshots(BTreeSet::new()),
|
||||
),
|
||||
));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue