Skip to content

Commit c19e61d

Browse files
gijswijsffranr
authored andcommitted
multi: add label to PublishTransaction
1 parent d9dd3c0 commit c19e61d

File tree

8 files changed

+21
-8
lines changed

8 files changed

+21
-8
lines changed

chain_bridge.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,8 @@ func (l *LndRpcChainBridge) GetBlockTimestamp(ctx context.Context,
227227
// PublishTransaction attempts to publish a new transaction to the
228228
// network.
229229
func (l *LndRpcChainBridge) PublishTransaction(ctx context.Context,
230-
tx *wire.MsgTx) error {
230+
tx *wire.MsgTx, label string) error {
231231

232-
label := "tapd-asset-minting"
233232
return l.lnd.WalletKit.PublishTransaction(ctx, tx, label)
234233
}
235234

itest/utils.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ func ManualMintSimpleAsset(t *harnessTest, lndNode *node.HarnessNode,
698698
// can build the issuance proofs.
699699
genesisTxHash := signedTx.TxHash()
700700
err = lndServices.WalletKit.PublishTransaction(
701-
ctxt, signedTx, "tapd-asset-minting",
701+
ctxt, signedTx, tapgarden.IssuanceTxLabel,
702702
)
703703
require.NoError(t.t, err)
704704

tapchannel/aux_funding_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ type PsbtChannelFunder interface {
181181
type TxPublisher interface {
182182
// PublishTransaction attempts to publish a new transaction to the
183183
// network.
184-
PublishTransaction(context.Context, *wire.MsgTx) error
184+
PublishTransaction(context.Context, *wire.MsgTx, string) error
185185
}
186186

187187
// AssetSyncer is used to ensure that we know of the set of assets that'll be

tapfreighter/chain_porter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1521,7 +1521,7 @@ func (p *ChainPorter) stateStep(currentPkg sendPackage) (*sendPackage, error) {
15211521
// With the public key imported, we can now broadcast to the
15221522
// network.
15231523
err = p.cfg.ChainBridge.PublishTransaction(
1524-
ctx, currentPkg.OutboundPkg.AnchorTx,
1524+
ctx, currentPkg.OutboundPkg.AnchorTx, TransferTxLabel,
15251525
)
15261526
switch {
15271527
case errors.Is(err, lnwallet.ErrDoubleSpend):

tapfreighter/interface.go

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ import (
2525
"github.com/lightningnetwork/lnd/keychain"
2626
)
2727

28+
const (
29+
// TransferTxLabel defines the label assigned to an on-chain transaction
30+
// that represents a tapd asset transfer.
31+
TransferTxLabel = "tapd-asset-transfer"
32+
)
33+
2834
// CommitmentConstraints conveys the constraints on the type of Taproot asset
2935
// commitments needed to satisfy a send request. Typically, for Bitcoin we just
3036
// care about the amount. In the case of Taproot Asset, we also need to worry

tapgarden/caretaker.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,9 @@ func (b *BatchCaretaker) stateStep(currentState BatchState) (BatchState, error)
840840
// transaction, then request a confirmation notification.
841841
ctx, cancel := b.WithCtxQuit()
842842
defer cancel()
843-
err = b.cfg.ChainBridge.PublishTransaction(ctx, signedTx)
843+
err = b.cfg.ChainBridge.PublishTransaction(
844+
ctx, signedTx, IssuanceTxLabel,
845+
)
844846
if err != nil {
845847
return 0, fmt.Errorf("unable to publish "+
846848
"transaction: %w", err)

tapgarden/interface.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ import (
2222
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
2323
)
2424

25+
const (
26+
// IssuanceTxLabel defines the label assigned to an on-chain transaction
27+
// that represents a tapd asset issuance.
28+
IssuanceTxLabel = "tapd-asset-issuance"
29+
)
30+
2531
// FundBatchResp is the response returned from the FundBatch method.
2632
type FundBatchResp struct {
2733
// Batch is the batch that was funded.
@@ -332,7 +338,7 @@ type ChainBridge interface {
332338

333339
// PublishTransaction attempts to publish a new transaction to the
334340
// network.
335-
PublishTransaction(context.Context, *wire.MsgTx) error
341+
PublishTransaction(context.Context, *wire.MsgTx, string) error
336342

337343
// EstimateFee returns a fee estimate for the confirmation target.
338344
EstimateFee(ctx context.Context,

tapgarden/mock.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ func (m *MockChainBridge) GetBlockTimestamp(_ context.Context, _ uint32) int64 {
705705
}
706706

707707
func (m *MockChainBridge) PublishTransaction(_ context.Context,
708-
tx *wire.MsgTx) error {
708+
tx *wire.MsgTx, _ string) error {
709709

710710
m.PublishReq <- tx
711711
return nil

0 commit comments

Comments
 (0)