Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
40f7f34
lint code with rust 1.97.0
zoedberg Jul 15, 2026
2cafc7d
pin rgb-lib to exact version
zoedberg Jul 17, 2026
2a5b63c
consignment/media for LN ops via p2p
zoedberg Jun 23, 2026
c675550
TransferInfo: track output_map instead of rgb_amount
zoedberg Jul 21, 2026
e0e7aab
write rgb_payment for pending HTLCs to match deserialization
dcorral Jul 24, 2026
dd15b53
Reject out-of-range push_asset_amount in handle_funding
0xaudron Jul 28, 2026
6688416
use rgb-lib electrum/esplora features
zoedberg Aug 4, 2026
e2a0b8e
fix(electrum): do not pick unindexed outputs for history lookup
zoedberg Aug 7, 2026
fcb14c3
Merge RGB-Tools rgb through 2a5b63cb0 (consignment/media for LN ops v…
dcorral Aug 19, 2026
38654ef
Merge RGB-Tools rgb through e0e7aabe5 (TransferInfo output_map, rgb_p…
dcorral Aug 19, 2026
2fd1269
Merge RGB-Tools rgb through dd15b5385 (reject out-of-range push_asset…
dcorral Aug 19, 2026
c6b5f9b
point rgb-lib at the upstream sync branch
dcorral Aug 19, 2026
c162f01
Merge RGB-Tools rgb through e2a0b8e24 (electrum unindexed-output fix)
dcorral Aug 20, 2026
621eb24
refuse to read pre-sync colored channels after TLV format change
dcorral Aug 24, 2026
25ef6c1
validate RGB funding consignment before persisting media
dcorral Aug 24, 2026
861fe76
drop inert serde(default) on RgbInfo counterparty_knows_asset
dcorral Aug 24, 2026
14e143e
bump rgb-lib pin to include the consignment replay fixes
dcorral Aug 24, 2026
78efbe4
flip rgb-lib pin to the released UTEXO tag v0.3.0-beta.34
dcorral Aug 25, 2026
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: echo "RUSTFLAGS=-C linker=rust-lld" >> "$GITHUB_ENV"
- name: Build the workspace
shell: bash # Default on Winblows is powershell
run: cargo check --workspace --verbose --color always
run: cargo check --workspace --features lightning/electrum --verbose --color always

linting:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion ci/check-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ CLIPPY() {
-A clippy::useless-borrows-in-formatting
}

CLIPPY
CLIPPY "--features lightning/electrum"
5 changes: 1 addition & 4 deletions lightning-invoice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ serde = { version = "1.0", optional = true, default-features = false, features =
bitcoin = { version = "0.32.2", default-features = false, features = ["secp-recovery"] }

# RGB and related
rgb-lib = { git = "https://github.com/UTEXO-Protocol/rgb-lib.git", tag = "v0.3.0-beta.32", features = [
"electrum",
"esplora",
] }
rgb-lib = { git = "https://github.com/UTEXO-Protocol/rgb-lib.git", tag = "v0.3.0-beta.34", default-features = false }

[dev-dependencies]
serde_json = { version = "1"}
Expand Down
68 changes: 50 additions & 18 deletions lightning-transaction-sync/src/electrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ use lightning::util::logger::Logger;
use lightning::{log_debug, log_error, log_trace};

use bitcoin::block::Header;
use bitcoin::opcodes::all::OP_RETURN;
use bitcoin::opcodes::OP_FALSE;
use bitcoin::{BlockHash, Script, Transaction, Txid};

use std::collections::HashSet;
Expand Down Expand Up @@ -289,26 +291,56 @@ where
continue;
}

watched_txs.push((txid, tx.clone()));
// We watch an output of the transaction of interest in order to retrieve the
// associated script history, before narrowing down our search through
// `filter`ing by `txid` below. We skip OP_RETURN outputs as Electrum servers
// don't index provably-unspendable scripts (e.g. the RGB commitment at vout 0
// of a colored funding tx), so their history is empty and the tx would never
// be seen as confirmed. We fall back to the first output to keep this lookup
// aligned with `watched_txs`.
let script_pubkey = tx
// We watch an arbitrary output of the transaction of interest in order to
// retrieve the associated script history, before narrowing down our search
// through `filter`ing by `txid` below. Electrum servers don't index
// provably-unspendable outputs (e.g. the RGB commitment at vout 0 of a
// colored funding tx), so picking one of those would always yield an empty
// history and the tx would never be seen as confirmed.
let mut spk = tx
.output
.iter()
.find(|o| !o.script_pubkey.is_op_return())
.or_else(|| tx.output.first())
.map(|o| o.script_pubkey.clone());
if let Some(script_pubkey) = script_pubkey {
watched_script_pubkeys.push(script_pubkey);
} else {
debug_assert!(false, "Failed due to retrieving invalid tx data.");
log_error!(self.logger, "Failed due to retrieving invalid tx data.");
return Err(InternalError::Failed);
.find(|txo| {
!txo.script_pubkey.is_op_return()
&& !txo
.script_pubkey
.as_bytes()
.starts_with(&[OP_FALSE.to_u8(), OP_RETURN.to_u8()])
})
.map(|txo| txo.script_pubkey.clone());

// Fall back to the script of an input's previous output: its history includes
// this transaction, as we spend from it.
if spk.is_none() && !tx.is_coinbase() {
for txin in &tx.input {
match self.client.transaction_get(&txin.previous_output.txid) {
Ok(parent) => {
if let Some(prev_out) =
parent.output.get(txin.previous_output.vout as usize)
{
spk = Some(prev_out.script_pubkey.clone());
break;
}
},
Err(electrum_client::Error::Protocol(_)) => continue,
Err(e) => {
log_error!(
self.logger,
"Failed to look up transaction {}: {}.",
txin.previous_output.txid,
e
);
return Err(InternalError::Failed);
},
}
}
}

// Nothing we could query a history for, e.g. a coinbase whose outputs are all
// unindexed. Skip it rather than failing the whole sync.
if let Some(spk) = spk {
watched_txs.push((txid, tx.clone()));
watched_script_pubkeys.push(spk);
}
},
Err(electrum_client::Error::Protocol(_)) => {
Expand Down
8 changes: 4 additions & 4 deletions lightning/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ std = []

dnssec = ["dnssec-prover/validation"]

electrum = ["rgb-lib/electrum"]
esplora = ["rgb-lib/esplora"]

# Generates low-r bitcoin signatures, which saves 1 byte in 50% of the cases
grind_signatures = []

Expand Down Expand Up @@ -56,10 +59,7 @@ amplify = "4.8"
bincode = "1.3"
rgb-strict-encoding = "1.0.1"
futures = "0.3"
rgb-lib = { git = "https://github.com/UTEXO-Protocol/rgb-lib.git", tag = "v0.3.0-beta.32", features = [
"electrum",
"esplora",
] }
rgb-lib = { git = "https://github.com/UTEXO-Protocol/rgb-lib.git", tag = "v0.3.0-beta.34", default-features = false }
serde = { version = "^1.0", features = [
"derive",
] }
Expand Down
Loading
Loading