Skip to content

Commit 40031dc

Browse files
committed
rpcserver+address: improve logging when generating new tap address
Include the proof courier address in logs when generating a new tap address. Add a trace-level log for the raw request to aid in debugging. Also fix a stale comment in the related documentation.
1 parent 60aac1f commit 40031dc

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

address/book.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ func (b *Book) NewAddress(ctx context.Context, addrVersion Version,
535535
error) {
536536

537537
// Before we proceed and make new keys, make sure that we actually know
538-
// of this asset ID, or can import it.
538+
// of this asset, or can import it.
539539
if _, err := b.QueryAssetInfo(ctx, specifier); err != nil {
540540
return nil, fmt.Errorf("unable to make address for unknown "+
541541
"asset %s: %w", &specifier, err)

rpcserver.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,8 @@ func (r *rpcServer) QueryAddrs(ctx context.Context,
16261626
func (r *rpcServer) NewAddr(ctx context.Context,
16271627
req *taprpc.NewAddrRequest) (*taprpc.Addr, error) {
16281628

1629+
rpcsLog.TraceS(ctx, "[NewAddr]: Called", "req", spew.Sdump(req))
1630+
16291631
// Parse the proof courier address if one was provided, otherwise use
16301632
// the default specified in the config.
16311633
courierAddr := r.cfg.DefaultProofCourierAddr
@@ -1660,9 +1662,6 @@ func (r *rpcServer) NewAddr(ctx context.Context,
16601662
err)
16611663
}
16621664

1663-
rpcsLog.Infof("[NewAddr]: making new addr: specifier=%s, amt=%v",
1664-
&specifier, req.Amt)
1665-
16661665
err = r.checkBalanceOverflow(ctx, assetID, groupKey, req.Amt)
16671666
if err != nil {
16681667
return nil, err
@@ -1695,6 +1694,10 @@ func (r *rpcServer) NewAddr(ctx context.Context,
16951694
addrVersion = address.V2
16961695
}
16971696

1697+
rpcsLog.Infof("[NewAddr]: Making new addr: specifier=%s, amt=%v, "+
1698+
"courier=%v, addr_version=%v, asset_version=%v", &specifier,
1699+
req.Amt, courierAddr, addrVersion, assetVersion)
1700+
16981701
// Addresses with version 2 must use the new authmailbox proof courier
16991702
// type.
17001703
protocol := courierAddr.Scheme
@@ -1790,8 +1793,8 @@ func (r *rpcServer) NewAddr(ctx context.Context,
17901793
address.WithAssetVersion(assetVersion),
17911794
)
17921795
if err != nil {
1793-
return nil, fmt.Errorf("unable to make new addr: %w",
1794-
err)
1796+
return nil, fmt.Errorf("unable to make new addr with "+
1797+
"keys: %w", err)
17951798
}
17961799
}
17971800

0 commit comments

Comments
 (0)