@@ -1747,30 +1747,28 @@ func (r *rpcServer) AnchorVirtualPsbts(ctx context.Context,
17471747 return nil , fmt .Errorf ("error decoding packet: %w" , err )
17481748 }
17491749
1750- if len (vPacket .Inputs ) != 1 {
1751- return nil , fmt .Errorf ("only one input is currently supported" )
1752- }
1750+ // Query the asset store to gather tap commitments for all inputs.
1751+ inputCommitments := make (tappsbt.InputCommitments , len (vPacket .Inputs ))
1752+ for idx := range vPacket .Inputs {
1753+ input := vPacket .Inputs [idx ]
17531754
1754- inputAsset := vPacket .Inputs [0 ].Asset ()
1755- prevID := vPacket .Inputs [0 ].PrevID
1756- inputCommitment , err := r .cfg .AssetStore .FetchCommitment (
1757- ctx , inputAsset .ID (), prevID .OutPoint , inputAsset .GroupKey ,
1758- & inputAsset .ScriptKey , true ,
1759- )
1760- if err != nil {
1761- return nil , fmt .Errorf ("error fetching input commitment: %w" ,
1762- err )
1763- }
1755+ inputAsset := input .Asset ()
1756+ prevID := input .PrevID
1757+
1758+ inputCommitment , err := r .cfg .AssetStore .FetchCommitment (
1759+ ctx , inputAsset .ID (), prevID .OutPoint ,
1760+ inputAsset .GroupKey , & inputAsset .ScriptKey , true ,
1761+ )
1762+ if err != nil {
1763+ return nil , fmt .Errorf ("error fetching input " +
1764+ "commitment: %w" , err )
1765+ }
17641766
1765- rpcsLog . Debugf ( "Selected commitment for anchor point %v, requesting " +
1766- "delivery" , inputCommitment . AnchorPoint )
1767+ inputCommitments [ idx ] = inputCommitment . Commitment
1768+ }
17671769
17681770 resp , err := r .cfg .ChainPorter .RequestShipment (
1769- tapfreighter .NewPreSignedParcel (
1770- vPacket , tappsbt.InputCommitments {
1771- 0 : inputCommitment .Commitment ,
1772- },
1773- ),
1771+ tapfreighter .NewPreSignedParcel (vPacket , inputCommitments ),
17741772 )
17751773 if err != nil {
17761774 return nil , fmt .Errorf ("error requesting delivery: %w" , err )
0 commit comments