Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/typos #271

Merged
merged 16 commits into from
Jul 1, 2024
Merged
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
2 changes: 1 addition & 1 deletion lampo-bdk-wallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl WalletManager for BDKWalletManager {
)
})
.collect();
log::info!("bdk stert to sync");
log::info!("bdk start to sync");

let (update_graph, last_active_indices) =
client.scan_txs_with_keychains(spks, None, None, 50, 2)?;
Expand Down
18 changes: 9 additions & 9 deletions lampo-bitcoind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct BitcoinCore {
ours_txs: Mutex<RefCell<Vec<Txid>>>,
others_txs: Mutex<RefCell<Vec<(Txid, ScriptBuf)>>>,
// receive notification if the
// daemon was stop
// daemon was stoped
stop: Arc<bool>,
pool_time: Duration,
best_height: RefCell<u64>,
Expand Down Expand Up @@ -70,7 +70,7 @@ impl BitcoinCore {
handler: RefCell::new(None),
ours_txs: Mutex::new(RefCell::new(Vec::new())),
others_txs: Mutex::new(RefCell::new(Vec::new())),
// by default the we pool bitcoind each 2 minutes
// by default we pool bitcoind each 2 minutes
pool_time: Duration::from_secs(pool_time.unwrap_or(120) as u64),
stop,
last_bloch_hash: None.into(),
Expand Down Expand Up @@ -299,9 +299,9 @@ impl Backend for BitcoinCore {
&bitcoincore_rpc::bitcoin::Txid::from_str(txid.to_string().as_str())?,
None,
)?;
// SAFETY: the transaction should contains always the first.
// SAFETY: the details should always contain the first entry.
//
// FIXME: we are looking at the first is always a good ide?
// FIXME: we are looking at the first is always a good idea?
if let Some(true) = tx.details.first().unwrap().abandoned {
return Ok(TxResult::Discarded);
}
Expand Down Expand Up @@ -399,8 +399,8 @@ impl Backend for BitcoinCore {
}
}
txs.clear();
// FIXME: if we want remember this we should put in a separate vector maybe?
// or make it persistan.
// FIXME: if we want to remember this we should put in a separate vector maybe?
// or make it persistant.
//
// txs.append(&mut confirmed_txs);
txs.append(&mut unconfirmed_txs);
Expand Down Expand Up @@ -462,14 +462,14 @@ impl Backend for BitcoinCore {
let _ = self.find_tx_in_block(&block);
}
}
// ok when the wallet is full in sync with the blockchain, we can query the
// bitcoind wallet for ours transaction.
// ok when the wallet is in full sync with the blockchain, we can query the
// bitcoind wallet for our transaction.
//
// This is the only place where we can query because otherwise we can
// confuse ldk when we send a new best block with height X and a Confirmed transaction
// event at height Y, where Y > X. In this way ldk think that a reorgs happens.
//
// The reorgs do not happens commonly, it is only that the bitcoind wallet is able
// The reorgs do not happen commonly, it is only that the bitcoind wallet is able
// to answer quickly while the lampo wallet is still looking
// for external transaction inside the blocks.
let _ = self.process_transactions();
Expand Down
2 changes: 1 addition & 1 deletion lampo-common/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub trait Backend {
/// Ask to the backend to watch the following UTXO and notify you
/// when somethings changes
fn manage_transactions(&self, txs: &mut Vec<Txid>) -> error::Result<()>;
/// Spawn a thread and start to polling the backend and notify
/// Spawn a thread and start polling the backend and notify
/// the listener through the handler.
fn listen(self: Arc<Self>) -> error::Result<JoinHandle<()>>;
/// Get the information of a transaction inside the blockchain.
Expand Down
2 changes: 1 addition & 1 deletion lampo-common/src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl LampoKeysManager {
}
}

// FIXME: put this under a debug a feature flag like `unsafa_channel_keys`
// FIXME: put this under a debug a feature flag like `unsafe_channel_keys`
#[cfg(debug_assertions)]
pub fn set_channels_keys(
&mut self,
Expand Down
4 changes: 2 additions & 2 deletions lampo-common/src/model/invoice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub mod response {
pub routes: Vec<String>,
pub hints: Vec<String>,
pub network: String,
pub amount_msa: Option<u64>,
pub amount_msat: Option<u64>,
}

#[derive(Serialize, Deserialize, Debug)]
Expand All @@ -82,7 +82,7 @@ pub mod response {
pub enum PaymentState {
Success,
Pending,
Faulure,
Failure,
}

#[derive(Clone, Serialize, Deserialize, Debug)]
Expand Down
4 changes: 2 additions & 2 deletions lampo-common/src/model/open_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub mod response {
pub node_id: String,
pub amount: u64,
pub public: bool,
pub push_mst: u64,
pub push_msat: u64,
pub to_self_delay: u64,
pub tx: Option<Transaction>,
pub txid: Option<Txid>,
Expand All @@ -65,7 +65,7 @@ pub mod response {
pub peer_id: String,
pub peer_alias: Option<String>,
pub ready: bool,
pub amount_satoshis: u64,
pub amount: u64,
pub amount_msat: u64,
pub public: bool,
pub available_balance_for_send_msat: u64,
Expand Down
10 changes: 5 additions & 5 deletions lampo-core-wallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct CoreWalletManager {
}

impl CoreWalletManager {
/// from mnemonic_words build or bkd::Wallet or return an bdk::Error
/// Build from mnemonic_words and return bkd::Wallet or bdk::Error
fn build_wallet(
conf: Arc<LampoConf>,
mnemonic_words: &str,
Expand All @@ -56,15 +56,15 @@ impl CoreWalletManager {
.into_xprv(network)
.ok_or(error::anyhow!("impossible cast the private key"))?;

let ldk_kesy = LampoKeys::new(xprv.private_key.secret_bytes());
let ldk_keys = LampoKeys::new(xprv.private_key.secret_bytes());
// Create a BDK wallet structure using BIP 84 descriptor ("m/84h/1h/0h/0" and "m/84h/1h/0h/1")
let wallet = bdk::Wallet::new(
Bip84(xprv, KeychainKind::External),
Some(Bip84(xprv, KeychainKind::Internal)),
(),
network,
)?;
Ok((wallet, ldk_kesy))
Ok((wallet, ldk_keys))
}

#[cfg(debug_assertions)]
Expand Down Expand Up @@ -98,7 +98,7 @@ impl CoreWalletManager {
conf: Arc<LampoConf>,
wallet: bdk::Wallet,
) -> error::Result<String> {
// FIXME: allow to support multiple wallet for the same chain, so
// FIXME: allow to support multiple wallets for the same chain, so
// we should make a suffix in the following name
let name_wallet = "lampo-wallet".to_owned();
if !rpc
Expand Down Expand Up @@ -151,7 +151,7 @@ impl CoreWalletManager {
];

let rpc = Self::build_bitcoin_rpc(conf.clone(), Some(&name_wallet))?;
log::trace!(target: "core", "impot descriptor options: {:?}", options);
log::trace!(target: "core", "import descriptor options: {:?}", options);
let _: json::Value = rpc.call("importdescriptors", &[json::json!(options)])?;
}
};
Expand Down
2 changes: 1 addition & 1 deletion lampo-jsonrpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
let fd = event.as_raw_fd();
// SAFETY: we must have the response for this fd.
let resp = self.response_queue.remove(&fd).unwrap();
// SAFETY: we much have a stream for this fd.
// SAFETY: we must have a stream for this fd.
let mut stream = self.open_streams.remove(&event.as_raw_fd()).unwrap();
// SAFETY: the resp should be a valid json.
let buff = serde_json::to_string(&resp).unwrap();
Expand Down Expand Up @@ -351,7 +351,7 @@
assert!(res.is_ok(), "{:?}", res);

let handler = server.handler();
let worker = server.spawn();

Check warning on line 354 in lampo-jsonrpc/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (stable)

unused variable: `worker`
let request = Request::<Value> {
id: Some(0.into()),
jsonrpc: String::from_str("2.0").unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion lampod/src/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Handler for DummyHandler {
}
}

/// The Handler that need to implement for handle
/// The Handler that need to be implemented to handle
/// inventory event
///
/// This is necessary because ldk does not have any
Expand Down
6 changes: 1 addition & 5 deletions lampod/src/actions/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ impl LampoHandler {
/// Call any method supported by the lampod configuration. This includes
/// a lot of handler code. This function serves as a broker pattern in some ways,
/// but it may also function as a chain of responsibility pattern in certain cases.
///
/// Welcome to the third design pattern in under 300 lines of code. The code will clarify the
/// idea, but be prepared to see a broker pattern begin as a chain of responsibility pattern
/// at some point.
pub fn call<T: json::Serialize, R: json::DeserializeOwned>(
&self,
method: &str,
Expand Down Expand Up @@ -275,7 +271,7 @@ impl Handler for LampoHandler {
ldk::events::PaymentPurpose::SpontaneousPayment(preimage) => (Some(preimage), None),
};
log::warn!("please note the payments are not make persistent for the moment");
// FIXME: make peristant these information
// FIXME: make peristent these information
Ok(())
}
ldk::events::Event::PaymentSent { .. } => {
Expand Down
2 changes: 1 addition & 1 deletion lampod/src/chain/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl LampoChainManager {
fn print_ldk_target_to_string(&self, target: ConfirmationTarget) -> String {
match target {
ConfirmationTarget::OnChainSweep => String::from("on_chain_sweep"),
ConfirmationTarget::AnchorChannelFee => String::from("anchor_chanenl"),
ConfirmationTarget::AnchorChannelFee => String::from("anchor_channel"),
ConfirmationTarget::NonAnchorChannelFee => String::from("non_anchor_channel"),
ConfirmationTarget::ChannelCloseMinimum => String::from("channel_close_minimum"),
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee => {
Expand Down
2 changes: 1 addition & 1 deletion lampod/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub enum Command {
/// handle.
///
/// An external handler can be any kind of method
/// that lampod do not know nothing about.
/// that lampod know nothing about.
///
/// Core Lightning Plugins works this way and we want
/// keep this freedom, but we do not want people
Expand Down
6 changes: 3 additions & 3 deletions lampod/src/jsonrpc/offchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn json_decode_invoice(ctx: &LampoDaemon, request: &json::Value) -> Result<j
{
InvoiceInfo {
issuer_id: invoice.payee_pub_key().map(|id| id.to_string()),
amount_msa: invoice.amount_milli_satoshis(),
amount_msat: invoice.amount_milli_satoshis(),
network: invoice.network().to_string(),
description: match invoice.description() {
ldk::invoice::Bolt11InvoiceDescription::Direct(dec) => Some(dec.to_string()),
Expand All @@ -85,7 +85,7 @@ pub fn json_decode_invoice(ctx: &LampoDaemon, request: &json::Value) -> Result<j
.offchain_manager()
.decode::<ldk::offers::offer::Offer>(&request.invoice_str)
{
// FIXME: semplify this chain;
// FIXME: simplify this chain;
let network = offer
.chains()
.iter()
Expand All @@ -96,7 +96,7 @@ pub fn json_decode_invoice(ctx: &LampoDaemon, request: &json::Value) -> Result<j
.clone();
InvoiceInfo {
issuer_id: offer.issuer().map(|id| id.to_string()),
amount_msa: offer.amount().map(|a| {
amount_msat: offer.amount().map(|a| {
if let Amount::Bitcoin { amount_msats } = a {
amount_msats.clone()
} else {
Expand Down
4 changes: 2 additions & 2 deletions lampod/src/ln/channel_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl LampoChannelManager {
peer_id: channel.counterparty.node_id.to_string(),
peer_alias: None,
ready: channel.is_channel_ready,
amount_satoshis: channel.channel_value_satoshis,
amount: channel.channel_value_satoshis,
amount_msat: channel.next_outbound_htlc_limit_msat,
public: channel.is_public,
available_balance_for_send_msat: channel.outbound_capacity_msat,
Expand Down Expand Up @@ -438,7 +438,7 @@ impl ChannelEvents for LampoChannelManager {
node_id: open_channel.node_id,
amount: open_channel.amount,
public: open_channel.public,
push_mst: 0,
push_msat: 0,
to_self_delay: 2016,
tx,
txid,
Expand Down
Loading