Skip to content
Open
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
14 changes: 9 additions & 5 deletions src/payment/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1074,9 +1074,10 @@ mod tests {

#[test]
fn funding_reclassification_does_not_downgrade_an_advanced_record() {
use bitcoin::hashes::Hash;
use std::str::FromStr;

use bitcoin::hashes::Hash;

// A splice funding payment wallet sync has already advanced to Succeeded/Confirmed.
let txid = Txid::from_byte_array([7u8; 32]);
let id = PaymentId(txid.to_byte_array());
Expand Down Expand Up @@ -1162,9 +1163,10 @@ mod tests {

#[test]
fn funding_reclassification_keeps_confirmed_candidate_figures() {
use bitcoin::hashes::Hash;
use std::str::FromStr;

use bitcoin::hashes::Hash;

// A funding payment whose first candidate wallet sync has already seen confirm — e.g. the
// counterparty's broadcast of it was picked up before our own later candidate was
// classified. The record is unclassified (created by the sync fallthrough).
Expand Down Expand Up @@ -1247,9 +1249,10 @@ mod tests {

#[test]
fn funding_reclassification_merges_figures_for_the_confirmed_candidate() {
use bitcoin::hashes::Hash;
use std::str::FromStr;

use bitcoin::hashes::Hash;

// Wallet sync confirmed the transaction before classification ran, so the record carries
// the wallet's own view of amount/fee, which cannot represent our contribution to a shared
// funding output.
Expand Down Expand Up @@ -1315,11 +1318,12 @@ mod tests {

#[tokio::test]
async fn funding_classification_merge_preserves_advanced_record() {
use bitcoin::hashes::Hash;
use lightning::util::test_utils::TestLogger;
use std::str::FromStr;
use std::sync::Arc;

use bitcoin::hashes::Hash;
use lightning::util::test_utils::TestLogger;

use crate::data_store::DataStore;
use crate::io::test_utils::InMemoryStore;
use crate::types::{DynStore, DynStoreWrapper};
Expand Down
15 changes: 8 additions & 7 deletions tests/upgrade_downgrade_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ mod common;
use std::str::FromStr;
use std::time::Duration;

use crate::common::{
expect_channel_pending_event, expect_channel_ready_event, expect_event,
expect_payment_claimable_event, expect_payment_received_event, expect_payment_successful_event,
generate_blocks_and_wait, generate_listening_addresses, premine_and_distribute_funds,
random_config, random_storage_path, setup_bitcoind_and_electrsd, setup_node, wait_for_tx,
TestChainSource,
};
use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::hashes::Hash;
use bitcoin::secp256k1::PublicKey;
Expand All @@ -41,6 +34,14 @@ use ldk_node::{Builder, Event, Node};
use ldk_node_070::lightning_types::payment::PaymentHash as OldPaymentHash;
use lightning_types::payment::{PaymentHash, PaymentPreimage};

use crate::common::{
expect_channel_pending_event, expect_channel_ready_event, expect_event,
expect_payment_claimable_event, expect_payment_received_event, expect_payment_successful_event,
generate_blocks_and_wait, generate_listening_addresses, premine_and_distribute_funds,
random_config, random_storage_path, setup_bitcoind_and_electrsd, setup_node, wait_for_tx,
TestChainSource,
};

const RECEIVER_SEED_BYTES: [u8; 64] = [43; 64];
const CHANNEL_AMOUNT_SAT: u64 = 500_000;
const CLAIM_AMOUNT_MSAT: u64 = 100_000;
Expand Down