@@ -2125,7 +2125,7 @@ func fetchAssetTransferInputs(ctx context.Context, q ActiveAssetsStore,
21252125// and returns its ID.
21262126func insertAssetTransferOutput (ctx context.Context , q ActiveAssetsStore ,
21272127 transferID , txnID int64 , output tapfreighter.TransferOutput ,
2128- passiveAssets []* tapfreighter. PassiveAssetReAnchor ) error {
2128+ passiveAssets []* tappsbt. VPacket ) error {
21292129
21302130 anchor := output .Anchor
21312131 anchorPointBytes , err := encodeOutpoint (anchor .OutPoint )
@@ -2368,17 +2368,25 @@ func fetchAssetTransferOutputs(ctx context.Context, q ActiveAssetsStore,
23682368// logPendingPassiveAssets logs passive assets re-anchoring data to disk.
23692369func logPendingPassiveAssets (ctx context.Context ,
23702370 q ActiveAssetsStore , transferID , newUtxoID int64 ,
2371- passiveAssets []* tapfreighter. PassiveAssetReAnchor ) error {
2371+ passiveAssets []* tappsbt. VPacket ) error {
23722372
23732373 for idx := range passiveAssets {
2374+ passiveAsset := passiveAssets [idx ]
2375+ passiveIn := passiveAsset .Inputs [0 ]
2376+ passiveOut := passiveAsset .Outputs [0 ]
2377+ witnesses , err := passiveOut .PrevWitnesses ()
2378+ if err != nil {
2379+ return fmt .Errorf ("unable to extract prev witnesses: " +
2380+ "%w" , err )
2381+ }
2382+
23742383 // Encode new witness data.
23752384 var (
2376- passiveAsset = passiveAssets [idx ]
23772385 newWitnessBuf bytes.Buffer
23782386 buf [8 ]byte
23792387 )
2380- err : = asset .WitnessEncoder (
2381- & newWitnessBuf , & passiveAsset . NewWitnessData , & buf ,
2388+ err = asset .WitnessEncoder (
2389+ & newWitnessBuf , & witnesses , & buf ,
23822390 )
23832391 if err != nil {
23842392 return fmt .Errorf ("unable to encode witness: " +
@@ -2387,23 +2395,23 @@ func logPendingPassiveAssets(ctx context.Context,
23872395
23882396 // Encode new proof.
23892397 var newProofBuf bytes.Buffer
2390- err = passiveAsset . NewProof .Encode (& newProofBuf )
2398+ err = passiveOut . ProofSuffix .Encode (& newProofBuf )
23912399 if err != nil {
23922400 return fmt .Errorf ("unable to encode new passive " +
23932401 "asset proof: %w" , err )
23942402 }
23952403
23962404 // Encode previous anchor outpoint.
23972405 prevOutpointBytes , err := encodeOutpoint (
2398- passiveAsset . PrevAnchorPoint ,
2406+ passiveIn . PrevID . OutPoint ,
23992407 )
24002408 if err != nil {
24012409 return fmt .Errorf ("unable to encode prev outpoint: " +
24022410 "%w" , err )
24032411 }
24042412
24052413 // Encode script key.
2406- scriptKey := passiveAsset .ScriptKey
2414+ scriptKey := passiveOut .ScriptKey
24072415 scriptKeyBytes := scriptKey .PubKey .SerializeCompressed ()
24082416
24092417 err = q .InsertPassiveAsset (
@@ -2414,8 +2422,8 @@ func logPendingPassiveAssets(ctx context.Context,
24142422 NewProof : newProofBuf .Bytes (),
24152423 PrevOutpoint : prevOutpointBytes ,
24162424 ScriptKey : scriptKeyBytes ,
2417- AssetGenesisID : passiveAsset . GenesisID [:],
2418- AssetVersion : int32 (passiveAsset .AssetVersion ),
2425+ AssetGenesisID : passiveIn . PrevID . ID [:],
2426+ AssetVersion : int32 (passiveOut .AssetVersion ),
24192427 },
24202428 )
24212429 if err != nil {
0 commit comments