Skip to content

Commit

Permalink
Merge tag 'v0.4.2' into feat/alby-ldk-0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Nov 2, 2024
2 parents d4a2f2c + 2156611 commit b4dfcea
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 11 deletions.
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# 0.4.2 - Oct 28, 2024

This patch release fixes an issue that prohibited the node from using available confirmed on-chain funds to spend/bump Anchor outputs (#387).

In total, this release features 1 files changed, 40 insertions, 4 deletions in 3 commits from 3 authors, in alphabetical order:

- Fuyin
- Elias Rohrer


# 0.4.1 - Oct 18, 2024

Fixes a wallet syncing issue where full syncs were used instead of incremental syncs, and vice versa (#383).
This patch release fixes a wallet syncing issue where full syncs were used instead of incremental syncs, and vice versa (#383).

In total, this release features 3 files changed, 13 insertions, 9 deletions in 6 commits from 3 authors, in alphabetical order:

- Jeffrey Czyz
- Elias Rohrer
- Tommy Volk

# 0.4.0 - Oct 17, 2024

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ldk-node"
version = "0.4.1"
version = "0.4.2"
authors = ["Elias Rohrer <[email protected]>"]
homepage = "https://lightningdevkit.org/"
license = "MIT OR Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import PackageDescription

let tag = "v0.4.0"
let checksum = "5dcdfdd6e3331062d649786fa6e758487227f6037d9881353fe0c293a3a4c7e0"
let tag = "v0.4.2"
let checksum = "95ea5307eb3a99203e39cfa21d962bfe3e879e62429e8c7cdf5292cae5dc35cc"
let url = "https://github.com/lightningdevkit/ldk-node/releases/download/\(tag)/LDKNodeFFI.xcframework.zip"

let package = Package(
Expand Down
2 changes: 1 addition & 1 deletion bindings/kotlin/ldk-node-android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official
libraryVersion=0.4.0
libraryVersion=0.4.2
2 changes: 1 addition & 1 deletion bindings/kotlin/ldk-node-jvm/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx1536m
kotlin.code.style=official
libraryVersion=0.4.0
libraryVersion=0.4.2
2 changes: 1 addition & 1 deletion bindings/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "ldk_node"
version = "0.4.0"
version = "0.4.2"
authors = [
{ name="Elias Rohrer", email="[email protected]" },
]
Expand Down
44 changes: 40 additions & 4 deletions src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ where
) -> Result<(u64, u64), Error> {
let balance = self.inner.lock().unwrap().balance();

// Make sure `list_confirmed_utxos` returns at least one `Utxo` we could use to spend/bump
// Anchors if we have any confirmed amounts.
#[cfg(debug_assertions)]
if balance.confirmed != Amount::ZERO {
debug_assert!(
self.list_confirmed_utxos().map_or(false, |v| !v.is_empty()),
"Confirmed amounts should always be available for Anchor spending"
);
}

let (total, spendable) = (
balance.total().to_sat(),
balance.trusted_spendable().to_sat().saturating_sub(total_anchor_channels_reserve_sats),
Expand Down Expand Up @@ -387,8 +397,21 @@ where
let script_pubkey = u.txout.script_pubkey;
match script_pubkey.witness_version() {
Some(version @ WitnessVersion::V0) => {
let witness_program = WitnessProgram::new(version, script_pubkey.as_bytes())
.map_err(|e| {
// According to the SegWit rules of [BIP 141] a witness program is defined as:
// > A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of
// > a 1-byte push opcode (one of OP_0,OP_1,OP_2,.. .,OP_16) followed by a direct
// > data push between 2 and 40 bytes gets a new special meaning. The value of
// > the first push is called the "version byte". The following byte vector
// > pushed is called the "witness program"."
//
// We therefore skip the first byte we just read via `witness_version` and use
// the rest (i.e., the data push) as the raw bytes to construct the
// `WitnessProgram` below.
//
// [BIP 141]: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#witness-program
let witness_bytes = &script_pubkey.as_bytes()[2..];
let witness_program =
WitnessProgram::new(version, witness_bytes).map_err(|e| {
log_error!(self.logger, "Failed to retrieve script payload: {}", e);
})?;

Expand All @@ -400,8 +423,21 @@ where
utxos.push(utxo);
},
Some(version @ WitnessVersion::V1) => {
let witness_program = WitnessProgram::new(version, script_pubkey.as_bytes())
.map_err(|e| {
// According to the SegWit rules of [BIP 141] a witness program is defined as:
// > A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of
// > a 1-byte push opcode (one of OP_0,OP_1,OP_2,.. .,OP_16) followed by a direct
// > data push between 2 and 40 bytes gets a new special meaning. The value of
// > the first push is called the "version byte". The following byte vector
// > pushed is called the "witness program"."
//
// We therefore skip the first byte we just read via `witness_version` and use
// the rest (i.e., the data push) as the raw bytes to construct the
// `WitnessProgram` below.
//
// [BIP 141]: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#witness-program
let witness_bytes = &script_pubkey.as_bytes()[2..];
let witness_program =
WitnessProgram::new(version, witness_bytes).map_err(|e| {
log_error!(self.logger, "Failed to retrieve script payload: {}", e);
})?;

Expand Down

0 comments on commit b4dfcea

Please sign in to comment.