Skip to content

Commit 95af368

Browse files
authored
Merge pull request #1498 from lightninglabs/docs-cleanup
misc: fix litcli command docs, add group key support to DecodeAssetPayReq
2 parents 97819b6 + 311ddbe commit 95af368

File tree

15 files changed

+405
-135
lines changed

15 files changed

+405
-135
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ jobs:
375375
working-directory: ./lightning-terminal
376376
run: |
377377
go mod edit -replace=github.com/lightninglabs/taproot-assets=../
378+
go mod edit -replace=github.com/lightninglabs/taproot-assets/taprpc=../taprpc
378379
go mod tidy
379380
380381
- name: Install yarn

address/book.go

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ type QueryParams struct {
8282
// known to universe servers in our federation.
8383
type AssetSyncer interface {
8484
// SyncAssetInfo queries the universes in our federation for genesis
85-
// and asset group information about the given asset ID.
86-
SyncAssetInfo(ctx context.Context, assetID *asset.ID) error
85+
// and asset group information about the given asset.
86+
SyncAssetInfo(ctx context.Context, specifier asset.Specifier) error
8787

8888
// EnableAssetSync updates the sync config for the given asset so that
8989
// we sync future issuance proofs.
@@ -232,7 +232,7 @@ func (b *Book) QueryAssetInfo(ctx context.Context,
232232
log.Debugf("Asset %v is unknown, attempting to bootstrap", id.String())
233233

234234
// Use the AssetSyncer to query our universe federation for the asset.
235-
err = b.cfg.Syncer.SyncAssetInfo(ctx, &id)
235+
err = b.cfg.Syncer.SyncAssetInfo(ctx, asset.NewSpecifierFromId(id))
236236
if err != nil {
237237
return nil, err
238238
}
@@ -264,6 +264,27 @@ func (b *Book) QueryAssetInfo(ctx context.Context,
264264
return assetGroup, nil
265265
}
266266

267+
// SyncAssetGroup attempts to enable asset sync for the given asset group, then
268+
// perform an initial sync with the federation for that group.
269+
func (b *Book) SyncAssetGroup(ctx context.Context,
270+
groupKey btcec.PublicKey) error {
271+
272+
groupInfo := &asset.AssetGroup{
273+
GroupKey: &asset.GroupKey{
274+
GroupPubKey: groupKey,
275+
},
276+
}
277+
err := b.cfg.Syncer.EnableAssetSync(ctx, groupInfo)
278+
if err != nil {
279+
return fmt.Errorf("unable to enable asset sync: %w", err)
280+
}
281+
282+
// Use the AssetSyncer to query our universe federation for the asset.
283+
return b.cfg.Syncer.SyncAssetInfo(
284+
ctx, asset.NewSpecifierFromGroupKey(groupKey),
285+
)
286+
}
287+
267288
// FetchAssetMetaByHash attempts to fetch an asset meta based on an asset hash.
268289
func (b *Book) FetchAssetMetaByHash(ctx context.Context,
269290
metaHash [asset.MetaHashLen]byte) (*proof.MetaReveal, error) {
@@ -296,7 +317,7 @@ func (b *Book) FetchAssetMetaForAsset(ctx context.Context,
296317
assetID.String())
297318

298319
// Use the AssetSyncer to query our universe federation for the asset.
299-
err = b.cfg.Syncer.SyncAssetInfo(ctx, &assetID)
320+
err = b.cfg.Syncer.SyncAssetInfo(ctx, asset.NewSpecifierFromId(assetID))
300321
if err != nil {
301322
return nil, err
302323
}

itest/channels_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ func testChannelRPCs(t *harnessTest) {
6161
require.NoError(t.t, err)
6262

6363
_, err = stream.Recv()
64-
require.ErrorContains(t.t, err, "invalid vertex length of 0, want 33")
64+
require.ErrorContains(
65+
t.t, err, "destination node must be specified for keysend "+
66+
"payment",
67+
)
6568

6669
// Now let's also try the invoice path, which should fail because we
6770
// don't have any asset channels with peers that we could ask for a

rfq/manager.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ func (m *Manager) addScidAlias(scidAlias uint64, assetSpecifier asset.Specifier,
579579
continue
580580
}
581581

582-
match, err := m.ChannelCompatible(
582+
match, err := m.ChannelMatchesFully(
583583
ctxb, assetData, assetSpecifier,
584584
)
585585
if err != nil {
@@ -1019,11 +1019,11 @@ func (m *Manager) GetPriceDeviationPpm() uint64 {
10191019
return m.cfg.AcceptPriceDeviationPpm
10201020
}
10211021

1022-
// ChannelCompatible checks a channel's assets against an asset specifier. If
1023-
// the specifier is an asset ID, then all assets must be of that specific ID,
1024-
// if the specifier is a group key, then all assets in the channel must belong
1025-
// to that group.
1026-
func (m *Manager) ChannelCompatible(ctx context.Context,
1022+
// ChannelMatchesFully checks a channel's assets against an asset specifier. If
1023+
// the specifier is an asset ID, then all asset UTXOs must be of that specific
1024+
// ID, if the specifier is a group key, then all assets in the channel must
1025+
// belong to that group.
1026+
func (m *Manager) ChannelMatchesFully(ctx context.Context,
10271027
jsonChannel rfqmsg.JsonAssetChannel, specifier asset.Specifier) (bool,
10281028
error) {
10291029

0 commit comments

Comments
 (0)