Add a dummy commitment in faucet messages

This commit is contained in:
Sosthene 2024-05-22 10:22:20 +02:00
parent d7daf72da0
commit 0e88a729c3

View File

@ -1,5 +1,7 @@
use anyhow::{Error, Result};
use rand::{thread_rng, RngCore};
use serde::{Deserialize, Serialize};
use sp_client::bitcoin::hex::DisplayHex;
use sp_client::bitcoin::key::constants::ZERO;
use sp_client::bitcoin::OutPoint;
use sp_client::silentpayments::bitcoin_hashes::{sha256t_hash_newtype, Hash, HashEngine};
@ -9,7 +11,6 @@ use crate::crypto::CipherText;
const RAWTXTOPIC: &'static str = "rawtx";
const RAWBLOCKTOPIC: &'static str = "rawblock";
const ANKMAGIC: [u8; 4] = [0x34, 0x6E, 0x6B, 0x30];
#[derive(Debug, Serialize, Deserialize)]
pub enum BitcoinTopic {
@ -187,11 +188,14 @@ impl AnkFlag {
#[tsify(into_wasm_abi, from_wasm_abi)]
pub struct FaucetMessage {
pub sp_address: String,
pub commitment: String,
}
impl FaucetMessage {
pub fn new(sp_address: String) -> Self {
Self { sp_address }
let mut buf = [0u8;64];
thread_rng().fill_bytes(&mut buf);
Self { sp_address, commitment: buf.to_lower_hex_string() }
}
}