Skip to content

Commit 525d0e7

Browse files
committed
rpc: add logging to supply sync wrappers
1 parent 8d0cb56 commit 525d0e7

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

supplysync_rpc.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ func (r *RpcSupplySync) FetchSupplyCommit(ctx context.Context,
128128
return zero, fmt.Errorf("unable to unwrap group key: %w", err)
129129
}
130130

131+
srvrLog.Infof("[RpcSupplySync.FetchSupplyCommit]: fetching supply "+
132+
"commitment from remote server "+
133+
"(server_addr=%s, asset=%s, spent_outpoint=%v)",
134+
r.serverAddr.HostStr(), assetSpec.String(),
135+
spentCommitOutpoint.IsSome())
136+
131137
req := &unirpc.FetchSupplyCommitRequest{
132138
GroupKey: &unirpc.FetchSupplyCommitRequest_GroupKeyBytes{
133139
GroupKeyBytes: groupKey.SerializeCompressed(),
@@ -140,6 +146,8 @@ func (r *RpcSupplySync) FetchSupplyCommit(ctx context.Context,
140146
// If a spent commit outpoint is provided, use that to locate the next
141147
// supply commitment.
142148
spentCommitOutpoint.WhenSome(func(outpoint wire.OutPoint) {
149+
srvrLog.Debugf("Using spent commitment outpoint as locator: %s",
150+
outpoint.String())
143151
// nolint: lll
144152
req.Locator = &unirpc.FetchSupplyCommitRequest_SpentCommitOutpoint{
145153
SpentCommitOutpoint: &taprpc.OutPoint{
@@ -222,7 +230,7 @@ func (r *RpcSupplySync) FetchSupplyCommit(ctx context.Context,
222230
"root: %w", err)
223231
}
224232

225-
return supplycommit.FetchSupplyCommitResult{
233+
result := supplycommit.FetchSupplyCommitResult{
226234
RootCommitment: *rootCommitment,
227235
SupplyLeaves: *supplyLeaves,
228236
ChainProof: chainProof,
@@ -233,7 +241,15 @@ func (r *RpcSupplySync) FetchSupplyCommit(ctx context.Context,
233241
IgnoreSubtreeRoot: ignoreSubtreeRoot,
234242

235243
SpentCommitmentOutpoint: respSpentCommitOutpoint,
236-
}, nil
244+
}
245+
246+
srvrLog.Infof("[RpcSupplySync.FetchSupplyCommit]: succeeded in "+
247+
"fetching supply commitment "+
248+
"(server_addr=%s, asset=%s, supply_tree_root_hash=%x)",
249+
r.serverAddr.HostStr(), assetSpec.String(),
250+
rootCommitment.SupplyRoot.NodeHash())
251+
252+
return result, nil
237253
}
238254

239255
// Close closes the RPC connection to the universe server.

0 commit comments

Comments
 (0)