Skip to content

Commit e61f60b

Browse files
committed
add gui
1 parent 63b9412 commit e61f60b

File tree

14 files changed

+6618
-19
lines changed

14 files changed

+6618
-19
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ tests/nodes/.ports
1313
/*.info
1414
.vscode
1515
/migrate/target
16+
/gui/target

crates/fiber-lib/src/fiber/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4708,7 +4708,7 @@ impl ChannelActorState {
47084708

47094709
// Get the total liquid capacity of the channel, which will exclude the reserved ckb amount.
47104710
// This is the capacity used for gossiping channel information.
4711-
pub(crate) fn get_liquid_capacity(&self) -> u128 {
4711+
pub fn get_liquid_capacity(&self) -> u128 {
47124712
if self.funding_udt_type_script.is_some() {
47134713
self.get_total_udt_amount()
47144714
} else {

crates/fiber-lib/src/fiber/network.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,7 +2259,7 @@ pub struct NetworkActorState<S> {
22592259
pub struct PersistentNetworkActorState {
22602260
// This map is used to store the public key of the peer.
22612261
#[serde_as(as = "Vec<(DisplayFromStr, _)>")]
2262-
peer_pubkey_map: HashMap<PeerId, Pubkey>,
2262+
pub peer_pubkey_map: HashMap<PeerId, Pubkey>,
22632263
// These addresses are saved by the user (e.g. the user sends a ConnectPeer rpc to the node),
22642264
// we will then save these addresses to the peer store.
22652265
#[serde_as(as = "Vec<(DisplayFromStr, _)>")]
@@ -2271,7 +2271,7 @@ impl PersistentNetworkActorState {
22712271
Default::default()
22722272
}
22732273

2274-
fn get_peer_addresses(&self, peer_id: &PeerId) -> Vec<Multiaddr> {
2274+
pub fn get_peer_addresses(&self, peer_id: &PeerId) -> Vec<Multiaddr> {
22752275
self.saved_peer_addresses
22762276
.get(peer_id)
22772277
.cloned()

crates/fiber-lib/src/fiber/types.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,14 @@ impl From<Point> for Pubkey {
333333
}
334334
}
335335

336+
impl std::fmt::Display for crate::fiber::types::Pubkey {
337+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
338+
use hex::ToHex;
339+
let bytes = self.serialize();
340+
write!(f, "0x{}", bytes.encode_hex::<String>())
341+
}
342+
}
343+
336344
impl From<tentacle::secio::PublicKey> for Pubkey {
337345
fn from(pk: tentacle::secio::PublicKey) -> Self {
338346
secp256k1::PublicKey::from_slice(pk.inner_ref())

crates/fiber-lib/src/store/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pub mod db_migrate;
22
pub mod migration;
3-
mod schema;
3+
pub mod schema;
44
pub mod store_impl;
55
pub use store_impl::Store;
66
#[cfg(test)]

crates/fiber-lib/src/store/schema.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
//! | 224 | Hash256 | ChannelData |
1818
//! +--------------+----------------------+-----------------------------+
1919
20-
pub(crate) const CHANNEL_ACTOR_STATE_PREFIX: u8 = 0;
21-
pub(crate) const PEER_ID_NETWORK_ACTOR_STATE_PREFIX: u8 = 16;
22-
pub(crate) const CKB_INVOICE_PREFIX: u8 = 32;
23-
pub(crate) const PREIMAGE_PREFIX: u8 = 33;
24-
pub(crate) const CKB_INVOICE_STATUS_PREFIX: u8 = 34;
25-
pub(crate) const PEER_ID_CHANNEL_ID_PREFIX: u8 = 64;
26-
pub(crate) const CHANNEL_OUTPOINT_CHANNEL_ID_PREFIX: u8 = 65;
27-
pub(crate) const BROADCAST_MESSAGE_PREFIX: u8 = 96;
28-
pub(crate) const BROADCAST_MESSAGE_TIMESTAMP_PREFIX: u8 = 97;
29-
pub(crate) const PAYMENT_SESSION_PREFIX: u8 = 192;
30-
pub(crate) const PAYMENT_HISTORY_TIMED_RESULT_PREFIX: u8 = 193;
31-
pub(crate) const PAYMENT_CUSTOM_RECORD_PREFIX: u8 = 194;
20+
pub const CHANNEL_ACTOR_STATE_PREFIX: u8 = 0;
21+
pub const PEER_ID_NETWORK_ACTOR_STATE_PREFIX: u8 = 16;
22+
pub const CKB_INVOICE_PREFIX: u8 = 32;
23+
pub const PREIMAGE_PREFIX: u8 = 33;
24+
pub const CKB_INVOICE_STATUS_PREFIX: u8 = 34;
25+
pub const PEER_ID_CHANNEL_ID_PREFIX: u8 = 64;
26+
pub const CHANNEL_OUTPOINT_CHANNEL_ID_PREFIX: u8 = 65;
27+
pub const BROADCAST_MESSAGE_PREFIX: u8 = 96;
28+
pub const BROADCAST_MESSAGE_TIMESTAMP_PREFIX: u8 = 97;
29+
pub const PAYMENT_SESSION_PREFIX: u8 = 192;
30+
pub const PAYMENT_HISTORY_TIMED_RESULT_PREFIX: u8 = 193;
31+
pub const PAYMENT_CUSTOM_RECORD_PREFIX: u8 = 194;
3232
#[cfg(feature = "watchtower")]
33-
pub(crate) const WATCHTOWER_CHANNEL_PREFIX: u8 = 224;
33+
pub const WATCHTOWER_CHANNEL_PREFIX: u8 = 224;

crates/fiber-lib/src/store/store_impl/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub(crate) fn serialize_to_vec<T: ?Sized + Serialize>(value: &T, field_name: &st
5151
.unwrap_or_else(|e| panic!("serialization of {} failed: {}", field_name, e))
5252
}
5353

54-
pub(crate) fn deserialize_from<'a, T>(slice: &'a [u8], field_name: &str) -> T
54+
pub fn deserialize_from<'a, T>(slice: &'a [u8], field_name: &str) -> T
5555
where
5656
T: serde::Deserialize<'a>,
5757
{

0 commit comments

Comments
 (0)