Copy over all the code that the graph SQL migration needs to a separate folder. This will let us advance the main graph SQL CRUD code without worrying about changing the sql migration code. It will also let us change the SQL queries without changing the migration. In this commit, only the migration logic is "frozen" but in an upcoming commit, the sqlc queries & models will be frozen too.
36 lines
1.3 KiB
Go
36 lines
1.3 KiB
Go
package models
|
|
|
|
// ChannelAuthProof is the authentication proof (the signature portion) for a
|
|
// channel. Using the four signatures contained in the struct, and some
|
|
// auxiliary knowledge (the funding script, node identities, and outpoint) nodes
|
|
// on the network are able to validate the authenticity and existence of a
|
|
// channel. Each of these signatures signs the following digest: chanID ||
|
|
// nodeID1 || nodeID2 || bitcoinKey1|| bitcoinKey2 || 2-byte-feature-len ||
|
|
// features.
|
|
type ChannelAuthProof struct {
|
|
// NodeSig1Bytes are the raw bytes of the first node signature encoded
|
|
// in DER format.
|
|
NodeSig1Bytes []byte
|
|
|
|
// NodeSig2Bytes are the raw bytes of the second node signature
|
|
// encoded in DER format.
|
|
NodeSig2Bytes []byte
|
|
|
|
// BitcoinSig1Bytes are the raw bytes of the first bitcoin signature
|
|
// encoded in DER format.
|
|
BitcoinSig1Bytes []byte
|
|
|
|
// BitcoinSig2Bytes are the raw bytes of the second bitcoin signature
|
|
// encoded in DER format.
|
|
BitcoinSig2Bytes []byte
|
|
}
|
|
|
|
// IsEmpty check is the authentication proof is empty Proof is empty if at
|
|
// least one of the signatures are equal to nil.
|
|
func (c *ChannelAuthProof) IsEmpty() bool {
|
|
return len(c.NodeSig1Bytes) == 0 ||
|
|
len(c.NodeSig2Bytes) == 0 ||
|
|
len(c.BitcoinSig1Bytes) == 0 ||
|
|
len(c.BitcoinSig2Bytes) == 0
|
|
}
|