graph/db: add comment and switch to length check

Use a length check to determine if a bitcoin signature has been set or
not. Also add a clarifying comment to explain why we only need to check
if one signature field is set to determine if we have the auth proof for
the channel or not.
This commit is contained in:
Elle Mouton
2025-06-18 15:17:55 +02:00
parent 31c74f20fa
commit 23d4bfc1b0

View File

@@ -1702,7 +1702,10 @@ func getAndBuildEdgeInfo(ctx context.Context, db SQLQueries,
ExtraOpaqueData: recs,
}
if dbChan.Bitcoin1Signature != nil {
// We always set all the signatures at the same time, so we can
// safely check if one signature is present to determine if we have the
// rest of the signatures for the auth proof.
if len(dbChan.Bitcoin1Signature) > 0 {
channel.AuthProof = &models.ChannelAuthProof{
NodeSig1Bytes: dbChan.Node1Signature,
NodeSig2Bytes: dbChan.Node2Signature,