Skip to content

Commit 108b400

Browse files
committed
rpcserver: NewAddr endpoint: add early sanity check for local asset
Add a pre-check to ensure the asset is recognized locally before attempting the proof courier connection check. This prevents unnecessary operations on unknown assets and improves robustness.
1 parent 5e57802 commit 108b400

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rpcserver.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,6 +1662,12 @@ func (r *rpcServer) NewAddr(ctx context.Context,
16621662
err)
16631663
}
16641664

1665+
// Sanity check early to ensure that the asset is known.
1666+
_, err = r.cfg.AddrBook.QueryAssetInfo(ctx, specifier)
1667+
if err != nil {
1668+
return nil, fmt.Errorf("unable to find asset or group: %w", err)
1669+
}
1670+
16651671
err = r.checkBalanceOverflow(ctx, assetID, groupKey, req.Amt)
16661672
if err != nil {
16671673
return nil, err

0 commit comments

Comments
 (0)