Skip to content

tapchannel: fix proof courier initialization #1058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions tapchannel/aux_sweeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,14 +766,6 @@ func importOutputProofs(scid lnwire.ShortChannelID,
// TODO(roasbeef): should be part of post confirmation funding validate
// (chanvalidate)

// First, we'll make a courier to use in fetching the proofs we need.
proofFetcher, err := proofDispatch.NewCourier(
courierAddr, proof.Recipient{},
)
if err != nil {
return fmt.Errorf("unable to create proof courier: %w", err)
}

log.Infof("Importing %v proofs for ChannelPoint(%v)",
len(outputProofs), outputProofs[0].OutPoint())

Expand Down Expand Up @@ -807,10 +799,30 @@ func importOutputProofs(scid lnwire.ShortChannelID,
log.Infof("Fetching funding input proof, locator=%v",
spew.Sdump(inputProofLocator))

// First, we'll make a courier to use in fetching the proofs we
// need.
proofFetcher, err := proofDispatch.NewCourier(
courierAddr, proof.Recipient{
ScriptKey: scriptKey,
AssetID: proofPrevID.ID,
Amount: proofToImport.Asset.Amount,
},
)
if err != nil {
return fmt.Errorf("unable to create proof courier: %w",
err)
}

ctxb := context.Background()
prefixProof, err := proofFetcher.ReceiveProof(
ctxb, inputProofLocator,
)

// Always attempt to close the courier, even if we encounter an
// error.
_ = proofFetcher.Close()

// Handle any error that occurred during the proof fetch.
if err != nil {
return fmt.Errorf("unable to fetch prefix "+
"proof: %w", err)
Expand Down
Loading