Skip to content

Commit

Permalink
Merge pull request #62 from utxostack/fix/closure-bump-timestamp
Browse files Browse the repository at this point in the history
Fix channel closure bumping timestamp error
  • Loading branch information
duanyytop authored Dec 11, 2024
2 parents ba70700 + 681d1b4 commit cf5a520
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

14 changes: 6 additions & 8 deletions mutiny-core/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::node::BumpTxEventHandler;
use crate::nodemanager::ChannelClosure;
use crate::onchain::OnChainWallet;
use crate::storage::MutinyStorage;
use crate::utils::sleep;
use crate::utils::{self, sleep};
use crate::{fees::MutinyFeeEstimator, storage::read_payment_info, PrivacyLevel};
use crate::{keymanager::PhantomKeysManager, storage::persist_payment_info};
use anyhow::anyhow;
Expand All @@ -23,7 +23,6 @@ use lightning_invoice::Bolt11Invoice;
use serde::{Deserialize, Serialize};
use std::str::FromStr;
use std::sync::Arc;
use std::time::{SystemTime, UNIX_EPOCH};

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Hash)]
pub struct PaymentInfo {
Expand Down Expand Up @@ -714,11 +713,13 @@ impl<S: MutinyStorage> EventHandler<S> {
} => {
let txid = format!("{:x}", commitment_tx.compute_txid());
let hex_tx = bitcoin::consensus::encode::serialize_hex(commitment_tx);
let timestamp = utils::now().as_secs();
log_debug!(
self.logger,
"EVENT: BumpTransaction channel_id {} tx_id {}\nhex_tx {}",
"EVENT: BumpTransaction channel_id {} tx_id {} timestamp {}\nhex_tx {}",
channel_id,
txid,
timestamp,
hex_tx
);
if self.do_not_bump_channel_closed_tx {
Expand All @@ -732,10 +733,7 @@ impl<S: MutinyStorage> EventHandler<S> {
channel_id: format!("{channel_id}"),
txid,
hex_tx,
timestamp: SystemTime::now()
.duration_since(UNIX_EPOCH)
.expect("current time must be greater than epoch anchor")
.as_secs(),
timestamp,
};

if let Err(e) = self
Expand All @@ -751,7 +749,7 @@ impl<S: MutinyStorage> EventHandler<S> {
channel_id: closure_bumping_event.channel_id,
txid: closure_bumping_event.txid,
hex_tx: closure_bumping_event.hex_tx,
timestamp: closure_bumping_event.timestamp,
timestamp,
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion mutiny-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cargo-features = ["per-package-target"]

[package]
name = "mutiny-wasm"
version = "1.10.19"
version = "1.10.20"
edition = "2021"
authors = ["utxostack"]
forced-target = "wasm32-unknown-unknown"
Expand Down

0 comments on commit cf5a520

Please sign in to comment.