Skip to content

Commit

Permalink
Track BitName seq IDs, bump version for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-L2L committed Jan 15, 2025
1 parent 25215d7 commit f6d8f40
Show file tree
Hide file tree
Showing 17 changed files with 1,044 additions and 677 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ authors = [ "Ash Manning <ash@layertwolabs.com>" ]
edition = "2021"
license-file = "LICENSE.txt"
publish = false
version = "0.9.1"
version = "0.9.2"

[profile.release]
# lto = "fat"
2 changes: 1 addition & 1 deletion app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ impl App {
if !ownership.contains(&height) {
return None;
};
bitname_data.paymail_fee_sats
bitname_data.mutable_data.paymail_fee_sats
})
.min();
let Some(min_fee) = min_fee else {
Expand Down
20 changes: 14 additions & 6 deletions app/gui/bitnames/all_bitnames.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::BTreeMap;

use eframe::egui;
use hex::FromHex;
use plain_bitnames::types::{hashes::BitName, BitNameData};
use plain_bitnames::types::{hashes::BitName, BitNameData, MutableBitNameData};

use crate::{
app::App,
Expand All @@ -19,13 +19,17 @@ fn show_bitname_data(
bitname_data: &BitNameData,
) -> egui::Response {
let BitNameData {
seq_id,
mutable_data,
} = bitname_data;
let MutableBitNameData {
commitment,
ipv4_addr,
ipv6_addr,
encryption_pubkey,
signing_pubkey,
paymail_fee_sats,
} = bitname_data;
} = mutable_data;
let commitment = commitment.map_or("Not set".to_owned(), hex::encode);
let ipv4_addr = ipv4_addr
.map_or("Not set".to_owned(), |ipv4_addr| ipv4_addr.to_string());
Expand All @@ -38,12 +42,16 @@ fn show_bitname_data(
let paymail_fee_sats = paymail_fee_sats
.map_or("Not set".to_owned(), |paymail_fee| paymail_fee.to_string());
ui.horizontal(|ui| {
ui.monospace_selectable_singleline(
true,
format!("Commitment: {commitment}"),
)
ui.monospace_selectable_singleline(false, format!("Seq ID: {seq_id}"))
})
.join()
| ui.horizontal(|ui| {
ui.monospace_selectable_singleline(
true,
format!("Commitment: {commitment}"),
)
})
.join()
| ui.horizontal(|ui| {
ui.monospace_selectable_singleline(
false,
Expand Down
6 changes: 3 additions & 3 deletions app/gui/bitnames/reserve_register.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::borrow::Cow;

use eframe::egui;
use plain_bitnames::types::BitNameData;
use plain_bitnames::types::MutableBitNameData;

use crate::{
app::App,
Expand All @@ -21,7 +21,7 @@ fn reserve_bitname(
fn register_bitname(
app: &App,
plaintext_name: &str,
bitname_data: Cow<BitNameData>,
bitname_data: Cow<MutableBitNameData>,
fee: bitcoin::Amount,
) -> anyhow::Result<()> {
let mut tx = app.wallet.create_regular_transaction(fee)?;
Expand Down Expand Up @@ -117,7 +117,7 @@ impl Register {
bitcoin::Denomination::Bitcoin,
);
tx_creator::TxCreator::show_bitname_options(ui, &mut self.bitname_data);
let bitname_data: Result<BitNameData, _> =
let bitname_data: Result<MutableBitNameData, _> =
self.bitname_data.clone().try_into();
if let Err(err) = &bitname_data {
ui.monospace_selectable_multiline(err.clone());
Expand Down
8 changes: 4 additions & 4 deletions app/gui/coins/tx_creator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use hex::FromHex;

use plain_bitnames::{
authorization::VerifyingKey,
types::{BitNameData, EncryptionPubKey, Hash, Transaction, Txid},
types::{EncryptionPubKey, Hash, MutableBitNameData, Transaction, Txid},
};

use crate::{app::App, gui::util::InnerResponseExt};
Expand Down Expand Up @@ -65,7 +65,7 @@ impl<T> std::default::Default for TrySetOption<T> {
}
}

impl TryFrom<TrySetBitNameData> for BitNameData {
impl TryFrom<TrySetBitNameData> for MutableBitNameData {
type Error = String;

fn try_from(try_set: TrySetBitNameData) -> Result<Self, Self::Error> {
Expand All @@ -92,7 +92,7 @@ impl TryFrom<TrySetBitNameData> for BitNameData {
.paymail_fee_sats
.0
.map_err(|err| format!("Cannot parse paymail fee: \"{err}\""))?;
Ok(BitNameData {
Ok(MutableBitNameData {
commitment,
ipv4_addr,
ipv6_addr,
Expand Down Expand Up @@ -126,7 +126,7 @@ impl TxCreator {
plaintext_name,
bitname_data,
} => {
let bitname_data: BitNameData = (bitname_data.as_ref())
let bitname_data: MutableBitNameData = (bitname_data.as_ref())
.clone()
.try_into()
.map_err(|err| anyhow::anyhow!("{err}"))?;
Expand Down
2 changes: 1 addition & 1 deletion app/gui/encrypt_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl EncryptMessage {
.get_current_bitname_data(&bitname)
.map_err(anyhow::Error::from)
.and_then(|bitname_data| {
bitname_data.encryption_pubkey.ok_or(
bitname_data.mutable_data.encryption_pubkey.ok_or(
anyhow::anyhow!(
"No encryption pubkey exists for this BitName"
),
Expand Down
2 changes: 1 addition & 1 deletion lib/node/net_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use thiserror::Error;
use tokio::task::JoinHandle;
use tokio_stream::StreamNotifyClose;
use tokio_util::task::LocalPoolHandle;
use zeromq::Socket;

use super::mainchain_task::{self, MainchainTaskHandle};
use crate::{
Expand Down Expand Up @@ -81,6 +80,7 @@ impl ZmqPubHandler {
socket_addr: SocketAddr,
) -> Result<Self, zeromq::ZmqError> {
use futures::TryFutureExt as _;
use zeromq::Socket as _;
let (tx, rx) = mpsc::unbounded::<zeromq::ZmqMessage>();
let zmq_pub_addr = format!("tcp://{socket_addr}");
let mut zmq_pub = zeromq::PubSocket::new();
Expand Down
Loading

0 comments on commit f6d8f40

Please sign in to comment.