mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Bulletproofs+ (#70)
* Initial stab at Bulletproofs+ Does move around the existing Bulletproofs code, does still work as expected. * Make the Clsag RCTPrunable type work with BP and BP+ * Initial set of BP+ bug fixes * Further bug fixes * Remove RING_LEN as a constant * Monero v16 TX support Doesn't implement view tags, nor going back to v14, nor the updated BP clawback logic. * Support v14 and v16 at the same time
This commit is contained in:
@@ -10,6 +10,7 @@ use serde_json::json;
|
||||
use reqwest;
|
||||
|
||||
use crate::{
|
||||
Protocol,
|
||||
transaction::{Input, Timelock, Transaction},
|
||||
block::Block,
|
||||
wallet::Fee,
|
||||
@@ -98,6 +99,37 @@ impl Rpc {
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn get_protocol(&self) -> Result<Protocol, RpcError> {
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct ProtocolResponse {
|
||||
major_version: usize,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct LastHeaderResponse {
|
||||
block_header: ProtocolResponse,
|
||||
}
|
||||
|
||||
Ok(
|
||||
match self
|
||||
.rpc_call::<_, JsonRpcResponse<LastHeaderResponse>>(
|
||||
"json_rpc",
|
||||
Some(json!({
|
||||
"method": "get_last_block_header"
|
||||
})),
|
||||
)
|
||||
.await?
|
||||
.result
|
||||
.block_header
|
||||
.major_version
|
||||
{
|
||||
13 | 14 => Protocol::v14,
|
||||
15 | 16 => Protocol::v16,
|
||||
_ => Protocol::Unsupported,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
pub async fn get_height(&self) -> Result<usize, RpcError> {
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct HeightResponse {
|
||||
|
||||
Reference in New Issue
Block a user