-
Notifications
You must be signed in to change notification settings - Fork 123
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
Store transfer output proof delivery status #1035
Merged
ffranr
merged 7 commits into
lightninglabs:main
from
ffranr:store-proof-delivery-status
Jul 29, 2024
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6162e05
tapdb: add proof_delivery_complete and position to transfer outputs
ffranr 2c3b072
tapfreighter: add method ShouldDeliverProof to struct TransferOutput
ffranr 995f6d8
tapdb+tapfreighter: set and retrieve fields from new columns
ffranr 2841027
tapfreighter: simplify ChainPorter method transferReceiverProof
ffranr 6908372
tapdb+tapfreighter: log proof delivery as confirmed
ffranr d8c49b0
tapdb: unit tests: set missing position fields in transfer outputs
ffranr 25f0aba
tapdb: add unit test for proof delivery confirmation
ffranr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,6 +248,48 @@ type TransferOutput struct { | |
ProofCourierAddr []byte | ||
} | ||
|
||
// ShouldDeliverProof returns true if a proof corresponding to the subject | ||
// transfer output should be delivered to a peer. | ||
func (out *TransferOutput) ShouldDeliverProof() (bool, error) { | ||
// If the proof courier address is unspecified, we don't need to deliver | ||
// a proof. | ||
if len(out.ProofCourierAddr) == 0 { | ||
return false, nil | ||
} | ||
|
||
// The proof courier address may have been specified in error, in which | ||
// case we will conduct further checks to determine if a proof should be | ||
// delivered. | ||
// | ||
// If the script key is un-spendable, we don't need to deliver a proof. | ||
unSpendable, err := out.ScriptKey.IsUnSpendable() | ||
if err != nil { | ||
return false, fmt.Errorf("error checking if script key is "+ | ||
"unspendable: %w", err) | ||
} | ||
|
||
if unSpendable { | ||
return false, nil | ||
} | ||
|
||
// If this is an output that is going to our own node/wallet, we don't | ||
// need to deliver a proof. | ||
if out.ScriptKey.TweakedScriptKey != nil && out.ScriptKeyLocal { | ||
return false, nil | ||
} | ||
|
||
// If the script key is a burn key, we don't need to deliver a proof. | ||
if len(out.WitnessData) > 0 && asset.IsBurnKey( | ||
out.ScriptKey.PubKey, out.WitnessData[0], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't burns still relevant? So to proof to someone that you've burnt an asset. |
||
) { | ||
|
||
return false, nil | ||
} | ||
|
||
// At this point, we should deliver a proof. | ||
return true, nil | ||
} | ||
|
||
// OutboundParcel represents the database level delta of an outbound Taproot | ||
// Asset parcel (outbound spend). A spend will destroy a series of assets listed | ||
// as inputs, and re-create them as new outputs. Along the way some assets may | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should double check this with some of the litd itests we have for channels. At times, we verify that a proof was uploaded even if it was a local script key.