@@ -1102,17 +1102,13 @@ func (r *rpcServer) ListAssets(ctx context.Context,
11021102 }
11031103
11041104 if req .AnchorOutpoint != nil {
1105- txid , err := chainhash . NewHash (req .AnchorOutpoint . Txid )
1105+ op , err := rpcutils . UnmarshalOutPoint (req .AnchorOutpoint )
11061106 if err != nil {
1107- return nil , fmt .Errorf ("error parsing outpoint: %w" ,
1107+ return nil , fmt .Errorf ("unmarshalling outpoint: %w" ,
11081108 err )
11091109 }
1110- outPoint := & wire.OutPoint {
1111- Hash : * txid ,
1112- Index : req .AnchorOutpoint .OutputIndex ,
1113- }
11141110
1115- filters .AnchorPoint = outPoint
1111+ filters .AnchorPoint = & op
11161112 }
11171113
11181114 scriptKeyType , includeSpent , err := rpcutils .ParseScriptKeyTypeQuery (
@@ -2059,15 +2055,13 @@ func (r *rpcServer) ExportProof(ctx context.Context,
20592055 // error will be returned and the outpoint needs to be specified to
20602056 // disambiguate.
20612057 if req .Outpoint != nil {
2062- txid , err := chainhash . NewHash (req .Outpoint . Txid )
2058+ op , err := rpcutils . UnmarshalOutPoint (req .Outpoint )
20632059 if err != nil {
2064- return nil , fmt .Errorf ("error parsing outpoint: %w" ,
2060+ return nil , fmt .Errorf ("unmarshalling outpoint: %w" ,
20652061 err )
20662062 }
2067- outPoint = & wire.OutPoint {
2068- Hash : * txid ,
2069- Index : req .Outpoint .OutputIndex ,
2070- }
2063+
2064+ outPoint = & op
20712065 }
20722066
20732067 proofBlob , err := r .cfg .ProofArchive .FetchProof (ctx , proof.Locator {
@@ -2260,14 +2254,19 @@ func (r *rpcServer) FundVirtualPsbt(ctx context.Context,
22602254 )
22612255 for i , input := range raw .Inputs {
22622256 if input .Outpoint == nil {
2257+ // Return an error message which specifically
2258+ // refers to the index which has a corresponding
2259+ // nil outpoint.
22632260 return nil , fmt .Errorf ("input at index %d has " +
22642261 "a nil Outpoint" , i )
22652262 }
22662263
2267- hash , err := chainhash .NewHash (input .Outpoint .Txid )
2264+ outPoint , err := rpcutils .UnmarshalOutPoint (
2265+ input .Outpoint ,
2266+ )
22682267 if err != nil {
2269- return nil , fmt .Errorf ("input at index %d has " +
2270- "invalid Txid : %w" , i , err )
2268+ return nil , fmt .Errorf ("unmarshalling " +
2269+ "outpoint : %w" , err )
22712270 }
22722271
22732272 scriptKey , err := parseUserKey (input .ScriptKey )
@@ -2283,12 +2282,8 @@ func (r *rpcServer) FundVirtualPsbt(ctx context.Context,
22832282 }
22842283
22852284 // Decode the input into an asset.PrevID.
2286- outpoint := wire.OutPoint {
2287- Hash : * hash ,
2288- Index : input .Outpoint .OutputIndex ,
2289- }
22902285 prevID := asset.PrevID {
2291- OutPoint : outpoint ,
2286+ OutPoint : outPoint ,
22922287 ID : asset .ID (input .Id ),
22932288 ScriptKey : asset .ToSerialized (
22942289 scriptKey ,
@@ -2975,15 +2970,13 @@ func (r *rpcServer) PublishAndLogTransfer(ctx context.Context,
29752970 FinalTx : finalTx ,
29762971 }
29772972 for idx , lndOutpoint := range req .LndLockedUtxos {
2978- hash , err := chainhash . NewHash (lndOutpoint . Txid )
2973+ op , err := rpcutils . UnmarshalOutPoint (lndOutpoint )
29792974 if err != nil {
2980- return nil , fmt .Errorf ("error parsing txid: %w" , err )
2975+ return nil , fmt .Errorf ("unmarshalling outpoint: %w" ,
2976+ err )
29812977 }
29822978
2983- anchorTx .FundedPsbt .LockedUTXOs [idx ] = wire.OutPoint {
2984- Hash : * hash ,
2985- Index : lndOutpoint .OutputIndex ,
2986- }
2979+ anchorTx .FundedPsbt .LockedUTXOs [idx ] = op
29872980 }
29882981
29892982 // We now have everything to ship the pre-anchored parcel using the
@@ -5417,7 +5410,7 @@ func (r *rpcServer) AssetLeaves(ctx context.Context,
54175410 return nil , err
54185411 }
54195412
5420- assetLeaves , err := r .cfg .UniverseArchive .MintingLeaves (ctx , universeID )
5413+ assetLeaves , err := r .cfg .UniverseArchive .FetchLeaves (ctx , universeID )
54215414 if err != nil {
54225415 return nil , err
54235416 }
@@ -6310,15 +6303,13 @@ func (r *rpcServer) ProveAssetOwnership(ctx context.Context,
63106303 // error will be returned and the outpoint needs to be specified to
63116304 // disambiguate.
63126305 if req .Outpoint != nil {
6313- txid , err := chainhash . NewHash (req .Outpoint . Txid )
6306+ op , err := rpcutils . UnmarshalOutPoint (req .Outpoint )
63146307 if err != nil {
6315- return nil , fmt .Errorf ("error parsing outpoint: %w" ,
6308+ return nil , fmt .Errorf ("unmarshalling outpoint: %w" ,
63166309 err )
63176310 }
6318- outPoint = & wire.OutPoint {
6319- Hash : * txid ,
6320- Index : req .Outpoint .OutputIndex ,
6321- }
6311+
6312+ outPoint = & op
63226313 }
63236314
63246315 proofBlob , err := r .cfg .ProofArchive .FetchProof (ctx , proof.Locator {
@@ -6605,18 +6596,9 @@ func (r *rpcServer) RemoveUTXOLease(ctx context.Context,
66056596 req * wrpc.RemoveUTXOLeaseRequest ) (* wrpc.RemoveUTXOLeaseResponse ,
66066597 error ) {
66076598
6608- if req .Outpoint == nil {
6609- return nil , fmt .Errorf ("outpoint must be specified" )
6610- }
6611-
6612- hash , err := chainhash .NewHash (req .Outpoint .Txid )
6599+ outPoint , err := rpcutils .UnmarshalOutPoint (req .Outpoint )
66136600 if err != nil {
6614- return nil , fmt .Errorf ("error parsing txid: %w" , err )
6615- }
6616-
6617- outPoint := wire.OutPoint {
6618- Hash : * hash ,
6619- Index : req .Outpoint .OutputIndex ,
6601+ return nil , fmt .Errorf ("unmarshaling outpoint: %w" , err )
66206602 }
66216603
66226604 err = r .cfg .CoinSelect .ReleaseCoins (ctx , outPoint )
@@ -8898,15 +8880,13 @@ func (r *rpcServer) RegisterTransfer(ctx context.Context,
88988880 }
88998881 locator .ScriptKey = * scriptPubKey
89008882
8901- hash , err := chainhash . NewHash (req .Outpoint . Txid )
8883+ op , err := rpcutils . UnmarshalOutPoint (req .Outpoint )
89028884 if err != nil {
8903- return nil , err
8904- }
8905- locator .OutPoint = & wire.OutPoint {
8906- Hash : * hash ,
8907- Index : req .Outpoint .OutputIndex ,
8885+ return nil , fmt .Errorf ("unmarshalling outpoint: %w" , err )
89088886 }
89098887
8888+ locator .OutPoint = & op
8889+
89108890 // Before we query for the proof, we want to make sure the script key is
89118891 // already known to us. In an interactive transfer, we'd expect a script
89128892 // key to be derived on the recipient node, so it should already be
0 commit comments