You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add database query to fetch managed UTXOs containing only zero-value assets (tombstones/burns)
- Implement ZeroValueInput interface for accessing UTXO details
- Modify PSBT creation to include zero-value inputs with proper BIP32 derivation
- Update integration test to verify sweeping functionality
- Add sweeping logic to automatically include tombstone inputs in new on-chain transactions
Note: LND limitation prevents imported Taproot keys from being signed, so sweeping
requires LND changes to fully work.
Copy file name to clipboardExpand all lines: tapdb/sqlc/queries/assets.sql
+31Lines changed: 31 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -633,6 +633,37 @@ FROM managed_utxos utxos
633
633
JOIN internal_keys keys
634
634
ONutxos.internal_key_id=keys.key_id;
635
635
636
+
-- name: FetchZeroValueAnchorUTXOs :many
637
+
WITH zero_value_assets AS (
638
+
SELECT DISTINCT anchor_utxo_id
639
+
FROM assets a
640
+
JOIN script_keys sk ONa.script_key_id=sk.script_key_id
641
+
JOIN internal_keys ik ONsk.internal_key_id=ik.key_id
642
+
LEFT JOIN asset_witnesses aw ONa.asset_id=aw.asset_id
643
+
WHERE (
644
+
-- Tombstones: zero amount with NUMS key
645
+
(a.amount=0ANDik.raw_key='\x02\x7c\x79\xb9\xb2\x6e\x46\x38\x95\xee\xf5\x67\x9d\x85\x58\x94\x2c\x86\xc4\xad\x22\x33\xad\xef\x01\xbc\x3e\x6d\x54\x0b\x36\x53\xfe') OR
646
+
-- Burns: assets with burn witnesses
647
+
(aw.witness_idIS NOT NULLANDaw.witness_stackIS NOT NULL)
648
+
)
649
+
ANDa.spent= FALSE
650
+
),
651
+
anchor_asset_counts AS (
652
+
SELECT
653
+
anchor_utxo_id,
654
+
COUNT(*) as total_assets,
655
+
COUNT(CASE WHEN anchor_utxo_id IN (SELECT anchor_utxo_id FROM zero_value_assets) THEN 1 END) as zero_value_assets
0 commit comments