Skip to content

Commit e3144a9

Browse files
committed
tapgarden: only receive confirmed proof, improve logging
This commit is a small optimization in that we only start watching for a proof on startup if we did receive a confirmation for it.
1 parent 4f48ba1 commit e3144a9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

tapgarden/custodian.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,14 @@ func (c *Custodian) watchInboundAssets() {
284284
continue
285285
}
286286

287+
// If this event is not yet confirmed, we don't yet expect a
288+
// proof to be delivered. We'll wait for the confirmation to
289+
// come in, and then we'll launch a goroutine to use the
290+
// ProofCourier to import the proof into our local DB.
291+
if event.ConfirmationHeight == 0 {
292+
continue
293+
}
294+
287295
// If we didn't find a proof, we'll launch a goroutine to use
288296
// the ProofCourier to import the proof into our local DB.
289297
c.Wg.Add(1)
@@ -530,7 +538,8 @@ func (c *Custodian) receiveProof(addr *address.Tap, op wire.OutPoint) error {
530538
ctx, headerVerifier, c.cfg.GroupVerifier, false, addrProof,
531539
)
532540
if err != nil {
533-
return fmt.Errorf("unable to import proofs: %w", err)
541+
return fmt.Errorf("unable to import proofs script_key=%x, "+
542+
"asset_id=%x: %w", scriptKeyBytes, assetID[:], err)
534543
}
535544

536545
// The proof is now verified and in our local archive. We will now

tapgarden/planter_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import (
1111
"testing"
1212
"time"
1313

14-
"github.com/lightninglabs/taproot-assets/tapsend"
15-
1614
"github.com/btcsuite/btcd/blockchain"
1715
"github.com/btcsuite/btcd/btcec/v2"
1816
"github.com/btcsuite/btcd/btcutil"
@@ -30,6 +28,7 @@ import (
3028
_ "github.com/lightninglabs/taproot-assets/tapdb" // Register relevant drivers.
3129
"github.com/lightninglabs/taproot-assets/tapgarden"
3230
"github.com/lightninglabs/taproot-assets/tapscript"
31+
"github.com/lightninglabs/taproot-assets/tapsend"
3332
"github.com/lightningnetwork/lnd/build"
3433
"github.com/lightningnetwork/lnd/keychain"
3534
"github.com/lightningnetwork/lnd/lntest/wait"

0 commit comments

Comments
 (0)