Skip to content

Commit 6f6b70f

Browse files
committed
taprpc+rpc: add Swept field to ManagedUTXO type
1 parent 3542114 commit 6f6b70f

File tree

4 files changed

+890
-861
lines changed

4 files changed

+890
-861
lines changed

rpcserver.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,7 @@ func (r *rpcServer) ListUtxos(ctx context.Context,
14031403
MerkleRoot: u.MerkleRoot,
14041404
LeaseOwner: u.LeaseOwner[:],
14051405
LeaseExpiryUnix: u.LeaseExpiry.Unix(),
1406+
Swept: u.Swept,
14061407
}
14071408
}
14081409

@@ -2620,8 +2621,17 @@ func (r *rpcServer) AnchorVirtualPsbts(ctx context.Context,
26202621
prevID.OutPoint.String())
26212622
}
26222623

2624+
// Fetch zero-value UTXOs that should be swept as additional inputs.
2625+
zeroValueInputs, err := r.cfg.AssetStore.FetchZeroValueAnchorUTXOs(ctx)
2626+
if err != nil {
2627+
return nil, fmt.Errorf("unable to fetch zero-value "+
2628+
"UTXOs: %w", err)
2629+
}
2630+
26232631
resp, err := r.cfg.ChainPorter.RequestShipment(
2624-
tapfreighter.NewPreSignedParcel(vPackets, inputCommitments, ""),
2632+
tapfreighter.NewPreSignedParcel(
2633+
vPackets, inputCommitments, zeroValueInputs, "",
2634+
),
26252635
)
26262636
if err != nil {
26272637
return nil, fmt.Errorf("error requesting delivery: %w", err)
@@ -3734,7 +3744,8 @@ func (r *rpcServer) BurnAsset(ctx context.Context,
37343744

37353745
resp, err := r.cfg.ChainPorter.RequestShipment(
37363746
tapfreighter.NewPreSignedParcel(
3737-
fundResp.VPackets, fundResp.InputCommitments, in.Note,
3747+
fundResp.VPackets, fundResp.InputCommitments,
3748+
fundResp.ZeroValueInputs, in.Note,
37383749
),
37393750
)
37403751
if err != nil {

0 commit comments

Comments
 (0)