mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 12:49:23 +00:00
Exposed a hash-based API for accessing blocks
Also corrects a few panics, which shouldn't have been present, and unnecessary Cursor uses.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use core::ops::BitXor;
|
||||
use std::io::{self, Read, Write, Cursor};
|
||||
use std::io::{self, Read, Write};
|
||||
|
||||
use zeroize::Zeroize;
|
||||
|
||||
@@ -127,7 +127,7 @@ impl Extra {
|
||||
pub(crate) fn payment_id(&self) -> Option<PaymentId> {
|
||||
for field in &self.0 {
|
||||
if let ExtraField::Nonce(data) = field {
|
||||
return PaymentId::deserialize(&mut Cursor::new(data)).ok();
|
||||
return PaymentId::deserialize::<&[u8]>(&mut data.as_ref()).ok();
|
||||
}
|
||||
}
|
||||
None
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use std::io::Cursor;
|
||||
|
||||
use zeroize::{Zeroize, ZeroizeOnDrop};
|
||||
|
||||
use curve25519_dalek::{constants::ED25519_BASEPOINT_TABLE, scalar::Scalar, edwards::EdwardsPoint};
|
||||
@@ -232,7 +230,7 @@ impl<O: Clone + Zeroize> Timelocked<O> {
|
||||
impl Scanner {
|
||||
/// Scan a transaction to discover the received outputs.
|
||||
pub fn scan_transaction(&mut self, tx: &Transaction) -> Timelocked<ReceivedOutput> {
|
||||
let extra = Extra::deserialize(&mut Cursor::new(&tx.prefix.extra));
|
||||
let extra = Extra::deserialize::<&[u8]>(&mut tx.prefix.extra.as_ref());
|
||||
let keys;
|
||||
let extra = if let Ok(extra) = extra {
|
||||
keys = extra.keys();
|
||||
|
||||
Reference in New Issue
Block a user