From 23d4bfc1b072dda75f366013638a2baf1b766413 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Wed, 18 Jun 2025 15:17:55 +0200 Subject: [PATCH] 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. --- graph/db/sql_store.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/graph/db/sql_store.go b/graph/db/sql_store.go index 137c1d2e2..e8cb36dfd 100644 --- a/graph/db/sql_store.go +++ b/graph/db/sql_store.go @@ -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,